From 47fad26c3e8bdf3ca0a94a4af88c8fa4a123fc4c Mon Sep 17 00:00:00 2001 From: nicolas-laduguie <111897939+nicolas-laduguie@users.noreply.github.com> Date: Tue, 22 Oct 2024 23:40:03 +0200 Subject: [PATCH 1/4] feat(helm): custom arguments --- charts/cluster-autoscaler/README.md | 1 + charts/cluster-autoscaler/templates/deployment.yaml | 3 +++ charts/cluster-autoscaler/values.yaml | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/charts/cluster-autoscaler/README.md b/charts/cluster-autoscaler/README.md index fea52ebec764..e6e5b802d7c3 100644 --- a/charts/cluster-autoscaler/README.md +++ b/charts/cluster-autoscaler/README.md @@ -427,6 +427,7 @@ vpa: | envFromSecret | string | `""` | Secret name to use as envFrom. | | expanderPriorities | object | `{}` | The expanderPriorities is used if `extraArgs.expander` contains `priority` and expanderPriorities is also set with the priorities. If `extraArgs.expander` contains `priority`, then expanderPriorities is used to define cluster-autoscaler-priority-expander priorities. See: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md | | extraArgs | object | `{"logtostderr":true,"stderrthreshold":"info","v":4}` | Additional container arguments. Refer to https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca for the full list of cluster autoscaler parameters and their default values. Everything after the first _ will be ignored allowing the use of multi-string arguments. | +| customArgs | list | `[]` | Additional container arguments. Refer to https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca for the full list of cluster autoscaler parameters and their default values. List of arguments as strings. | | extraEnv | object | `{}` | Additional container environment variables. | | extraEnvConfigMaps | object | `{}` | Additional container environment variables from ConfigMaps. | | extraEnvSecrets | object | `{}` | Additional container environment variables from Secrets. | diff --git a/charts/cluster-autoscaler/templates/deployment.yaml b/charts/cluster-autoscaler/templates/deployment.yaml index 32b3e957afe4..3d4c8fa0c38f 100644 --- a/charts/cluster-autoscaler/templates/deployment.yaml +++ b/charts/cluster-autoscaler/templates/deployment.yaml @@ -132,6 +132,9 @@ spec: - --{{ $key | mustRegexFind "^[^_]+" }} {{- end }} {{- end }} + {{- range .Values.customArgs }} + - {{ . }} + {{- end }} env: - name: POD_NAMESPACE valueFrom: diff --git a/charts/cluster-autoscaler/values.yaml b/charts/cluster-autoscaler/values.yaml index 6e10673ae855..5e006d5d63e8 100644 --- a/charts/cluster-autoscaler/values.yaml +++ b/charts/cluster-autoscaler/values.yaml @@ -196,6 +196,12 @@ extraArgs: # balancing-ignore-label_1: first-label-to-ignore # balancing-ignore-label_2: second-label-to-ignore +# customArgs -- Additional custom container arguments. +# Refer to https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca for the full list of cluster autoscaler +# parameters and their default values. +# List of arguments as strings. +customArgs: [] + # extraEnv -- Additional container environment variables. extraEnv: {} From 39890d7729696c56d6f17bb9ea418f1e75784681 Mon Sep 17 00:00:00 2001 From: Nicolas Laduguie Date: Wed, 23 Oct 2024 14:11:17 +0200 Subject: [PATCH 2/4] Docs --- charts/cluster-autoscaler/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/cluster-autoscaler/README.md b/charts/cluster-autoscaler/README.md index e6e5b802d7c3..6d1642c3b00c 100644 --- a/charts/cluster-autoscaler/README.md +++ b/charts/cluster-autoscaler/README.md @@ -421,13 +421,13 @@ vpa: | clusterAPIMode | string | `"incluster-incluster"` | Cluster API mode, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/README.md#connecting-cluster-autoscaler-to-cluster-api-management-and-workload-clusters Syntax: workloadClusterMode-ManagementClusterMode for `kubeconfig-kubeconfig`, `incluster-kubeconfig` and `single-kubeconfig` you always must mount the external kubeconfig using either `extraVolumeSecrets` or `extraMounts` and `extraVolumes` if you dont set `clusterAPIKubeconfigSecret`and thus use an in-cluster config or want to use a non capi generated kubeconfig you must do so for the workload kubeconfig as well | | clusterAPIWorkloadKubeconfigPath | string | `"/etc/kubernetes/value"` | Path to kubeconfig for connecting to Cluster API managed workloadcluster, only used if `clusterAPIMode=kubeconfig-kubeconfig or kubeconfig-incluster` | | containerSecurityContext | object | `{}` | [Security context for container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) | +| customArgs | list | `[]` | Additional custom container arguments. Refer to https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca for the full list of cluster autoscaler parameters and their default values. List of arguments as strings. | | deployment.annotations | object | `{}` | Annotations to add to the Deployment object. | | dnsPolicy | string | `"ClusterFirst"` | Defaults to `ClusterFirst`. Valid values are: `ClusterFirstWithHostNet`, `ClusterFirst`, `Default` or `None`. If autoscaler does not depend on cluster DNS, recommended to set this to `Default`. | | envFromConfigMap | string | `""` | ConfigMap name to use as envFrom. | | envFromSecret | string | `""` | Secret name to use as envFrom. | | expanderPriorities | object | `{}` | The expanderPriorities is used if `extraArgs.expander` contains `priority` and expanderPriorities is also set with the priorities. If `extraArgs.expander` contains `priority`, then expanderPriorities is used to define cluster-autoscaler-priority-expander priorities. See: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md | | extraArgs | object | `{"logtostderr":true,"stderrthreshold":"info","v":4}` | Additional container arguments. Refer to https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca for the full list of cluster autoscaler parameters and their default values. Everything after the first _ will be ignored allowing the use of multi-string arguments. | -| customArgs | list | `[]` | Additional container arguments. Refer to https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca for the full list of cluster autoscaler parameters and their default values. List of arguments as strings. | | extraEnv | object | `{}` | Additional container environment variables. | | extraEnvConfigMaps | object | `{}` | Additional container environment variables from ConfigMaps. | | extraEnvSecrets | object | `{}` | Additional container environment variables from Secrets. | From dc3491b15e6f21bbb33891b4a10f7d8b9cdff541 Mon Sep 17 00:00:00 2001 From: Nicolas Laduguie Date: Fri, 1 Nov 2024 18:31:54 +0100 Subject: [PATCH 3/4] Docs --- charts/cluster-autoscaler/README.md | 8 ++++++++ charts/cluster-autoscaler/README.md.gotmpl | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/charts/cluster-autoscaler/README.md b/charts/cluster-autoscaler/README.md index 6d1642c3b00c..30819e0e442b 100644 --- a/charts/cluster-autoscaler/README.md +++ b/charts/cluster-autoscaler/README.md @@ -340,6 +340,14 @@ extraVolumeMounts: readOnly: true ``` +### Custom arguments + +You can use the `customArgs` value to give any argument to cluster autoscaler command. + +Typical use case is to give an environment variable as an argument which will be interpolated at execution time. + +This is helpful when you need to inject values from configmap or secret. + ## Troubleshooting The chart will succeed even if the container arguments are incorrect. A few minutes after starting `kubectl logs -l "app=aws-cluster-autoscaler" --tail=50` should loop through something like diff --git a/charts/cluster-autoscaler/README.md.gotmpl b/charts/cluster-autoscaler/README.md.gotmpl index 3d42a9568066..9c4058190381 100644 --- a/charts/cluster-autoscaler/README.md.gotmpl +++ b/charts/cluster-autoscaler/README.md.gotmpl @@ -340,6 +340,14 @@ extraVolumeMounts: readOnly: true ``` +### Custom arguments + +You can use the `customArgs` value to give any argument to cluster autoscaler command. + +Typical use case is to give an environment variable as an argument which will be interpolated at execution time. + +This is helpful when you need to inject values from configmap or secret. + ## Troubleshooting The chart will succeed even if the container arguments are incorrect. A few minutes after starting `kubectl logs -l "app=aws-cluster-autoscaler" --tail=50` should loop through something like From 6e8a5483c6ee04cbcdacd87adccc52e9bd849d3e Mon Sep 17 00:00:00 2001 From: Nicolas Laduguie Date: Sat, 28 Dec 2024 14:38:51 +0100 Subject: [PATCH 4/4] Bump minor version --- charts/cluster-autoscaler/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/cluster-autoscaler/Chart.yaml b/charts/cluster-autoscaler/Chart.yaml index 6a2836800349..d8980d304f09 100644 --- a/charts/cluster-autoscaler/Chart.yaml +++ b/charts/cluster-autoscaler/Chart.yaml @@ -11,4 +11,4 @@ name: cluster-autoscaler sources: - https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler type: application -version: 9.43.3 +version: 9.44.0