Charts: Tidy up openstack-helm-infra charts

This moves the charts in openstack-helm-infra closer towards a
standard structure. It addresses multiple deviations, including:
missing resources for init containers, incorrect indents for
disabled resources in some charts, incorrect indents for volumes
and volumemounts added via values, missing resources for some
helm test templates, missing helm-toolkit image functions, and
moving the resource template declarations to be under the image
template declarations

Change-Id: I4834a5d476ef7fc69c5583caacc0229050f20a76
This commit is contained in:
Steve Wilkerson 2018-05-21 10:11:44 -07:00
parent d57d3344a5
commit de9c46bcfa
22 changed files with 98 additions and 97 deletions

View File

@ -42,9 +42,9 @@ spec:
containers:
- name: curator
{{ tuple $envAll "curator" | include "helm-toolkit.snippets.image" | indent 14 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.curator | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
command:
- /tmp/curator.sh
{{ tuple $envAll $envAll.Values.pod.resources.jobs.curator | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
env:
- name: ELASTICSEARCH_HOST
valueFrom:

View File

@ -83,10 +83,11 @@ spec:
initContainers:
{{ tuple $envAll "elasticsearch_client" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: memory-map-increase
{{ tuple $envAll "memory_init" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
privileged: true
runAsUser: 0
{{ tuple $envAll "memory_init" | include "helm-toolkit.snippets.image" | indent 10 }}
command:
- sysctl
- -w
@ -94,9 +95,9 @@ spec:
{{ if .Values.storage.filesystem_repository.enabled }}
- name: elasticsearch-repository-perms
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
runAsUser: 0
{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
command:
- chown
- -R
@ -157,14 +158,14 @@ spec:
subPath: elasticsearch-host.conf
readOnly: true
- name: elasticsearch-client
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
privileged: true
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
command:
- /tmp/elasticsearch.sh
- start

View File

@ -81,10 +81,11 @@ spec:
initContainers:
{{ tuple $envAll "elasticsearch_master" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: memory-map-increase
{{ tuple $envAll "memory_init" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.master | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
privileged: true
runAsUser: 0
{{ tuple $envAll "memory_init" | include "helm-toolkit.snippets.image" | indent 10 }}
command:
- sysctl
- -w
@ -92,9 +93,9 @@ spec:
{{ if .Values.storage.filesystem_repository.enabled }}
- name: elasticsearch-repository-perms
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.master | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
runAsUser: 0
{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
command:
- chown
- -R

View File

@ -43,6 +43,7 @@ spec:
containers:
- name: elasticsearch-exporter
{{ tuple $envAll "prometheus_elasticsearch_exporter" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/elasticsearch-exporter.sh
- start
@ -52,7 +53,6 @@ spec:
command:
- /tmp/elasticsearch-exporter.sh
- stop
{{ tuple $envAll $envAll.Values.pod.resources.exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
env:
- name: ELASTICSEARCH_URI
valueFrom:

View File

@ -78,10 +78,11 @@ spec:
initContainers:
{{ tuple $envAll "elasticsearch_data" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: memory-map-increase
{{ tuple $envAll "memory_init" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.data | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
privileged: true
runAsUser: 0
{{ tuple $envAll "memory_init" | include "helm-toolkit.snippets.image" | indent 10 }}
command:
- sysctl
- -w
@ -89,9 +90,9 @@ spec:
{{ if .Values.storage.filesystem_repository.enabled }}
- name: elasticsearch-repository-perms
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.data | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
runAsUser: 0
{{ tuple $envAll $envAll.Values.pod.resources.client | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
command:
- chown
- -R
@ -103,14 +104,14 @@ spec:
{{ end }}
containers:
- name: elasticsearch-data
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.data | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
privileged: true
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.data | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
command:
- /tmp/elasticsearch.sh
- start

View File

@ -87,9 +87,9 @@ spec:
containers:
- name: kube-flannel
{{ tuple $envAll "flannel" | include "helm-toolkit.snippets.image" | indent 10 }}
command: [ "/opt/bin/flanneld", "--ip-masq", "--kube-subnet-mgr" ]
securityContext:
privileged: true
command: [ "/opt/bin/flanneld", "--ip-masq", "--kube-subnet-mgr" ]
env:
- name: POD_NAME
valueFrom:

View File

@ -95,8 +95,7 @@ spec:
{{ tuple $envAll "fluentbit" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: fluentbit
image: {{ .Values.images.tags.fluentbit }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll "fluentbit" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.fluentbit | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/fluent-bit.sh
@ -123,7 +122,7 @@ spec:
mountPath: /fluent-bit/etc/parsers.conf
subPath: parsers.conf
readOnly: true
{{ if $mounts_fluentbit.volumeMounts }}{{ toYaml $mounts_fluentbit.volumeMounts | indent 8 }}{{ end }}
{{ if $mounts_fluentbit.volumeMounts }}{{ toYaml $mounts_fluentbit.volumeMounts | indent 12 }}{{ end }}
volumes:
- name: varlog
hostPath:

View File

@ -97,8 +97,7 @@ spec:
{{ tuple $envAll "fluentd" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: fluentd
image: {{ .Values.images.tags.fluentd }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll "fluentd" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.fluentd | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/fluentd.sh

View File

@ -41,8 +41,7 @@ spec:
{{ tuple $envAll "elasticsearch_template" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: elasticsearch-template
image: {{ .Values.images.tags.elasticsearch_template }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll "elasticsearch_template" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.elasticsearch_template | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
env:
- name: ELASTICSEARCH_HOST
@ -70,7 +69,7 @@ spec:
mountPath: /tmp/template.xml.raw
subPath: template.xml.raw
readOnly: true
{{ if $mounts_elasticsearch_template.volumeMounts }}{{ toYaml $mounts_elasticsearch_template.volumeMounts | indent 10 }}{{ end }}
{{ if $mounts_elasticsearch_template.volumeMounts }}{{ toYaml $mounts_elasticsearch_template.volumeMounts | indent 12 }}{{ end }}
volumes:
- name: fluent-logging-bin
configMap:
@ -80,5 +79,5 @@ spec:
configMap:
name: fluent-logging-etc
defaultMode: 0666
{{ if $mounts_elasticsearch_template.volumes }}{{ toYaml $mounts_elasticsearch_template.volumes | indent 6 }}{{ end }}
{{ if $mounts_elasticsearch_template.volumes }}{{ toYaml $mounts_elasticsearch_template.volumes | indent 8 }}{{ end }}
{{- end }}

View File

@ -44,8 +44,7 @@ spec:
{{ tuple $envAll "prometheus_fluentd_exporter" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: fluentd-exporter
image: {{ .Values.images.tags.prometheus_fluentd_exporter }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll "prometheus_fluentd_exporter" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.prometheus_fluentd_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/fluentd-exporter.sh

View File

@ -29,6 +29,7 @@ spec:
containers:
- name: {{.Release.Name}}-helm-tests
{{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
command:
- /tmp/helm-tests.sh
env:

View File

@ -72,34 +72,34 @@ spec:
- name: PROMETHEUS_URL
value: {{ tuple "monitoring" "internal" "api" $envAll | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }}
volumeMounts:
- name: pod-etc-grafana
mountPath: /etc/grafana
- name: pod-provisioning-grafana
mountPath: /var/lib/grafana/provisioning
- name: grafana-bin
mountPath: /tmp/grafana.sh
subPath: grafana.sh
readOnly: true
- name: grafana-etc
mountPath: /var/lib/grafana/provisioning/dashboards/dashboards.yaml
subPath: dashboards.yaml
- name: grafana-etc
mountPath: /var/lib/grafana/provisioning/datasources/datasources.yaml
subPath: datasources.yaml
- name: grafana-etc
mountPath: /etc/grafana/grafana.ini
subPath: grafana.ini
- name: grafana-etc
mountPath: /etc/grafana/ldap.toml
subPath: ldap.toml
- name: data
mountPath: /var/lib/grafana/data
{{- range $key, $value := .Values.conf.dashboards }}
- name: grafana-etc
mountPath: /var/lib/grafana/dashboards/{{$key}}.json
subPath: {{$key}}.json
{{- end }}
{{ if $mounts_grafana.volumeMounts }}{{ toYaml $mounts_grafana.volumeMounts | indent 10 }}{{ end }}
- name: pod-etc-grafana
mountPath: /etc/grafana
- name: pod-provisioning-grafana
mountPath: /var/lib/grafana/provisioning
- name: grafana-bin
mountPath: /tmp/grafana.sh
subPath: grafana.sh
readOnly: true
- name: grafana-etc
mountPath: /var/lib/grafana/provisioning/dashboards/dashboards.yaml
subPath: dashboards.yaml
- name: grafana-etc
mountPath: /var/lib/grafana/provisioning/datasources/datasources.yaml
subPath: datasources.yaml
- name: grafana-etc
mountPath: /etc/grafana/grafana.ini
subPath: grafana.ini
- name: grafana-etc
mountPath: /etc/grafana/ldap.toml
subPath: ldap.toml
- name: data
mountPath: /var/lib/grafana/data
{{- range $key, $value := .Values.conf.dashboards }}
- name: grafana-etc
mountPath: /var/lib/grafana/dashboards/{{$key}}.json
subPath: {{$key}}.json
{{- end }}
{{ if $mounts_grafana.volumeMounts }}{{ toYaml $mounts_grafana.volumeMounts | indent 12 }}{{ end }}
volumes:
- name: pod-etc-grafana
emptyDir: {}

View File

@ -54,13 +54,13 @@ spec:
command:
- /tmp/db-init.py
volumeMounts:
- name: grafana-bin
mountPath: /tmp/db-init.py
subPath: db-init.py
readOnly: true
- name: grafana-bin
mountPath: /tmp/db-init.py
subPath: db-init.py
readOnly: true
volumes:
- name: grafana-bin
configMap:
name: grafana-bin
defaultMode: 0555
- name: grafana-bin
configMap:
name: grafana-bin
defaultMode: 0555
{{- end }}

View File

@ -54,13 +54,13 @@ spec:
command:
- /tmp/db-init.py
volumeMounts:
- name: grafana-bin
mountPath: /tmp/db-init.py
subPath: db-init.py
readOnly: true
- name: grafana-bin
mountPath: /tmp/db-init.py
subPath: db-init.py
readOnly: true
volumes:
- name: grafana-bin
configMap:
name: grafana-bin
defaultMode: 0555
- name: grafana-bin
configMap:
name: grafana-bin
defaultMode: 0555
{{- end }}

View File

@ -49,13 +49,13 @@ spec:
command:
- /tmp/db-session-sync.py
volumeMounts:
- name: grafana-bin
mountPath: /tmp/db-session-sync.py
subPath: db-session-sync.py
readOnly: true
- name: grafana-bin
mountPath: /tmp/db-session-sync.py
subPath: db-session-sync.py
readOnly: true
volumes:
- name: grafana-bin
configMap:
name: grafana-bin
defaultMode: 0555
- name: grafana-bin
configMap:
name: grafana-bin
defaultMode: 0555
{{- end }}

View File

@ -31,6 +31,7 @@ spec:
containers:
- name: kubernetes-keystone-webhook
{{ tuple $envAll "kubernetes_keystone_webhook" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/start.sh
readinessProbe:
@ -41,7 +42,6 @@ spec:
ports:
- name: k8sksauth-pub
containerPort: {{ tuple "kubernetes_keystone_webhook" "internal" "api" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
volumeMounts:
- name: etc-kubernetes-keystone-webhook
mountPath: /etc/kubernetes-keystone-webhook

View File

@ -38,7 +38,8 @@ spec:
{{ tuple $envAll "tests" $mounts_kubernetes_keystone_webhook_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: {{ $envAll.Release.Name }}-kubernetes-keystone-webhook-test
image: {{ $envAll.Values.images.tags.scripted_test }}
{{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
env:
- name: WEBHOOK_URL
value: {{ tuple "kubernetes_keystone_webhook" "internal" "api" $envAll | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | quote }}

View File

@ -48,9 +48,9 @@ spec:
{{ tuple $envAll "alertmanager" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: alertmanager-perms
{{ tuple $envAll "alertmanager" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.alertmanager | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
runAsUser: 0
{{ tuple $envAll $envAll.Values.pod.resources.alertmanager | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- chown
- -R
@ -62,6 +62,7 @@ spec:
containers:
- name: alertmanager
{{ tuple $envAll "alertmanager" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.alertmanager | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/alertmanager.sh
- start
@ -71,7 +72,6 @@ spec:
command:
- /tmp/alertmanager.sh
- stop
{{ tuple $envAll $envAll.Values.pod.resources.alertmanager | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
env:
- name: DISCOVERY_SVC
value: {{ tuple "alerts" "discovery" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}

View File

@ -56,6 +56,7 @@ spec:
containers:
- name: node-exporter
{{ tuple $envAll "node_exporter" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.node_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
args:
- --collector.ntp
- --collector.ntp.server={{ .Values.conf.ntp_server_ip }}
@ -67,7 +68,6 @@ spec:
- name: metrics
containerPort: {{ tuple "node_metrics" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
hostPort: {{ tuple "node_metrics" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{ tuple $envAll $envAll.Values.pod.resources.node_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
volumeMounts:
- name: proc
mountPath: /host/proc

View File

@ -39,9 +39,9 @@ spec:
containers:
- name: prometheus-openstack-exporter-ks-user
{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/ks-user.sh
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
volumeMounts:
- name: ks-user-sh
mountPath: /tmp/ks-user.sh

View File

@ -89,9 +89,9 @@ spec:
{{ tuple $envAll "prometheus" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: prometheus-perms
{{ tuple $envAll "prometheus" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.prometheus | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
runAsUser: 0
{{ tuple $envAll $envAll.Values.pod.resources.prometheus | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- chown
- -R
@ -103,6 +103,7 @@ spec:
containers:
- name: prometheus
{{ tuple $envAll "prometheus" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.prometheus | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/prometheus.sh
- start
@ -112,7 +113,6 @@ spec:
command:
- /tmp/prometheus.sh
- stop
{{ tuple $envAll $envAll.Values.pod.resources.prometheus | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
ports:
- name: prom-metrics
containerPort: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}

View File

@ -41,20 +41,20 @@ spec:
initContainers:
{{ tuple $envAll "registry_proxy" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: registry-proxy
{{ tuple $envAll "registry_proxy" | include "helm-toolkit.snippets.image" | indent 8 }}
- name: registry-proxy
{{ tuple $envAll "registry_proxy" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.registry_proxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/registry-proxy.sh
volumeMounts:
- name: registry-bin
mountPath: /tmp/registry-proxy.sh
subPath: registry-proxy.sh
readOnly: true
- name: registry-etc
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
readOnly: true
command:
- /tmp/registry-proxy.sh
volumeMounts:
- name: registry-bin
mountPath: /tmp/registry-proxy.sh
subPath: registry-proxy.sh
readOnly: true
- name: registry-etc
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
readOnly: true
volumes:
- name: registry-bin
configMap: