Skip to content

Commit

Permalink
[operator] Allow adding custom annotations to various objects
Browse files Browse the repository at this point in the history
Similar to `additionalLabels`, but for annotations.  This is somewhat
inspired by `cert-manager`s Helm chart [1], which allows custom annotations
on essentially all Kubernetes objects.

E.g. there could be internal annotations in certain environments that
are recommended or required

[1]: https://artifacthub.io/packages/helm/cert-manager/cert-manager
  • Loading branch information
heyLu committed Mar 19, 2024
1 parent 2ef00ab commit d457326
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/opentelemetry-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
{{- with .Values.manager.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
Expand Down
8 changes: 8 additions & 0 deletions charts/opentelemetry-operator/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
apiVersion: v1
kind: Service
metadata:
{{- with .Values.manager.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
Expand All @@ -27,6 +31,10 @@ spec:
apiVersion: v1
kind: Service
metadata:
{{- with .Values.admissionWebhooks.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
Expand Down
27 changes: 27 additions & 0 deletions charts/opentelemetry-operator/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
"env",
"serviceAccount",
"serviceMonitor",
"deploymentAnnotations",
"serviceAnnotations",
"podAnnotations",
"podLabels",
"prometheusRule",
Expand Down Expand Up @@ -693,6 +695,22 @@
}]
}]
},
"deploymentAnnotations": {
"type": "object",
"default": {},
"title": "The deploymentAnnotations Schema",
"required": [],
"properties": {},
"examples": [{}]
},
"serviceAnnotations": {
"type": "object",
"default": {},
"title": "The serviceAnnotations Schema",
"required": [],
"properties": {},
"examples": [{}]
},
"podAnnotations": {
"type": "object",
"default": {},
Expand Down Expand Up @@ -1232,6 +1250,7 @@
"cert_file",
"key_file",
"ca_file",
"serviceAnnotations",
"secretAnnotations",
"secretLabels"
],
Expand Down Expand Up @@ -1427,6 +1446,14 @@
""
]
},
"serviceAnnotations": {
"type": "object",
"default": {},
"title": "The serviceAnnotations Schema",
"required": [],
"properties": {},
"examples": [{}]
},
"secretAnnotations": {
"type": "object",
"default": {},
Expand Down
8 changes: 8 additions & 0 deletions charts/opentelemetry-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ manager:
metricsEndpoints:
- port: metrics

# Adds additional annotations to the manager Deployment
deploymentAnnotations: {}
# Adds additional annotations to the manager Service
serviceAnnotations: {}

podAnnotations: {}
podLabels: {}

Expand Down Expand Up @@ -239,6 +244,9 @@ admissionWebhooks:
## Path to the CA cert.
ca_file: ""

# Adds additional annotations to the admissionWebhook Service
serviceAnnotations: {}

## Secret annotations
secretAnnotations: {}
## Secret labels
Expand Down

0 comments on commit d457326

Please sign in to comment.