From a98ca12f12bb8ce5ca7d357ef804ffbd73d7bb32 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 7 Jun 2021 16:07:24 -0700 Subject: [PATCH] Add an option to add extra annotations --- CHANGELOG.md | 1 + .../splunk-otel-collector/templates/daemonset.yaml | 7 +++++++ .../templates/deployment-collector.yaml | 7 +++++++ .../templates/deployment-k8s-cluster-receiver.yaml | 7 +++++++ .../templates/serviceAccount.yaml | 4 ++++ helm-charts/splunk-otel-collector/values.yaml | 11 +++++++++++ 6 files changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61a62c9b42..6c92e17ee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +- Add an option to add extra annotations to deployments, daemonset, pods and service account (#158) - Add an option to mount extra volumes to gateway-mode and k8s cluster receiver collectors (#157) ## [0.26.2] - 2021-05-28 diff --git a/helm-charts/splunk-otel-collector/templates/daemonset.yaml b/helm-charts/splunk-otel-collector/templates/daemonset.yaml index f8d5ff83ca..5d64f0e566 100644 --- a/helm-charts/splunk-otel-collector/templates/daemonset.yaml +++ b/helm-charts/splunk-otel-collector/templates/daemonset.yaml @@ -11,6 +11,10 @@ metadata: {{- if .Values.logsEnabled }} engine: fluentd {{- end }} + {{- if .Values.otelAgent.annotations }} + annotations: + {{- toYaml .Values.otelAgent.annotations | nindent 4 }} + {{- end }} spec: updateStrategy: type: RollingUpdate @@ -25,6 +29,9 @@ spec: release: {{ .Release.Name }} annotations: checksum/config: {{ print (include (print $.Template.BasePath "/configmap-fluentd.yaml") .) (include (print $.Template.BasePath "/configmap-otel-agent.yaml") .) | sha256sum }} + {{- if .Values.otelAgent.podAnnotations }} + {{- toYaml .Values.otelAgent.podAnnotations | nindent 8 }} + {{- end }} spec: hostNetwork: true dnsPolicy: ClusterFirstWithHostNet diff --git a/helm-charts/splunk-otel-collector/templates/deployment-collector.yaml b/helm-charts/splunk-otel-collector/templates/deployment-collector.yaml index 45f2343550..5cda5bd82d 100644 --- a/helm-charts/splunk-otel-collector/templates/deployment-collector.yaml +++ b/helm-charts/splunk-otel-collector/templates/deployment-collector.yaml @@ -9,6 +9,10 @@ metadata: chart: {{ template "splunk-otel-collector.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- if .Values.otelCollector.annotations }} + annotations: + {{- toYaml .Values.otelCollector.annotations | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.otelCollector.replicaCount }} selector: @@ -24,6 +28,9 @@ spec: release: {{ .Release.Name }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap-otel-collector.yaml") . | sha256sum }} + {{- if .Values.otelCollector.podAnnotations }} + {{- toYaml .Values.otelCollector.podAnnotations | nindent 8 }} + {{- end }} spec: serviceAccountName: {{ template "splunk-otel-collector.serviceAccountName" . }} {{- if .Values.otelCollector.nodeSelector }} diff --git a/helm-charts/splunk-otel-collector/templates/deployment-k8s-cluster-receiver.yaml b/helm-charts/splunk-otel-collector/templates/deployment-k8s-cluster-receiver.yaml index 8336a7b3fe..bf6ad0fd08 100644 --- a/helm-charts/splunk-otel-collector/templates/deployment-k8s-cluster-receiver.yaml +++ b/helm-charts/splunk-otel-collector/templates/deployment-k8s-cluster-receiver.yaml @@ -9,6 +9,10 @@ metadata: chart: {{ template "splunk-otel-collector.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- if .Values.otelK8sClusterReceiver.annotations }} + annotations: + {{- toYaml .Values.otelK8sClusterReceiver.annotations | nindent 4 }} + {{- end }} spec: replicas: 1 selector: @@ -24,6 +28,9 @@ spec: release: {{ .Release.Name }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap-otel-k8s-cluster-receiver.yaml") . | sha256sum }} + {{- if .Values.otelK8sClusterReceiver.podAnnotations }} + {{- toYaml .Values.otelK8sClusterReceiver.podAnnotations | nindent 8 }} + {{- end }} spec: serviceAccountName: {{ template "splunk-otel-collector.serviceAccountName" . }} {{- if .Values.otelK8sClusterReceiver.nodeSelector }} diff --git a/helm-charts/splunk-otel-collector/templates/serviceAccount.yaml b/helm-charts/splunk-otel-collector/templates/serviceAccount.yaml index a517d7efd3..9c4e29c4ec 100644 --- a/helm-charts/splunk-otel-collector/templates/serviceAccount.yaml +++ b/helm-charts/splunk-otel-collector/templates/serviceAccount.yaml @@ -14,4 +14,8 @@ metadata: chart: {{ template "splunk-otel-collector.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- if .Values.serviceAccount.annotations }} + annotations: + {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} + {{- end }} {{- end }} diff --git a/helm-charts/splunk-otel-collector/values.yaml b/helm-charts/splunk-otel-collector/values.yaml index f1e8034d65..a7d710ad02 100644 --- a/helm-charts/splunk-otel-collector/values.yaml +++ b/helm-charts/splunk-otel-collector/values.yaml @@ -186,6 +186,10 @@ otelK8sClusterReceiver: terminationGracePeriodSeconds: 600 priorityClassName: "" + # k8s cluster receiver collector annotations + annotations: {} + podAnnotations: {} + # Extra enviroment variables to be set in the OTel Cluster Receiver container extraEnvs: [] @@ -517,6 +521,9 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: + # Service account annotations + annotations: {} + podSecurityPolicy: # Specifies whether Pod Security Policy resources should be created. # This should be set to `false` if either: @@ -615,6 +622,10 @@ otelCollector: terminationGracePeriodSeconds: 600 priorityClassName: "" + # OTel collector annotations + annotations: {} + podAnnotations: {} + # Extra enviroment variables to be set in the standalone OTel collector container extraEnvs: []