[stable/datadog] Allow dots in cluster names (#19618)

* [stable/datadog] Allow dots in cluster names

because some users already have dots in their cluster names:
https://github.com/helm/charts/pull/19327#issuecomment-565535449

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Add a test for clusterName

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>
This commit is contained in:
Lénaïc Huard
2019-12-16 09:27:37 -08:00
committed by Kubernetes Prow Robot
parent 3c674daaf7
commit c65adfb0b7
6 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 1.38.12
version: 1.38.13
appVersion: "6"
description: DataDog Agent
keywords:
+4
View File
@@ -0,0 +1,4 @@
# Empty values file for testing default parameters.
datadog:
clusterName: kubernetes-cluster.example.com
@@ -101,8 +101,8 @@ 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` isnt valid. It must start with a lowercase letter followed by up to 39 lowercase letters, numbers, or hyphens and cannot end with a hyphen."}}
{{- if not (regexMatch "^([a-z]([a-z0-9\\-]{0,38}[a-z0-9])?\\.)*([a-z]([a-z0-9\\-]{0,38}[a-z0-9])?)$" .Values.datadog.clusterName) }}
{{- fail "Your `clusterName` isnt valid. It must be dot-separated tokens where a token 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 }}
@@ -15,8 +15,8 @@
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` isnt valid. It must start with a lowercase letter followed by up to 39 lowercase letters, numbers, or hyphens and cannot end with a hyphen."}}
{{- if not (regexMatch "^([a-z]([a-z0-9\\-]{0,38}[a-z0-9])?\\.)*([a-z]([a-z0-9\\-]{0,38}[a-z0-9])?)$" .Values.datadog.clusterName) }}
{{- fail "Your `clusterName` isnt valid. It must be dot-separated tokens where a token 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 }}
@@ -26,8 +26,8 @@
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` isnt valid. It must start with a lowercase letter followed by up to 39 lowercase letters, numbers, or hyphens and cannot end with a hyphen."}}
{{- if not (regexMatch "^([a-z]([a-z0-9\\-]{0,38}[a-z0-9])?\\.)*([a-z]([a-z0-9\\-]{0,38}[a-z0-9])?)$" .Values.datadog.clusterName) }}
{{- fail "Your `clusterName` isnt valid. It must be dot-separated tokens where a token 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 }}
+2 -2
View File
@@ -71,11 +71,11 @@ 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:
## The name must be unique and must be dot-separated tokens where a token 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:
## Compared to the rules of GKE, dots are allowed whereas they are not allowed on GKE:
## https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#Cluster.FIELDS.name
#
# clusterName: <CLUSTER_NAME>