Charts: Update helm test pod templates

This updates the helm test pod templates in the charts with helm
tests defined. This change includes the addition of:

- Generate test pod cluster roles and role bindings
- Generate service accounts for test pods
- Add node selectors to the test pods
- Add service accounts to the test pods
- Addition of entrypoint container to the test pods
- Indentation fix for rabbitmq test pod template

Change-Id: I9a0dd8a1a87bfe5eaf1362e92b37bc004f9c2cdb
This commit is contained in:
Steve Wilkerson 2018-10-09 09:49:18 -05:00
parent b7a459ae2a
commit bfa237d347
9 changed files with 53 additions and 1 deletions

View File

@ -17,6 +17,9 @@ limitations under the License.
{{- if .Values.manifests.helm_tests }} {{- if .Values.manifests.helm_tests }}
{{- $envAll := . }} {{- $envAll := . }}
{{- $esUserSecret := .Values.secrets.elasticsearch.user }} {{- $esUserSecret := .Values.secrets.elasticsearch.user }}
{{- $serviceAccountName := print .Release.Name "-test" }}
{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
@ -28,7 +31,12 @@ metadata:
"helm.sh/hook": test-success "helm.sh/hook": test-success
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec: spec:
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
restartPolicy: Never restartPolicy: Never
initContainers:
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
containers: containers:
- name: {{.Release.Name}}-helm-tests - name: {{.Release.Name}}-helm-tests
{{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }} {{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }}

View File

@ -44,6 +44,9 @@ labels:
job: job:
node_selector_key: openstack-control-plane node_selector_key: openstack-control-plane
node_selector_value: enabled node_selector_value: enabled
test:
node_selector_key: openstack-control-plane
node_selector_value: enabled
dependencies: dependencies:
dynamic: dynamic:
@ -89,6 +92,10 @@ dependencies:
s3_bucket: s3_bucket:
jobs: jobs:
- elasticsearch-s3-user - elasticsearch-s3-user
tests:
services:
- endpoint: internal
service: elasticsearch
pod: pod:
affinity: affinity:

View File

@ -17,6 +17,9 @@ limitations under the License.
{{- if .Values.manifests.helm_tests }} {{- if .Values.manifests.helm_tests }}
{{- $envAll := . }} {{- $envAll := . }}
{{- $esUserSecret := .Values.secrets.elasticsearch.user }} {{- $esUserSecret := .Values.secrets.elasticsearch.user }}
{{- $serviceAccountName := print .Release.Name "-test" }}
{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
@ -28,7 +31,12 @@ metadata:
"helm.sh/hook": test-success "helm.sh/hook": test-success
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec: spec:
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
restartPolicy: Never restartPolicy: Never
initContainers:
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
containers: containers:
- name: {{.Release.Name}}-helm-tests - name: {{.Release.Name}}-helm-tests
{{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }} {{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }}

View File

@ -33,6 +33,9 @@ labels:
job: job:
node_selector_key: openstack-control-plane node_selector_key: openstack-control-plane
node_selector_value: enabled node_selector_value: enabled
test:
node_selector_key: openstack-control-plane
node_selector_value: enabled
images: images:
tags: tags:

View File

@ -17,6 +17,9 @@ limitations under the License.
{{- if .Values.manifests.helm_tests }} {{- if .Values.manifests.helm_tests }}
{{- $dashboardCount := len .Values.conf.dashboards }} {{- $dashboardCount := len .Values.conf.dashboards }}
{{- $envAll := . }} {{- $envAll := . }}
{{- $serviceAccountName := print .Release.Name "-test" }}
{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
@ -28,7 +31,12 @@ metadata:
"helm.sh/hook": test-success "helm.sh/hook": test-success
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec: spec:
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
restartPolicy: Never restartPolicy: Never
initContainers:
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
containers: containers:
- name: {{.Release.Name}}-helm-tests - name: {{.Release.Name}}-helm-tests
{{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }} {{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }}

View File

@ -38,6 +38,9 @@ labels:
job: job:
node_selector_key: openstack-control-plane node_selector_key: openstack-control-plane
node_selector_value: enabled node_selector_value: enabled
test:
node_selector_key: openstack-control-plane
node_selector_value: enabled
pod: pod:
affinity: affinity:

View File

@ -17,6 +17,9 @@ limitations under the License.
{{- if .Values.manifests.helm_tests }} {{- if .Values.manifests.helm_tests }}
{{- $envAll := . }} {{- $envAll := . }}
{{- $promUserSecret := .Values.secrets.prometheus.admin }} {{- $promUserSecret := .Values.secrets.prometheus.admin }}
{{- $serviceAccountName := print .Release.Name "-test" }}
{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
@ -28,7 +31,12 @@ metadata:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
"helm.sh/hook": test-success "helm.sh/hook": test-success
spec: spec:
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
restartPolicy: Never restartPolicy: Never
initContainers:
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
containers: containers:
- name: {{.Release.Name}}-helm-tests - name: {{.Release.Name}}-helm-tests
{{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }} {{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }}

View File

@ -38,6 +38,9 @@ labels:
job: job:
node_selector_key: openstack-control-plane node_selector_key: openstack-control-plane
node_selector_value: enabled node_selector_value: enabled
test:
node_selector_key: openstack-control-plane
node_selector_value: enabled
pod: pod:
affinity: affinity:
@ -181,6 +184,10 @@ dependencies:
service: local_image_registry service: local_image_registry
prometheus: prometheus:
services: null services: null
tests:
services:
- endpoint: internal
service: monitoring
monitoring: monitoring:
prometheus: prometheus:

View File

@ -35,7 +35,7 @@ spec:
{{ $envAll.Values.labels.test.node_selector_key }}: {{ $envAll.Values.labels.test.node_selector_value | quote }} {{ $envAll.Values.labels.test.node_selector_key }}: {{ $envAll.Values.labels.test.node_selector_value | quote }}
restartPolicy: Never restartPolicy: Never
initContainers: initContainers:
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
containers: containers:
- name: {{.Release.Name}}-rabbitmq-test - name: {{.Release.Name}}-rabbitmq-test
{{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }} {{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }}