Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RoVernekar committed Oct 25, 2023
1 parent 74211ad commit 146a9d5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/manifests/manifestutils/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func Labels(instance metav1.ObjectMeta, name string, image string, component str
func SelectorLabels(instance metav1.ObjectMeta, component string) map[string]string {
return map[string]string{
"app.kubernetes.io/managed-by": "opentelemetry-operator",
"app.kubernetes.io/instance": naming.PodInstanceLabel(instance.Namespace, instance.Name),
"app.kubernetes.io/instance": naming.Truncate("%s.%s", 63, instance.Namespace, instance.Name),
"app.kubernetes.io/part-of": "opentelemetry",
"app.kubernetes.io/component": component,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/targetallocator/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Labels(instance v1alpha1.OpenTelemetryCollector, name string) map[string]st
}

base["app.kubernetes.io/managed-by"] = "opentelemetry-operator"
base["app.kubernetes.io/instance"] = naming.PodInstanceLabel(instance.Namespace, instance.Name)
base["app.kubernetes.io/instance"] = naming.Truncate("%s.%s", 63, instance.Namespace, instance.Name)
base["app.kubernetes.io/part-of"] = "opentelemetry"
base["app.kubernetes.io/component"] = "opentelemetry-targetallocator"

Expand Down
5 changes: 0 additions & 5 deletions internal/naming/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,3 @@ func ServiceMonitor(otelcol string) string {
func TargetAllocatorServiceAccount(otelcol string) string {
return DNSName(Truncate("%s-targetallocator", 63, otelcol))
}

// PodInstanceLabel returns a label value containing the namespace and instance name.
func PodInstanceLabel(namespace string, otelcol string) string {
return Truncate("%s.%s", 63, namespace, otelcol)
}
2 changes: 1 addition & 1 deletion pkg/sidecar/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func add(cfg config.Config, logger logr.Logger, otelcol v1alpha1.OpenTelemetryCo
if pod.Labels == nil {
pod.Labels = map[string]string{}
}
pod.Labels[injectedLabel] = naming.PodInstanceLabel(otelcol.Namespace, otelcol.Name)
pod.Labels[injectedLabel] = naming.Truncate("%s.%s", 63, otelcol.Namespace, otelcol.Name)

return pod, nil
}
Expand Down

0 comments on commit 146a9d5

Please sign in to comment.