mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/datadog] Add validity checks on clusterName (#19327)
The cluster name parameter has been introduced to disambiguate nodes having the same name in different clusters. Cluster names are, for ex., used to build hostnames and must therefore comply with some rules. We enforce here the same rules as the ones enforced by GKE: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#Cluster.FIELDS.name The DataDog agent itself is already checking the validity of cluster names since DataDog/datadog-agent#4492. The goal of this change in the helm chart is to catch issues as early as possible because having a clear error message from helm is smarter than having to dig in the logs of a failing agent. Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
b14d8fc983
commit
fbf05893a5
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
name: datadog
|
||||
version: 1.38.11
|
||||
version: 1.38.12
|
||||
appVersion: "6"
|
||||
description: DataDog Agent
|
||||
keywords:
|
||||
|
||||
@@ -101,6 +101,9 @@ spec:
|
||||
value: "kube_services"
|
||||
{{- end }}
|
||||
{{- if .Values.datadog.clusterName }}
|
||||
{{- if not (regexMatch "^[a-z]([a-z0-9\\-]{0,38}[a-z0-9])?$" .Values.datadog.clusterName) }}
|
||||
{{- fail "Your `clusterName` isn’t valid. It must start with a lowercase letter followed by up to 39 lowercase letters, numbers, or hyphens and cannot end with a hyphen."}}
|
||||
{{- end}}
|
||||
- name: DD_CLUSTER_NAME
|
||||
value: {{ .Values.datadog.clusterName | quote }}
|
||||
{{- end }}
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
env:
|
||||
{{- include "containers-common-env" . | nindent 4 }}
|
||||
{{- if .Values.datadog.clusterName }}
|
||||
{{- if not (regexMatch "^[a-z]([a-z0-9\\-]{0,38}[a-z0-9])?$" .Values.datadog.clusterName) }}
|
||||
{{- fail "Your `clusterName` isn’t valid. It must start with a lowercase letter followed by up to 39 lowercase letters, numbers, or hyphens and cannot end with a hyphen."}}
|
||||
{{- end}}
|
||||
- name: DD_CLUSTER_NAME
|
||||
value: {{ .Values.datadog.clusterName | quote }}
|
||||
{{- end }}
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
name: {{ template "datadog.apiSecretName" . }}
|
||||
key: api-key
|
||||
{{- if .Values.datadog.clusterName }}
|
||||
{{- if not (regexMatch "^[a-z]([a-z0-9\\-]{0,38}[a-z0-9])?$" .Values.datadog.clusterName) }}
|
||||
{{- fail "Your `clusterName` isn’t valid. It must start with a lowercase letter followed by up to 39 lowercase letters, numbers, or hyphens and cannot end with a hyphen."}}
|
||||
{{- end}}
|
||||
- name: DD_CLUSTER_NAME
|
||||
value: {{ .Values.datadog.clusterName | quote }}
|
||||
{{- end }}
|
||||
|
||||
@@ -71,6 +71,12 @@ datadog:
|
||||
|
||||
## @param clusterName - string - optional
|
||||
## Set a unique cluster name to allow scoping hosts and Cluster Checks easily
|
||||
## The name must be unique and can be up to 40 characters with the following restrictions:
|
||||
## * Lowercase letters, numbers, and hyphens only.
|
||||
## * Must start with a letter.
|
||||
## * Must end with a number or a letter.
|
||||
## These are the same rules as the one enforced by GKE on the same cluster name parameter:
|
||||
## https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#Cluster.FIELDS.name
|
||||
#
|
||||
# clusterName: <CLUSTER_NAME>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user