Add Helm test for HAProxy

- Added a helm test to test HAProxy's health via kubernetes healthz endpoint.

Change-Id: I0ffba39d4e4245fad69c27f0fcafdcb58fdc9067
This commit is contained in:
Aaron Sheffield 2018-04-11 13:33:58 -05:00
parent c1e7a74c1e
commit 2885218d35
11 changed files with 70 additions and 22 deletions

View File

@ -38,7 +38,7 @@ spec:
- {{ . }}
{{- end }}
- --advertise-address=$(POD_IP)
- --anonymous-auth=false
- --anonymous-auth=true
- --bind-address=0.0.0.0
- --secure-port={{ .Values.network.kubernetes_apiserver.port }}
- --insecure-port=0

View File

@ -0,0 +1,42 @@
{{/*
# 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 that HAProxy is running and the config is valid */}}
{{- if .Values.manifests.test_haproxy }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ .Release.Name }}-haproxy-test"
annotations:
"helm.sh/hook": "test-success"
spec:
restartPolicy: Never
containers:
- name: "{{ .Release.Name }}-haproxy-test"
env:
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: 'HAPROXY_URL'
value: https://$(HOST_IP):{{ .Values.endpoints.health.port }}/{{ .Values.endpoints.health.path }}
image: {{ .Values.images.tags.test }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
command: ["/bin/sh", "-c", "wget --no-check-certificate --spider ${HAPROXY_URL}; exit $?"]
...
{{- end }}

View File

@ -26,11 +26,9 @@ conf:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:6553
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch
kube-system:
@ -39,11 +37,9 @@ conf:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:2378
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch
@ -65,8 +61,17 @@ images:
tags:
anchor: gcr.io/google_containers/hyperkube-amd64:v1.8.6
haproxy: haproxy:1.8.3
test: busybox:1.28.3
pull_policy: "IfNotPresent"
manifests:
test_haproxy: true
endpoints:
health:
port: 6553
path: "healthz"
pod:
lifecycle:
upgrades:
@ -95,5 +100,12 @@ pod:
limits:
memory: "256Mi"
cpu: "2000m"
test:
limits:
memory: "128Mi"
cpu: "100m"
requests:
memory: "128Mi"
cpu: "100m"
release_group: null

View File

@ -11,7 +11,8 @@
# 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. */}}
# limitations under the License.
*/}}
{{/*
Test that the API is up and the health endpoint returns a 2XX code */}}
{{- if .Values.manifests.test_promenade_api }}

View File

@ -572,6 +572,7 @@ data:
timeout: 600
wait:
timeout: 600
test: true
upgrade:
no_hooks: true
values:
@ -585,11 +586,9 @@ data:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:6553
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch
kube-system:
@ -598,11 +597,9 @@ data:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:2378
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch
@ -610,6 +607,7 @@ data:
tags:
anchor: gcr.io/google_containers/hyperkube-amd64:v1.8.6
haproxy: haproxy:1.8.3
test: busybox:1.28.3
source:
type: local
@ -1139,6 +1137,7 @@ data:
timeout: 600
wait:
timeout: 600
test: true
values:
pod:
env:

View File

@ -612,6 +612,7 @@ data:
timeout: 600
wait:
timeout: 600
test: true
upgrade:
no_hooks: true
values:
@ -625,11 +626,9 @@ data:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:6553
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch
kube-system:
@ -638,11 +637,9 @@ data:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:2378
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch
@ -650,6 +647,7 @@ data:
tags:
anchor: gcr.io/google_containers/hyperkube-amd64:v1.8.6
haproxy: haproxy:1.8.3
test: busybox:1.28.3
source:
type: local
@ -1816,6 +1814,7 @@ data:
timeout: 600
wait:
timeout: 600
test: true
values:
pod:
env:

View File

@ -234,7 +234,7 @@ spec:
kubernetes.io/hostname: ${NODE}
containers:
- name: noisy
image: busybox:1.27.1
image: busybox:1.28.3
imagePullPolicy: IfNotPresent
command:
- /bin/echo

View File

@ -17,7 +17,6 @@ global
defaults
mode tcp
option tcpka
timeout connect 5000ms
timeout client 24h
timeout server 24h

View File

@ -123,7 +123,7 @@ spec:
- --advertise-address={{ config['Genesis:ip'] }}
- --authorization-mode=Node,RBAC
- --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,ResourceQuota,DefaultTolerationSeconds
- --anonymous-auth=false
- --anonymous-auth=true
- --client-ca-file=/etc/kubernetes/apiserver/pki/cluster-ca.pem
- --kubelet-certificate-authority=/etc/kubernetes/apiserver/pki/cluster-ca.pem
- --kubelet-client-certificate=/etc/kubernetes/apiserver/pki/apiserver.pem

View File

@ -19,7 +19,7 @@ spec:
- --advertise-address={{ config['Genesis:ip'] }}
- --authorization-mode=Node,RBAC
- --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,ResourceQuota,DefaultTolerationSeconds
- --anonymous-auth=false
- --anonymous-auth=true
- --client-ca-file=/etc/kubernetes/apiserver/pki/cluster-ca.pem
- --kubelet-certificate-authority=/etc/kubernetes/apiserver/pki/cluster-ca.pem
- --kubelet-client-certificate=/etc/kubernetes/apiserver/pki/apiserver.pem

View File

@ -564,11 +564,9 @@ data:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:6553
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch
kube-system:
@ -577,11 +575,9 @@ data:
conf_parts:
frontend:
- mode tcp
- option tcpka
- bind *:2378
backend:
- mode tcp
- option tcpka
- option tcp-check
- option redispatch