diff --git a/charts/etcd/templates/tests/test-etcd-health.yaml b/charts/etcd/templates/tests/test-etcd-health.yaml new file mode 100644 index 00000000..0c53ca2a --- /dev/null +++ b/charts/etcd/templates/tests/test-etcd-health.yaml @@ -0,0 +1,98 @@ +{{/* +# 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 }} +--- +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-etcd-test" + annotations: + "helm.sh/hook": "test-success" +spec: + restartPolicy: Never + containers: + - name: "{{ .Release.Name }}-etcd-test" + env: + - name: ETCD_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - 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 + - name: CLIENT_ENDPOINT + value: https://$(POD_IP):{{ .Values.network.service_client.target_port }} + - name: PEER_ENDPOINT + value: https://$(POD_IP):{{ .Values.network.service_peer.target_port }} + image: {{ .Values.images.tags.etcdctl }} + imagePullPolicy: {{ .Values.images.pull_policy }} +{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} + command: + - /bin/sh + - -c + - | + HEALTH=$(etcdctl endpoint health) + CODE=$? + echo $HEALTH + exit $CODE + volumeMounts: + - name: {{ .Values.service.name }}-bin + mountPath: /tmp + - name: {{ .Values.service.name }}-certs + mountPath: /etc/etcd/tls/certs + - name: etcd-etc + mountPath: /etcd-etc + - name: {{ .Values.service.name }}-keys + mountPath: /etc/etcd/tls/keys + - name: {{ .Values.service.name }}-etc + mountPath: /anchor-etcd + volumes: + - name: {{ .Values.service.name }}-bin + configMap: + name: {{ .Values.service.name }}-bin + defaultMode: 0555 + - 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 + - name: etcd-etc + hostPath: + path: {{ .Values.etcd.host_etc_path }} + - name: {{ .Values.service.name }}-etc + configMap: + name: {{ .Values.service.name }}-etc + defaultMode: 0444 +... +{{- end }} diff --git a/charts/etcd/values.yaml b/charts/etcd/values.yaml index b4920d02..15ef3bfa 100644 --- a/charts/etcd/values.yaml +++ b/charts/etcd/values.yaml @@ -116,6 +116,13 @@ pod: limits: memory: "1024Mi" cpu: "2000m" + test: + limits: + memory: "128Mi" + cpu: "100m" + requests: + memory: "128Mi" + cpu: "100m" manifests: configmap_bin: true @@ -124,3 +131,4 @@ manifests: daemonset_anchor: true secret: true service: true + test_etcd_health: true diff --git a/examples/basic/armada-resources.yaml b/examples/basic/armada-resources.yaml index 5243585b..7c2c3144 100644 --- a/examples/basic/armada-resources.yaml +++ b/examples/basic/armada-resources.yaml @@ -1015,6 +1015,7 @@ data: timeout: 600 wait: timeout: 600 + test: true upgrade: no_hooks: true values: diff --git a/examples/complete/armada-resources.yaml b/examples/complete/armada-resources.yaml index 99fede43..f25228b0 100644 --- a/examples/complete/armada-resources.yaml +++ b/examples/complete/armada-resources.yaml @@ -1055,6 +1055,7 @@ data: timeout: 600 wait: timeout: 600 + test: true upgrade: no_hooks: true values: