Skip to content

Commit

Permalink
[operator] Add the ability to add additionalLabels
Browse files Browse the repository at this point in the history
This already existed in the `opentelemetry-collector` chart, now it
is available in the `opentelemetry-operator` as well.

These labels can be useful in environments where additional labels
are recommended or required.
  • Loading branch information
heyLu committed Mar 6, 2024
1 parent 84340a4 commit b32b80d
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: webhook
name: example-opentelemetry-operator-mutation
webhooks:
Expand Down Expand Up @@ -96,6 +97,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: webhook
name: example-opentelemetry-operator-validation
webhooks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: webhook
name: example-opentelemetry-operator-serving-cert
namespace: default
Expand All @@ -34,6 +35,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: webhook
name: example-opentelemetry-operator-selfsigned-issuer
namespace: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-manager
rules:
Expand Down Expand Up @@ -258,6 +259,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-metrics
rules:
Expand All @@ -276,6 +278,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-proxy
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-manager
roleRef:
Expand All @@ -30,6 +31,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-proxy
roleRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator
namespace: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-leader-election
namespace: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-leader-election
namespace: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator
namespace: default
Expand Down Expand Up @@ -36,6 +37,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
name: example-opentelemetry-operator-webhook
namespace: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: webhook
annotations:
"helm.sh/hook": test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
annotations:
"helm.sh/hook": test
Expand Down Expand Up @@ -48,6 +49,7 @@ metadata:
app.kubernetes.io/version: "0.94.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example

app.kubernetes.io/component: controller-manager
annotations:
"helm.sh/hook": test
Expand Down
7 changes: 7 additions & 0 deletions charts/opentelemetry-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ include "opentelemetry-operator.additionalLabels" . }}
{{- end }}

{{/*
Expand Down Expand Up @@ -73,6 +74,12 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{- define "opentelemetry-operator.additionalLabels" -}}
{{- if .Values.additionalLabels }}
{{- tpl (.Values.additionalLabels | toYaml) . }}
{{- end }}
{{- end }}

{{/*
Create an ordered name of the MutatingWebhookConfiguration
*/}}
Expand Down
11 changes: 10 additions & 1 deletion charts/opentelemetry-operator/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"hostNetwork",
"priorityClassName",
"securityContext",
"testFramework"
"testFramework",
"additionalLabels"
],
"properties": {
"replicaCount": {
Expand Down Expand Up @@ -1660,6 +1661,14 @@
"tag": "latest"
}
}]
},
"additionalLabels": {
"type": "object",
"default": {},
"title": "The additionalLabels Schema",
"required": [],
"properties": {},
"examples": [{}]
}
},
"examples": [{
Expand Down
3 changes: 3 additions & 0 deletions charts/opentelemetry-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ nameOverride: ""
## Reference one or more secrets to be used when pulling images from authenticated repositories.
imagePullSecrets: []

# Common labels to add to all otel-collector resources. Evaluated as a template.
additionalLabels: {}

## Pod Disruption Budget configuration
##
pdb:
Expand Down

0 comments on commit b32b80d

Please sign in to comment.