apiserver(-webhook): Allow fileless kube-apiserver command_options

The kube-apiserver command line is constructed from a command_prefix
array, and in the case of the apiserver chart, an arguments array, both
defined in values.yaml. If an option needs to be added to the command
line, the entire array needs to be redefined in a values.yaml override,
which is sometimes inconvenient.

There is an existing interface in the apiserver and apiserver-webhook
charts to allow kube-apiserver arguments to be appended, but only when
they are associated with a config file that is dynamically included in a
configmap. The typical usage is similar to:

    conf:
      ignored_key_name:
        file: filename.yaml
        content: ...
        command_options:
          - --some-file=/etc/kubernetes/apiserver/filename.yaml

This change removes the requirement to include a file in the configmap,
allowing arbitrary command options to be appended. For example, in the
apiserver chart, this is now possible:

    conf:
      ignored_key_name:
        command_options:
          - --service-account-issuer=apiserver

Change-Id: I86283ecedd701c0f061da7b706d6ed54498f27a3
This commit is contained in:
Phil Sphicas 2021-04-26 19:12:42 +00:00
parent fd9f3d6cec
commit 300a399aff
2 changed files with 4 additions and 0 deletions

View File

@ -22,6 +22,7 @@ metadata:
name: {{ .Release.Name }}-dynamic-config
data:
{{- range $key, $val := .Values.conf.apiserver }}
{{- if and (hasKey $val "file") (hasKey $val "content") }}
{{ $val.file }}: |
{{- if kindIs "string" $val.content }}
{{ indent 4 $val.content }}
@ -30,3 +31,4 @@ data:
{{- end }}
{{- end -}}
{{- end }}
{{- end }}

View File

@ -29,6 +29,7 @@ data:
{{ tuple "etc/_kubeconfig.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{/* Dynamically added config files */}}
{{- range $key, $val := .Values.conf }}
{{- if and (hasKey $val "file") (hasKey $val "content") }}
{{ $val.file }}: |
{{- if kindIs "string" $val.content }}
{{ indent 4 $val.content }}
@ -37,3 +38,4 @@ data:
{{- end }}
{{- end }}
{{- end }}
{{- end }}