diff --git a/charts/aws-cloud-controller-manager/templates/_helpers.tpl b/charts/aws-cloud-controller-manager/templates/_helpers.tpl index ea7bad9c71..67e91166b5 100644 --- a/charts/aws-cloud-controller-manager/templates/_helpers.tpl +++ b/charts/aws-cloud-controller-manager/templates/_helpers.tpl @@ -2,4 +2,6 @@ {{- .Values.nameOverride }} {{- end -}} - +{{- define "aws-cloud-config.name" }} +{{- "aws-cloud-config" }} +{{- end }} diff --git a/charts/aws-cloud-controller-manager/templates/cloudconfigmap.yaml b/charts/aws-cloud-controller-manager/templates/cloudconfigmap.yaml new file mode 100644 index 0000000000..d1d56b6301 --- /dev/null +++ b/charts/aws-cloud-controller-manager/templates/cloudconfigmap.yaml @@ -0,0 +1,17 @@ +--- +{{- if .Values.cloudConfig.enabled }} +apiVersion: v1 +data: + cloudconfig.cfg: | + {{- range $key, $value := .Values.cloudConfig }} + {{- if not (eq $key "enabled") }} + [{{ camelcase $key }}] + {{- range $subKey, $subValue := $value }} + {{ $subKey }}={{ $subValue }} + {{- end }} + {{- end }} + {{- end }} +kind: ConfigMap +metadata: + name: {{- include "aws-cloud-config.name" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/aws-cloud-controller-manager/templates/daemonset.yaml b/charts/aws-cloud-controller-manager/templates/daemonset.yaml index 3a3c8e7ca0..9fb65efbe5 100644 --- a/charts/aws-cloud-controller-manager/templates/daemonset.yaml +++ b/charts/aws-cloud-controller-manager/templates/daemonset.yaml @@ -32,15 +32,15 @@ spec: hostNetwork: true {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + {{- $args := .Values.args }} + {{- if and (.Values.cloudConfig.enabled) (not (contains "--cloud-config" (cat $args))) }} + {{- $args = append $args "--cloud-config=/etc/cloudconfig.cfg" }} + {{- end }} args: - {{- range .Values.args }} + {{- range $args }} - {{ . }} {{- end }} resources: @@ -48,12 +48,26 @@ spec: env: {{- toYaml .Values.env | nindent 12 }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - {{- with .Values.extraVolumeMounts }} + {{- if or (.Values.cloudConfig.enabled) (.Values.extraVolumeMounts) }} volumeMounts: + {{- if .Values.cloudConfig.enabled }} + - name: {{ include "aws-cloud-config.name" . | nindent 16 }} + mountPath: /etc/cloudconfig.cfg + subPath: cloudconfig.cfg + {{- end }} + {{- with .Values.extraVolumeMounts}} {{- toYaml .| nindent 12 }} {{- end }} - {{- with .Values.extraVolumes }} + {{- end }} + {{- if or (.Values.cloudConfig.enabled) (.Values.extraVolumes) }} volumes: + {{- with .Values.extraVolumes}} {{- toYaml . | nindent 8 }} {{- end }} + {{- end }} + {{- if .Values.cloudConfig.enabled }} + - name: {{- include "aws-cloud-config.name" . | nindent 12 }} + configMap: + name: {{- include "aws-cloud-config.name" . | nindent 16 }} + {{- end }} --- diff --git a/charts/aws-cloud-controller-manager/values.yaml b/charts/aws-cloud-controller-manager/values.yaml index 8fc8f3b9b2..71a91fa189 100644 --- a/charts/aws-cloud-controller-manager/values.yaml +++ b/charts/aws-cloud-controller-manager/values.yaml @@ -8,9 +8,6 @@ image: repository: registry.k8s.io/provider-aws/cloud-controller-manager tag: v1.27.1 -# Specify image pull secrets -imagePullSecrets: [] - # nameOverride overrides `cloud-controller-manager.fullname` nameOverride: "aws-cloud-controller-manager" @@ -98,18 +95,6 @@ clusterRoleRules: - serviceaccounts/token verbs: - create -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create # resources -- Pod resource requests and limits. resources: @@ -153,3 +138,6 @@ roleName: extension-apiserver-authentication-reader extraVolumes: [] extraVolumeMounts: [] + +cloudConfig: + enabled: false \ No newline at end of file