Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring of cloudconfig using helm chart values #1085

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion charts/aws-cloud-controller-manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
{{- .Values.nameOverride }}
{{- end -}}


{{- define "aws-cloud-config.name" }}
{{- "aws-cloud-config" }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/aws-cloud-controller-manager/templates/cloudconfigmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
28 changes: 21 additions & 7 deletions charts/aws-cloud-controller-manager/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,42 @@ 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:
{{- toYaml .Values.resources | nindent 12 }}
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 }}
---
18 changes: 3 additions & 15 deletions charts/aws-cloud-controller-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -153,3 +138,6 @@ roleName: extension-apiserver-authentication-reader

extraVolumes: []
extraVolumeMounts: []

cloudConfig:
enabled: false