Added Helm Test for ETCD
- Uses etcdctl endpoint health for a helm test. Change-Id: I25162a228f1725d30a3346cd365dee7de491a26d
This commit is contained in:
parent
d1b6e1e676
commit
5afff6e407
|
@ -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 }}
|
|
@ -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
|
||||
|
|
|
@ -1015,6 +1015,7 @@ data:
|
|||
timeout: 600
|
||||
wait:
|
||||
timeout: 600
|
||||
test: true
|
||||
upgrade:
|
||||
no_hooks: true
|
||||
values:
|
||||
|
|
|
@ -1055,6 +1055,7 @@ data:
|
|||
timeout: 600
|
||||
wait:
|
||||
timeout: 600
|
||||
test: true
|
||||
upgrade:
|
||||
no_hooks: true
|
||||
values:
|
||||
|
|
Loading…
Reference in New Issue