Skip to content

Commit

Permalink
Merge pull request #73 from DataDog/nnguyen/increase-limit
Browse files Browse the repository at this point in the history
Enforcing clustername maximum helm limit
  • Loading branch information
vboulineau committed Nov 3, 2020
2 parents a550c0a + fceb91b commit f37c209
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 deletions.
5 changes: 5 additions & 0 deletions charts/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Datadog changelog

## 2.4.33

* Introduce overall cluster-name limit of 80
* Remove character limit of single parts of the cluster-name

## 2.4.32

* The `agents.volumeMounts` option is now properly propagated to all agent containers.
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 2.4.32
version: 2.4.33
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 2.4.32](https://img.shields.io/badge/Version-2.4.32-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 2.4.33](https://img.shields.io/badge/Version-2.4.33-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)

[Datadog](https://www.datadoghq.com/) is a hosted infrastructure monitoring platform. This chart adds the Datadog Agent to all nodes in your cluster via a DaemonSet. It also optionally depends on the [kube-state-metrics chart](https://github.com/kubernetes/charts/tree/master/stable/kube-state-metrics). For more information about monitoring Kubernetes with Datadog, please refer to the [Datadog documentation website](https://docs.datadoghq.com/agent/basic_agent_usage/kubernetes/).

Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/ci/cluster-agent-values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
datadog:
clusterName: kubernetes-cluster.example.com
clusterName: kubernetes-cluster.example.comkubernetes-cluster.example.com.kube.rnetes-80chars
apiKey: "00000000000000000000000000000000"
appKey: "0000000000000000000000000000000000000000"
kubeStateMetricsEnabled: false
Expand Down
10 changes: 10 additions & 0 deletions charts/datadog/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
{{- end -}}
{{- end -}}

{{- define "check-cluster-name" }}
{{- $length := len .Values.datadog.clusterName -}}
{{- if (gt $length 80)}}
{{- fail "Your `clusterName` isn’t valid it has to be below 81 chars." -}}
{{- end}}
{{- if not (regexMatch "^([a-z]([a-z0-9\\-]*[a-z0-9])?\\.)*([a-z]([a-z0-9\\-]*[a-z0-9])?)$" .Values.datadog.clusterName) -}}
{{- fail "Your `clusterName` isn’t valid. It must be dot-separated tokens where a token start with a lowercase letter followed by lowercase letters, numbers, or hyphens, can only end with a with [a-z0-9] and has to be below 80 chars." -}}
{{- end -}}
{{- end -}}

{{/*
Expand the name of the chart.
*/}}
Expand Down
8 changes: 3 additions & 5 deletions charts/datadog/templates/cluster-agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ spec:
- name: DD_EXTERNAL_METRICS_PROVIDER_USE_DATADOGMETRIC_CRD
value: {{ .Values.clusterAgent.metricsProvider.useDatadogMetrics | quote }}
- name: DD_EXTERNAL_METRICS_AGGREGATOR
value: {{ .Values.clusterAgent.metricsProvider.aggregator | quote }}
value: {{ .Values.clusterAgent.metricsProvider.aggregator | quote }}
{{- end }}
{{- if .Values.clusterAgent.admissionController.enabled }}
- name: DD_ADMISSION_CONTROLLER_ENABLED
Expand All @@ -151,9 +151,7 @@ spec:
value: "kube_endpoints kube_services"
{{- end }}
{{- if .Values.datadog.clusterName }}
{{- 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` isn’t 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}}
{{- template "check-cluster-name" . }}
- name: DD_CLUSTER_NAME
value: {{ .Values.datadog.clusterName | quote }}
{{- end }}
Expand Down Expand Up @@ -212,7 +210,7 @@ spec:
readinessProbe:
{{- $ready := .Values.clusterAgent.readinessProbe }}
{{ include "probe.http" (dict "path" "/ready" "port" $healthPort "settings" $ready) | indent 10 }}
volumeMounts:
volumeMounts:
- name: installinfo
subPath: install_info
{{- if eq .Values.targetSystem "windows" }}
Expand Down
4 changes: 1 addition & 3 deletions charts/datadog/templates/containers-common-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
fieldPath: status.hostIP
{{- end }}
{{- if .Values.datadog.clusterName }}
{{- 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` isn’t 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}}
{{- template "check-cluster-name" . }}
- name: DD_CLUSTER_NAME
value: {{ .Values.datadog.clusterName | quote }}
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion charts/datadog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ datadog:
hostVolumeMountPropagation: None

# datadog.clusterName -- Set a unique cluster name to allow scoping hosts and Cluster Checks easily
## The name must be unique and must be dot-separated tokens where a token can be up to 40 characters with the following restrictions:
## The name must be unique and must be dot-separated tokens with the following restrictions:
## * Lowercase letters, numbers, and hyphens only.
## * Must start with a letter.
## * Must end with a number or a letter.
## * Overall length should not be higher than 80 characters.
## 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>
Expand Down

0 comments on commit f37c209

Please sign in to comment.