forked from cyberark/kubernetes-conjur-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4_create_load_balancer.sh
executable file
·44 lines (33 loc) · 1.11 KB
/
4_create_load_balancer.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
#!/bin/bash
set -euo pipefail
. utils.sh
announce "Creating load balancer for master and standbys."
set_namespace $CONJUR_NAMESPACE_NAME
docker_image=$(platform_image haproxy)
if is_minienv; then
IMAGE_PULL_POLICY='Never'
else
IMAGE_PULL_POLICY='Always'
fi
sed -e "s#{{ DOCKER_IMAGE }}#$docker_image#g" "./$PLATFORM/haproxy-conjur-master.yaml" |
sed -e "s#{{ IMAGE_PULL_POLICY }}#$IMAGE_PULL_POLICY#g" |
$cli create -f -
wait_for_node 'haproxy-conjur-master'
if [ $CONJUR_VERSION = '4' ]; then
if ! $cli get statefulset &>/dev/null; then # this returns non-0 if platform doesn't support statefulset
# haproxy image does not need custom configuration when using statefulset
echo "Configuring load balancer..."
# Update HAProxy config to reflect Conjur cluster and restart daemon.
haproxy/update_haproxy.sh haproxy-conjur-master
fi
else
echo "Configuring load balancer..."
haproxy/update_haproxy.sh haproxy-conjur-master
fi
if [[ $PLATFORM == openshift ]]; then
wait_for_service 'conjur-master'
else
# External IP always pending w/ k8s
sleep 5
fi
echo "Load balancer created and configured."