-
Notifications
You must be signed in to change notification settings - Fork 23
/
2_helm_install_or_upgrade_conjur.sh
executable file
·60 lines (54 loc) · 2.07 KB
/
2_helm_install_or_upgrade_conjur.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
. utils.sh
min_helm_version="3.1"
# Confirm that 'helm' binary is installed.
if ! command -v helm &> /dev/null; then
echo "helm binary not found. See https://helm.sh/docs/intro/install/"
echo "for installation instructions."
exit 1
fi
# Check version of 'helm' binary.
helm_version="$(helm version --template {{.Version}} | sed 's/^v//')"
if ! meets_min_version $helm_version $min_helm_version; then
echo "helm version $helm_version is invalid. Version must be $min_helm_version or newer"
exit 1
fi
# Create the namespace for the Conjur cluster if necessary
if has_namespace "$CONJUR_NAMESPACE"; then
echo "Namespace '$CONJUR_NAMESPACE' exists, not going to create it."
else
kubectl create ns "$CONJUR_NAMESPACE"
fi
# Check if the Conjur cluster release has already been installed. If so, run
# Helm upgrade. Otherwise, do a Helm install of the Conjur cluster.
if [ "$(helm list -q -n $CONJUR_NAMESPACE | grep "^$HELM_RELEASE$")" = "$HELM_RELEASE" ]; then
echo "Helm upgrading existing Conjur cluster. Waiting for upgrade to complete."
helm upgrade \
-n "$CONJUR_NAMESPACE" \
--set account.name="$CONJUR_ACCOUNT" \
--set account.create="true" \
--set authenticators="authn\,authn-k8s/$AUTHENTICATOR_ID" \
--set logLevel="$CONJUR_LOG_LEVEL" \
--set service.external.enabled="$CONJUR_LOADBALANCER_SVCS" \
--reuse-values \
--wait \
--timeout 300s \
"$HELM_RELEASE" \
"../../conjur-oss"
else
# Helm install a Conjur cluster and create a Conjur account
echo "Helm installing a Conjur cluster. Waiting for install to complete."
data_key="$(docker run --rm cyberark/conjur data-key generate)"
helm install \
-n "$CONJUR_NAMESPACE" \
--set dataKey="$data_key" \
--set account.name="$CONJUR_ACCOUNT" \
--set account.create="true" \
--set authenticators="authn\,authn-k8s/$AUTHENTICATOR_ID" \
--set logLevel="$CONJUR_LOG_LEVEL" \
--set service.external.enabled="$CONJUR_LOADBALANCER_SVCS" \
--wait \
--timeout 300s \
"$HELM_RELEASE" \
"../../conjur-oss"
fi