promenade/charts/apiserver/templates/configmap-etc.yaml
Phil Sphicas 300a399aff 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
2021-04-28 05:18:16 +00:00

42 lines
1.3 KiB
YAML

{{/*
Copyright 2017 AT&T Intellectual Property. All other rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.configmap_etc }}
{{- $envAll := . }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.service.name }}-etc
data:
kubernetes-apiserver.yaml: |
{{ tuple "etc/_kubernetes-apiserver.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
kubeconfig.yaml: |
{{ 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 }}
{{- else }}
{{ toYaml $val.content | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}