99 lines
3.2 KiB
YAML
99 lines
3.2 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 }}
|
|
---
|
|
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 }}
|