From fe3928a3da0b759bad578247d69a9f4ed2889e43 Mon Sep 17 00:00:00 2001 From: Sarah Hodne Date: Mon, 14 Feb 2022 11:31:03 +0000 Subject: [PATCH] Allow passing custom arguments to the autoscaler This can be useful if you have CoreDNS deployments that only serve a subset of nodes, and you want to use --nodelabels on the autoscaler to have it scale according to just those nodes. Signed-off-by: Sarah Hodne --- charts/coredns/Chart.yaml | 2 +- charts/coredns/README.md | 1 + charts/coredns/templates/deployment-autoscaler.yaml | 3 +++ charts/coredns/values.yaml | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/charts/coredns/Chart.yaml b/charts/coredns/Chart.yaml index 5dca723..53f652a 100644 --- a/charts/coredns/Chart.yaml +++ b/charts/coredns/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: coredns -version: 1.16.7 +version: 1.17.0 appVersion: 1.8.7 home: https://coredns.io icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png diff --git a/charts/coredns/README.md b/charts/coredns/README.md index 19c4ecb..81e1e72 100644 --- a/charts/coredns/README.md +++ b/charts/coredns/README.md @@ -113,6 +113,7 @@ The command removes all the Kubernetes components associated with the chart and | `autoscaler.max` | Max size of replicaCount | 0 (aka no max) | | `autoscaler.includeUnschedulableNodes` | Should the replicas scale based on the total number or only schedulable nodes | `false` | | `autoscaler.preventSinglePointFailure` | If true does not allow single points of failure to form | `true` | +| `autoscaler.customFlags` | A list of custom flags to pass into cluster-proportional-autoscaler | (no args) | | `autoscaler.image.repository` | The image repository to pull autoscaler from | k8s.gcr.io/cluster-proportional-autoscaler-amd64 | | `autoscaler.image.tag` | The image tag to pull autoscaler from | `1.8.1` | | `autoscaler.image.pullPolicy` | Image pull policy for the autoscaler | IfNotPresent | diff --git a/charts/coredns/templates/deployment-autoscaler.yaml b/charts/coredns/templates/deployment-autoscaler.yaml index 517bb37..79450f1 100644 --- a/charts/coredns/templates/deployment-autoscaler.yaml +++ b/charts/coredns/templates/deployment-autoscaler.yaml @@ -86,4 +86,7 @@ spec: - --target=Deployment/{{ default (include "coredns.fullname" .) .Values.deployment.name }} - --logtostderr=true - --v=2 + {{- if .Values.autoscaler.customFlags }} +{{ toYaml .Values.autoscaler.customFlags | indent 10 }} + {{- end }} {{- end }} diff --git a/charts/coredns/values.yaml b/charts/coredns/values.yaml index 30c6918..76ce4be 100644 --- a/charts/coredns/values.yaml +++ b/charts/coredns/values.yaml @@ -258,6 +258,11 @@ autoscaler: # If true does not allow single points of failure to form preventSinglePointFailure: true + ## Optionally specify some extra flags to pass to cluster-proprtional-autoscaler. + ## Useful for e.g. the nodelabels flag. + # customFlags: + # - --nodelabels=topology.kubernetes.io/zone=us-east-1a + image: repository: k8s.gcr.io/cluster-proportional-autoscaler-amd64 tag: "1.8.1"