forked from magneticio/vamp-cloud-installer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·42 lines (33 loc) · 1.35 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -eu
VAMP_INSTALLER_VERSION=3.0.35
VAMP_INSTALLER_IMAGE=${DEFAULT_VAMP_INSTALLER_IMAGE:=vampio/k8s-installer:$VAMP_INSTALLER_VERSION}
VAMP_INSTALLER_BOOTSTRAP_YAML=${DEFAULT_VAMP_BOOTSTRAP_YAML:=https://raw.githubusercontent.com/magneticio/vamp-cloud-installer/master/bootstrap-policy.yaml}
# A shell script can only have a single trap set for each signal, including the
# EXIT pseudosignal. All cleanup needs to be handled by this function.
cleanup() {
kubectl delete -f "$VAMP_INSTALLER_BOOTSTRAP_YAML" || true
kubectl delete pod vamp-cloud-installer || true
}
trap cleanup EXIT
echo "Vamp Cloud Installer: $VAMP_INSTALLER_VERSION"
# Apply policy required to be able to create the resources.
kubectl apply -f "$VAMP_INSTALLER_BOOTSTRAP_YAML"
# Run nats-setup container containing the latest set of manifests.
kubectl apply -f - << _EOF
apiVersion: v1
kind: Pod
metadata:
name: vamp-cloud-installer
spec:
containers:
- name: vamp-cloud-installer
image: $VAMP_INSTALLER_IMAGE
imagePullPolicy: Always
restartPolicy: Never
serviceAccount: vamp-cloud-installer
_EOF
# Wait for the setup container to start or bail.
kubectl wait --for=condition=Ready pod/vamp-cloud-installer --timeout=30s
# Pass the custom parameters to the nats-setup container image.
kubectl exec vamp-cloud-installer -- vamp-installer.sh -v "$VAMP_INSTALLER_VERSION" "$@"