[stable/datadog] Add an option to reference an existing clusterAgent.token (#16208)

* [stable/datadog]: adding option to pass existing ClusterAgent token secret

Signed-off-by: Fahad Arshad <fahad.arshad@hobsons.com>

* [stable/datadog]: Chart version bump

Signed-off-by: Fahad Arshad <fahad.arshad@hobsons.com>

* [stable/datadog]: adding an extra line in agent-secret.yaml

Signed-off-by: Fahad Arshad <fahad.arshad@hobsons.com>

* use clusterAgent.tokenSecretName template to make code DRY

Signed-off-by: Fahad Arshad <fahad.arshad@hobsons.com>
This commit is contained in:
farshad-hobsons
2019-08-13 04:29:41 -07:00
committed by Kubernetes Prow Robot
parent eeee789c00
commit 8f3e5889dd
9 changed files with 22 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 1.32.1
version: 1.32.2
appVersion: 6.12.1
description: DataDog Agent
keywords:
+1
View File
@@ -298,6 +298,7 @@ helm install --name <RELEASE_NAME> \
| `kube-state-metrics.serviceAccount.name` | If not set & create is true, use template fullname | |
| `clusterAgent.enabled` | Use the cluster-agent for cluster metrics (Kubernetes 1.10+ only) | `false` |
| `clusterAgent.token` | A cluster-internal secret for agent-to-agent communication. Must be 32+ characters a-zA-Z | Generates a random value |
| `clusterAgent.tokenExistingSecret` | If set, use the secret with a provided name instead of creating a new one | `nil` |
| `clusterAgent.containerName` | The container name for the Cluster Agent | `cluster-agent` |
| `clusterAgent.image.repository` | The image repository for the cluster-agent | `datadog/cluster-agent` |
| `clusterAgent.image.tag` | The image tag to pull | `1.2.0` |
+2 -2
View File
@@ -44,13 +44,13 @@ Create an application key at https://app.datadoghq.com/account/settings#api
{{- end }}
{{- end }}
{{- if not .Values.clusterAgent.token }}
{{- if and (not .Values.clusterAgent.token) (not .Values.clusterAgent.tokenExistingSecret) }}
##############################################################################
#### INFO: You did not set a clusterAgent.token ####
##############################################################################
Because you enabled the Cluster Agent but did not provide a token, a random token was generated.
Because you enabled the Cluster Agent but did not either provide a token or a reference to an existing token via '{{ .Values.clusterAgent.tokenExistingSecret }}', a random token was generated.
This token is used to secure the communication between the Agents and the Cluster Agent.
Make sure to recreate all pods on upgrade (with the --recreate-pods flag) to ensure all
+11
View File
@@ -48,6 +48,17 @@ Return secret name to be used based on provided values.
{{- default $fullName .Values.datadog.appKeyExistingSecret | quote -}}
{{- end -}}
{{/*
Return secret name to be used based on provided values.
*/}}
{{- define "clusterAgent.tokenSecretName" -}}
{{- if not .Values.clusterAgent.tokenExistingSecret -}}
{{- include "datadog.fullname" . -}}-cluster-agent
{{- else -}}
{{- .Values.clusterAgent.tokenExistingSecret -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for RBAC APIs.
*/}}
@@ -40,7 +40,7 @@ spec:
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "datadog.fullname" . }}-cluster-agent
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
- name: DD_CLUSTER_AGENT_ENABLED
value: {{ .Values.clusterAgent.enabled | quote }}
@@ -1,3 +1,4 @@
{{- if not .Values.clusterAgent.tokenExistingSecret }}
{{- if .Values.clusterAgent.enabled -}}
apiVersion: v1
@@ -17,3 +18,5 @@ data:
token: {{ randAlphaNum 32 | b64enc | quote }}
{{ end }}
{{- end }}
{{ end }}
@@ -116,7 +116,7 @@ spec:
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "datadog.fullname" . }}-cluster-agent
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
- name: DD_KUBE_RESOURCES_NAMESPACE
value: {{ .Release.Namespace }}
@@ -67,7 +67,7 @@
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "datadog.fullname" . }}-cluster-agent
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
{{- end }}
{{- if .Values.datadog.podLabelsAsTags }}
@@ -94,7 +94,7 @@
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "datadog.fullname" . }}-cluster-agent
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
{{- end }}
- name: KUBERNETES