diff --git a/charts/cluster-autoscaler/Chart.yaml b/charts/cluster-autoscaler/Chart.yaml index 5b2c25dc4094067c17f69818438349be135c4f06..396a1943bae783b66852e0d4b79a087d88698144 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.46.5 +version: 9.46.6 diff --git a/charts/cluster-autoscaler/README.md b/charts/cluster-autoscaler/README.md index ea8b6bd0b293593459ab3163a2f7444a417c17fb..ef6d74a28eb5dedb9b26c696fdccbe82daf1f46f 100644 --- a/charts/cluster-autoscaler/README.md +++ b/charts/cluster-autoscaler/README.md @@ -183,6 +183,8 @@ $ helm install my-release autoscaler/cluster-autoscaler \ Note that `your-ig-prefix` should be a _prefix_ matching one or more MIGs, and _not_ the full name of the MIG. For example, to match multiple instance groups - `k8s-node-group-a-standard`, `k8s-node-group-b-gpu`, you would use a prefix of `k8s-node-group-`. +Prefixes will be rendered using `tpl` function so you can use any value of your choice if that's a valid prefix. For instance (ignore escaping characters): `gke-{{ .Values.autoDiscovery.clusterName }}` + In the event you want to explicitly specify MIGs instead of using auto-discovery, set members of the `autoscalingGroups` array directly - e.g. ``` @@ -326,7 +328,14 @@ For Kubernetes clusters that use Amazon EKS, the service account can be configur In order to accomplish this, you will first need to create a new IAM role with the above mentions policies. Take care in [configuring the trust relationship](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html#iam-role-configuration) to restrict access just to the service account used by cluster autoscaler. -Once you have the IAM role configured, you would then need to `--set rbac.serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=arn:aws:iam::123456789012:role/MyRoleName` when installing. +Once you have the IAM role configured, you would then need to `--set rbac.serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=arn:aws:iam::123456789012:role/MyRoleName` when installing. Alternatively, you can embed templates in values (ignore escaping characters): + +```yaml +rbac: + serviceAccount: + annotations: + eks.amazonaws.com/role-arn: "{{ .Values.aws.myroleARN }}" +``` ### Azure - Using azure workload identity diff --git a/charts/cluster-autoscaler/README.md.gotmpl b/charts/cluster-autoscaler/README.md.gotmpl index 55995b1988356190ca35ed1f9aa02acc31424f4c..d42c27d439cdc36d631a0f45f5d9bb2b2d9d9205 100644 --- a/charts/cluster-autoscaler/README.md.gotmpl +++ b/charts/cluster-autoscaler/README.md.gotmpl @@ -183,6 +183,8 @@ $ helm install my-release autoscaler/cluster-autoscaler \ Note that `your-ig-prefix` should be a _prefix_ matching one or more MIGs, and _not_ the full name of the MIG. For example, to match multiple instance groups - `k8s-node-group-a-standard`, `k8s-node-group-b-gpu`, you would use a prefix of `k8s-node-group-`. +Prefixes will be rendered using `tpl` function so you can use any value of your choice if that's a valid prefix. For instance (ignore escaping characters): `gke-{{`{{ .Values.autoDiscovery.clusterName }}`}}` + In the event you want to explicitly specify MIGs instead of using auto-discovery, set members of the `autoscalingGroups` array directly - e.g. ``` @@ -326,7 +328,14 @@ For Kubernetes clusters that use Amazon EKS, the service account can be configur In order to accomplish this, you will first need to create a new IAM role with the above mentions policies. Take care in [configuring the trust relationship](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html#iam-role-configuration) to restrict access just to the service account used by cluster autoscaler. -Once you have the IAM role configured, you would then need to `--set rbac.serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=arn:aws:iam::123456789012:role/MyRoleName` when installing. +Once you have the IAM role configured, you would then need to `--set rbac.serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=arn:aws:iam::123456789012:role/MyRoleName` when installing. Alternatively, you can embed templates in values (ignore escaping characters): + +```yaml +rbac: + serviceAccount: + annotations: + eks.amazonaws.com/role-arn: "{{`{{ .Values.aws.myroleARN `}}}}" +``` ### Azure - Using azure workload identity diff --git a/charts/cluster-autoscaler/templates/deployment.yaml b/charts/cluster-autoscaler/templates/deployment.yaml index a566a01ce02348119eb5050709a806bb3a0020fa..7a6b0a04748976e69fce9c8f5350bf1e4657c226 100644 --- a/charts/cluster-autoscaler/templates/deployment.yaml +++ b/charts/cluster-autoscaler/templates/deployment.yaml @@ -86,7 +86,7 @@ spec: {{- else if eq .Values.cloudProvider "gce" }} {{- if .Values.autoscalingGroupsnamePrefix }} {{- range .Values.autoscalingGroupsnamePrefix }} - - --node-group-auto-discovery=mig:namePrefix={{ .name }},min={{ .minSize }},max={{ .maxSize }} + - --node-group-auto-discovery=mig:namePrefix={{ tpl .name $ }},min={{ .minSize }},max={{ .maxSize }} {{- end }} {{- end }} {{- if eq .Values.cloudProvider "oci" }} @@ -144,9 +144,9 @@ spec: valueFrom: fieldRef: fieldPath: spec.serviceAccountName - {{- if and (eq .Values.cloudProvider "aws") (ne .Values.awsRegion "") }} + {{- if and (eq .Values.cloudProvider "aws") (ne (tpl .Values.awsRegion $) "") }} - name: AWS_REGION - value: "{{ .Values.awsRegion }}" + value: "{{ tpl .Values.awsRegion $ }}" {{- if .Values.awsAccessKeyID }} - name: AWS_ACCESS_KEY_ID valueFrom: diff --git a/charts/cluster-autoscaler/templates/serviceaccount.yaml b/charts/cluster-autoscaler/templates/serviceaccount.yaml index 29c2580c2e3455b6f09d5c12514c1a7d980eb327..465b5aad202792f7f182b12def8cb427dc46ec25 100644 --- a/charts/cluster-autoscaler/templates/serviceaccount.yaml +++ b/charts/cluster-autoscaler/templates/serviceaccount.yaml @@ -6,8 +6,12 @@ metadata: {{ include "cluster-autoscaler.labels" . | indent 4 }} name: {{ template "cluster-autoscaler.serviceAccountName" . }} namespace: {{ .Release.Namespace }} -{{- if .Values.rbac.serviceAccount.annotations }} - annotations: {{ toYaml .Values.rbac.serviceAccount.annotations | nindent 4 }} + +{{- with .Values.rbac.serviceAccount.annotations }} + annotations: + {{- range $k, $v := . }} + {{- printf "%s: %s" (tpl $k $) (tpl $v $) | nindent 4 }} + {{- end }} {{- end }} automountServiceAccountToken: {{ .Values.rbac.serviceAccount.automountServiceAccountToken }} {{- end }}