Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
[stable/datadog] Fix metricsProvider port with Kubernetes <= 1.14 (#2…
Browse files Browse the repository at this point in the history
…3358)

Signed-off-by: Vincent Boulineau <[email protected]>
  • Loading branch information
vboulineau authored Jul 27, 2020
1 parent 9b630cf commit d6da827
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 6 deletions.
4 changes: 4 additions & 0 deletions stable/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Datadog changelog

## 2.3.41

* Fix issue with Kubernetes <= 1.14 and Cluster Agent's External Metrics Provider (must be 443)

## 2.3.40

* Update documentation for resource requests & limits default values.
Expand Down
2 changes: 1 addition & 1 deletion stable/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 2.3.40
version: 2.3.41
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
2 changes: 1 addition & 1 deletion stable/datadog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ helm install --name <RELEASE_NAME> \
| `clusterAgent.rbac.serviceAccount` | existing ServiceAccount to use (ignored if rbac.create=true) for cluster agent's pods | `default` |
| `clusterAgent.metricsProvider.enabled` | Enable Datadog metrics as a source for HPA scaling | `false` |
| `clusterAgent.metricsProvider.service.type` | The type of service to use for the clusterAgent metrics server | `ClusterIP` |
| `clusterAgent.metricsProvider.service.port` | The port for service to use for the clusterAgent metrics server | `8443` |
| `clusterAgent.metricsProvider.service.port` | The port for service to use for the clusterAgent metrics server (Kubernetes >= 1.15) | `8443` |
| `clusterAgent.env` | Additional Datadog environment variables for the cluster-agent | `nil` |
| `clusterAgent.confd` | Additional check configurations (static and Autodiscovery) | `nil` |
| `clusterAgent.podAnnotations` | Annotations to add to the Cluster Agent Pod(s) | `nil` |
Expand Down
11 changes: 11 additions & 0 deletions stable/datadog/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ beta.kubernetes.io/os
{{- end -}}
{{- end -}}

{{/*
Correct `clusterAgent.metricsProvider.service.port` if Kubernetes <= 1.15
*/}}
{{- define "clusterAgent.metricsProvider.port" -}}
{{- if semverCompare "^1.15-0" .Capabilities.KubeVersion.GitVersion -}}
{{- .Values.clusterAgent.metricsProvider.service.port -}}
{{- else -}}
443
{{- end -}}
{{- end -}}

{{/*
Return the container runtime socket
*/}}
Expand Down
4 changes: 3 additions & 1 deletion stable/datadog/templates/agent-apiservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ spec:
service:
name: {{ template "datadog.fullname" . }}-cluster-agent-metrics-api
namespace: {{ .Release.Namespace }}
port: {{ .Values.clusterAgent.metricsProvider.service.port }}
{{- if semverCompare "^1.15-0" .Capabilities.KubeVersion.GitVersion }}
port: {{ template "clusterAgent.metricsProvider.port" . }}
{{- end }}
version: v1beta1
insecureSkipTLSVerify: true
group: external.metrics.k8s.io
Expand Down
2 changes: 1 addition & 1 deletion stable/datadog/templates/agent-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
selector:
app: {{ template "datadog.fullname" . }}-cluster-agent
ports:
- port: {{ .Values.clusterAgent.metricsProvider.service.port }}
- port: {{ template "clusterAgent.metricsProvider.port" . }}
name: metricsapi
protocol: TCP
{{ end }}
Expand Down
4 changes: 2 additions & 2 deletions stable/datadog/templates/cluster-agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ spec:
name: agentport
protocol: TCP
{{- if .Values.clusterAgent.metricsProvider.enabled }}
- containerPort: {{ .Values.clusterAgent.metricsProvider.service.port }}
- containerPort: {{ template "clusterAgent.metricsProvider.port" . }}
name: metricsapi
protocol: TCP
{{- end }}
Expand All @@ -113,7 +113,7 @@ spec:
- name: DD_EXTERNAL_METRICS_PROVIDER_ENABLED
value: {{ .Values.clusterAgent.metricsProvider.enabled | quote }}
- name: DD_EXTERNAL_METRICS_PROVIDER_PORT
value: {{ .Values.clusterAgent.metricsProvider.service.port | quote }}
value: {{ include "clusterAgent.metricsProvider.port" . | quote }}
- name: DD_EXTERNAL_METRICS_PROVIDER_WPA_CONTROLLER
value: {{ .Values.clusterAgent.metricsProvider.wpaController | quote }}
- name: DD_EXTERNAL_METRICS_PROVIDER_USE_DATADOGMETRIC_CRD
Expand Down

0 comments on commit d6da827

Please sign in to comment.