2017-11-03 15:59:08 +00:00
|
|
|
{{/*
|
|
|
|
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.helm_tests }}
|
|
|
|
{{- $envAll := . }}
|
2018-10-09 14:49:18 +00:00
|
|
|
|
|
|
|
{{- $serviceAccountName := print .Release.Name "-test" }}
|
|
|
|
{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
2017-11-03 15:59:08 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
name: "{{.Release.Name}}-test"
|
2018-07-09 22:02:03 +00:00
|
|
|
labels:
|
|
|
|
{{ tuple $envAll "prometheus" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
annotations:
|
2018-09-12 14:07:19 +00:00
|
|
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
2020-05-13 19:52:33 +00:00
|
|
|
{{ dict "envAll" $envAll "podName" "prometheus-test" "containerNames" (list "init" "prometheus-helm-tests") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
"helm.sh/hook": test-success
|
|
|
|
spec:
|
2020-07-07 21:12:32 +00:00
|
|
|
{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
|
2018-10-09 14:49:18 +00:00
|
|
|
serviceAccountName: {{ $serviceAccountName }}
|
|
|
|
nodeSelector:
|
|
|
|
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
|
2017-11-03 15:59:08 +00:00
|
|
|
restartPolicy: Never
|
2018-10-09 14:49:18 +00:00
|
|
|
initContainers:
|
|
|
|
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
containers:
|
2020-05-13 19:52:33 +00:00
|
|
|
- name: prometheus-helm-tests
|
2017-11-03 15:59:08 +00:00
|
|
|
{{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }}
|
2017-12-02 00:30:47 +00:00
|
|
|
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
|
2020-07-07 21:12:32 +00:00
|
|
|
{{ dict "envAll" $envAll "application" "test" "container" "prometheus_helm_tests" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
command:
|
2017-12-02 00:30:47 +00:00
|
|
|
- /tmp/helm-tests.sh
|
2017-11-03 15:59:08 +00:00
|
|
|
env:
|
2018-02-12 17:19:10 +00:00
|
|
|
- name: PROMETHEUS_ADMIN_USERNAME
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2019-11-19 18:02:31 +00:00
|
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "admin-user" | quote }}
|
2018-02-12 17:19:10 +00:00
|
|
|
key: PROMETHEUS_ADMIN_USERNAME
|
|
|
|
- name: PROMETHEUS_ADMIN_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2019-11-19 18:02:31 +00:00
|
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "admin-user" | quote }}
|
2018-02-12 17:19:10 +00:00
|
|
|
key: PROMETHEUS_ADMIN_PASSWORD
|
2021-03-12 21:58:12 +00:00
|
|
|
|
|
|
|
{{- if .Values.manifests.certificates }}
|
|
|
|
- name: CACERT_OPTION
|
|
|
|
value: "--cacert /etc/prometheus/certs/ca.crt"
|
|
|
|
{{- end }}
|
2017-12-02 00:30:47 +00:00
|
|
|
- name: PROMETHEUS_ENDPOINT
|
2021-03-12 21:58:12 +00:00
|
|
|
value: {{ printf "%s://%s" (tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup") (tuple "monitoring" "internal" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup") }}
|
2017-11-03 15:59:08 +00:00
|
|
|
volumeMounts:
|
2019-04-20 12:58:42 +00:00
|
|
|
- name: pod-tmp
|
|
|
|
mountPath: /tmp
|
2017-12-02 00:30:47 +00:00
|
|
|
- name: prometheus-bin
|
|
|
|
mountPath: /tmp/helm-tests.sh
|
|
|
|
subPath: helm-tests.sh
|
|
|
|
readOnly: true
|
2021-03-12 21:58:12 +00:00
|
|
|
{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.monitoring.prometheus.internal "path" "/etc/prometheus/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
volumes:
|
2019-04-20 12:58:42 +00:00
|
|
|
- name: pod-tmp
|
|
|
|
emptyDir: {}
|
2017-12-02 00:30:47 +00:00
|
|
|
- name: prometheus-bin
|
|
|
|
configMap:
|
2019-11-19 18:02:31 +00:00
|
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "prometheus-bin" | quote }}
|
2020-07-06 19:50:07 +00:00
|
|
|
defaultMode: 0555
|
2021-03-12 21:58:12 +00:00
|
|
|
{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.monitoring.prometheus.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
{{- end }}
|