promenade/charts/etcd/templates/tests/test-etcd-health.yaml

93 lines
3.1 KiB
YAML

{{/*
# Copyright (c) 2018 AT&T Intellectual Property. All 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.
*/}}
{{/*
Test etcdctl endpoint health */}}
{{- if .Values.manifests.test_etcd_health }}
{{- $envAll := . }}
{{- $applicationName := .Release.Name }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ .Release.Name }}-etcd-test"
annotations:
"helm.sh/hook": "test-success"
scheduler.alpha.kubernetes.io/critical-pod: ''
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels:
{{ tuple $envAll $applicationName "etcd-test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
nodeSelector:
{{ .Values.labels.anchor.node_selector_key }}: {{ .Values.labels.anchor.node_selector_value }}
restartPolicy: Never
hostNetwork: true
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
- key: node.kubernetes.io/memory-pressure
effect: NoSchedule
operator: Exists
- key: node.kubernetes.io/disk-pressure
effect: NoSchedule
operator: Exists
- key: node.kubernetes.io/out-of-disk
effect: NoSchedule
operator: Exists
- key: node.kubernetes.io/unschedulable
effect: NoSchedule
operator: Exists
- key: node.kubernetes.io/network-unavailable
effect: NoSchedule
operator: Exists
containers:
- name: "{{ .Release.Name }}-etcd-test"
env:
- name: ETCDCTL_API
value: '3'
- name: ETCDCTL_DIAL_TIMEOUT
value: 3s
- name: ETCDCTL_ENDPOINTS
value: https://{{ .Values.anchor.etcdctl_endpoint }}:{{ .Values.network.service_client.port }}
- name: ETCDCTL_CACERT
value: /etc/etcd/tls/certs/client-ca.pem
- name: ETCDCTL_CERT
value: /etc/etcd/tls/certs/anchor-etcd-client.pem
- name: ETCDCTL_KEY
value: /etc/etcd/tls/keys/anchor-etcd-client-key.pem
image: {{ .Values.images.tags.etcdctl }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
command:
- etcdctl
- endpoint
- health
volumeMounts:
- name: {{ .Values.service.name }}-certs
mountPath: /etc/etcd/tls/certs
- name: {{ .Values.service.name }}-keys
mountPath: /etc/etcd/tls/keys
volumes:
- name: {{ .Values.service.name }}-certs
configMap:
name: {{ .Values.service.name }}-certs
defaultMode: 0444
- name: {{ .Values.service.name }}-keys
secret:
secretName: {{ .Values.service.name }}-keys
defaultMode: 0444
...
{{- end }}