From 1707716dd7b1af654d7cbba173c68e519e93e991 Mon Sep 17 00:00:00 2001 From: Ron Federman <73110295+RonFed@users.noreply.github.com> Date: Sun, 2 Feb 2025 09:10:59 +0200 Subject: [PATCH] Mark the instrumentation labels as deprecated (#2358) Co-authored-by: Amir Blum --- common/consts/consts.go | 12 +++++++++--- k8sutils/pkg/describe/source/analyze.go | 1 + k8sutils/pkg/workload/workload.go | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/common/consts/consts.go b/common/consts/consts.go index ae5a10fb49..c5b084447e 100644 --- a/common/consts/consts.go +++ b/common/consts/consts.go @@ -15,9 +15,15 @@ const ( OTLPPort = 4317 OTLPHttpPort = 4318 PprofOdigosPort = 6060 - OdigosInstrumentationLabel = "odigos-instrumentation" - InstrumentationEnabled = "enabled" - InstrumentationDisabled = "disabled" + + // Deprecated: Sources are used to mark workloads for instrumentation. + OdigosInstrumentationLabel = "odigos-instrumentation" + + // Deprecated: Sources are used to mark workloads for instrumentation. + InstrumentationEnabled = "enabled" + + // Deprecated: Sources are used to mark workloads for instrumentation. + InstrumentationDisabled = "disabled" // Deprecated: reported name is set via the Source CR. OdigosReportedNameAnnotation = "odigos.io/reported-name" diff --git a/k8sutils/pkg/describe/source/analyze.go b/k8sutils/pkg/describe/source/analyze.go index 3f8220e0b0..9cccee39e6 100644 --- a/k8sutils/pkg/describe/source/analyze.go +++ b/k8sutils/pkg/describe/source/analyze.go @@ -87,6 +87,7 @@ type SourceAnalyze struct { Pods []PodAnalyze `json:"pods"` } +// Deprecated: Sources are used to mark workloads for instrumentation. func analyzeInstrumentationLabels(resource *OdigosSourceResources, workloadObj *K8sSourceObject) (InstrumentationLabelsAnalyze, bool) { workloadLabel, workloadFound := workloadObj.GetLabels()[consts.OdigosInstrumentationLabel] nsLabel, nsFound := resource.Namespace.GetLabels()[consts.OdigosInstrumentationLabel] diff --git a/k8sutils/pkg/workload/workload.go b/k8sutils/pkg/workload/workload.go index 978a1b4613..c74a07dfd9 100644 --- a/k8sutils/pkg/workload/workload.go +++ b/k8sutils/pkg/workload/workload.go @@ -60,6 +60,7 @@ func ObjectToWorkload(obj client.Object) (Workload, error) { } } +// Deprecated: this should only be used for backward compatibility migration. func IsObjectLabeledForInstrumentation(obj client.Object) bool { labels := obj.GetLabels() if labels == nil { @@ -74,6 +75,7 @@ func IsObjectLabeledForInstrumentation(obj client.Object) bool { return val == consts.InstrumentationEnabled } +// Deprecated: this should only be used for backward compatibility migration. func IsWorkloadInstrumentationEffectiveEnabled(ctx context.Context, kubeClient client.Client, obj client.Object) (bool, error) { // if the object itself is labeled, we will use that value workloadLabels := obj.GetLabels() @@ -98,6 +100,7 @@ func IsWorkloadInstrumentationEffectiveEnabled(ctx context.Context, kubeClient c return IsObjectLabeledForInstrumentation(&ns), nil } +// Deprecated: this should only be used for backward compatibility migration. func IsInstrumentationDisabledExplicitly(obj client.Object) bool { labels := obj.GetLabels() if labels != nil {