mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Consul - Add consul tests and upgrade consul to 0.8.x (#1126)
* Bump consul version to 0.8.3 Add app version tag Update chart maintainers to github username Add consul helm tests Update documentation Remove existing test.sh * Update helm test command in notes
This commit is contained in:
committed by
Adnan Abdulhussein
parent
be627ecba4
commit
ec52ae4692
@@ -1,7 +1,7 @@
|
||||
name: consul
|
||||
home: https://github.com/hashicorp/consul
|
||||
version: 0.2.5
|
||||
appVersion: 0.7.5
|
||||
version: 0.3.0
|
||||
appVersion: 0.8.3
|
||||
description: Highly available and distributed service discovery and key-value store designed with support for the modern data center to make distributed systems and configuration easy.
|
||||
icon: https://raw.githubusercontent.com/hashicorp/consul/bce3809dfca37b883828c3715b84143dd71c0f85/website/source/assets/images/favicons/android-chrome-512x512.png
|
||||
sources:
|
||||
|
||||
+11
-1
@@ -49,6 +49,8 @@ The following tables lists the configurable parameters of the consul chart and t
|
||||
| `ui.enabled` | Enable Consul Web UI | `false` |
|
||||
| `uiService.enabled` | Create dedicated Consul Web UI svc | `false` |
|
||||
| `uiService.type` | Dedicate Consul Web UI svc type | `NodePort` |
|
||||
| `test.image` | Test container image requires kubectl + bash (used for helm test) | `lachlanevenson/k8s-kubectl` |
|
||||
| `test.imageTag` | Test container image tag (used for helm test) | `v1.4.8-bash` |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||
|
||||
@@ -72,7 +74,15 @@ $ kubectl delete pvc -l component=${RELEASE-NAME}-consul
|
||||
|
||||
## Testing
|
||||
|
||||
Execute test.sh. It will confirm that there are at least 3 consul servers present.
|
||||
Helm tests are included and they confirm the first three cluster members have quorum.
|
||||
|
||||
```bash
|
||||
helm test <RELEASE_NAME>
|
||||
RUNNING: inky-marsupial-ui-test-nn6lv
|
||||
PASSED: inky-marsupial-ui-test-nn6lv
|
||||
```
|
||||
|
||||
It will confirm that there are at least 3 consul servers present.
|
||||
|
||||
## Cluster Health
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
1. Watch all cluster members come up.
|
||||
$ kubectl get pods --namespace={{ .Release.Namespace }} -w
|
||||
2. Confirm consul cluster is healthy
|
||||
$ kubectl exec {{ .Release.Name }}-consul-0 consul members --namespace={{ .Release.Namespace }} | grep server
|
||||
2. Test cluster health using Helm test.
|
||||
$ helm test {{ .Release.Name }}
|
||||
3. (Optional) Manually confirm consul cluster is healthy.
|
||||
$ kubectl exec {{ .Release.Name }}-consul-0 consul members --namespace={{ .Release.Namespace }} | grep server
|
||||
@@ -0,0 +1,38 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{.Release.Name}}-ui-test-{{ randAlphaNum 5 | lower }}"
|
||||
annotations:
|
||||
"helm.sh/hook": test-success
|
||||
"pod.beta.kubernetes.io/init-containers": '[
|
||||
{
|
||||
"name": "test-framework",
|
||||
"image": "dduportal/bats:0.4.0",
|
||||
"command": ["bash", "-c", "
|
||||
set -ex\n
|
||||
# copy bats to tools dir\n
|
||||
cp -R /usr/local/libexec/ /tools/bats/\n
|
||||
"],
|
||||
"volumeMounts": [
|
||||
{"name": "tools", "mountPath": "/tools"}
|
||||
]
|
||||
}
|
||||
]'
|
||||
spec:
|
||||
containers:
|
||||
- name: {{.Release.Name}}-ui-test
|
||||
image: {{.Values.test.image}}:{{.Values.test.imageTag}}
|
||||
command: ["/tools/bats/bats", "-t", "/tests/run.sh"]
|
||||
volumeMounts:
|
||||
- mountPath: /tests
|
||||
name: tests
|
||||
readOnly: true
|
||||
- mountPath: /tools
|
||||
name: tools
|
||||
volumes:
|
||||
- name: tests
|
||||
configMap:
|
||||
name: {{ template "fullname" . }}-tests
|
||||
- name: tools
|
||||
emptyDir: {}
|
||||
restartPolicy: Never
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}-tests
|
||||
data:
|
||||
run.sh: |-
|
||||
@test "Testing Consul cluster has quorum" {
|
||||
for i in {0..2}; do
|
||||
if [ `kubectl exec {{.Release.Name}}-consul-$i consul members --namespace={{.Release.Namespace}} | grep server | wc -l` -ge "3" ]; then
|
||||
echo "{{.Release.Name}}-consul-$i OK. consul members returning at least 3 records."
|
||||
else
|
||||
echo "{{.Release.Name}}-consul-$i ERROR. consul members returning less than 3 records."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright 2016 The Kubernetes Authors 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.
|
||||
|
||||
RELEASE=$1
|
||||
NS=$2
|
||||
|
||||
if [ -z $RELEASE ]; then
|
||||
echo "Please specify Helm release name. eg. test.sh winsome-shark consul"
|
||||
exit 1
|
||||
elif [ -z $NS ]; then
|
||||
echo "Please specify a Kubernetes namespace. eg. test.sh winsome-shark consul"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i in {0..2}; do
|
||||
if [ `kubectl exec $RELEASE-consul-$i consul members --namespace=$NS | grep server | wc -l` -ge "3" ]; then
|
||||
echo "$RELEASE-consul-$i OK. consul members returning at least 3 records."
|
||||
else
|
||||
echo "$RELEASE-consul-$i ERROR. consul members returning less than 3 records."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@@ -16,7 +16,7 @@ ConsulDnsPort: 8600
|
||||
Component: "consul"
|
||||
Replicas: 3
|
||||
Image: "consul"
|
||||
ImageTag: "0.7.5"
|
||||
ImageTag: "0.8.3"
|
||||
ImagePullPolicy: "Always"
|
||||
Cpu: "100m"
|
||||
Memory: "256Mi"
|
||||
@@ -44,3 +44,8 @@ ui:
|
||||
uiService:
|
||||
enabled: true
|
||||
type: "NodePort"
|
||||
|
||||
## test container details
|
||||
test:
|
||||
image: lachlanevenson/k8s-kubectl
|
||||
imageTag: v1.4.8-bash
|
||||
|
||||
Reference in New Issue
Block a user