Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark the instrumentation labels as deprecated #2358

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions common/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions k8sutils/pkg/describe/source/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions k8sutils/pkg/workload/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand All @@ -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 {
Expand Down
Loading