forked from cyberark/kubernetes-conjur-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7_configure_followers.sh
executable file
·42 lines (25 loc) · 983 Bytes
/
7_configure_followers.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
#!/bin/bash
set -euo pipefail
. utils.sh
set_namespace $CONJUR_NAMESPACE_NAME
announce "Configuring followers."
master_pod_name=$(get_master_pod_name)
echo "Preparing follower seed files..."
# Create dir w/ guid from namespace name for parallel CI execution
seed_dir="tmp-$CONJUR_NAMESPACE_NAME"
mkdir -p $seed_dir
$cli exec $master_pod_name evoke seed follower conjur-follower > "./$seed_dir/follower-seed.tar"
pod_list=$($cli get pods -l role=follower --no-headers | awk '{ print $1 }')
function configure_follower() {
local pod_name=$1
printf "Configuring follower %s...\n" $pod_name
copy_file_to_container "./$seed_dir/follower-seed.tar" "/tmp/follower-seed.tar" "$pod_name"
$cli exec $pod_name -- evoke unpack seed /tmp/follower-seed.tar
$cli exec $pod_name -- evoke configure follower
}
for pod_name in $pod_list; do
configure_follower $pod_name &
done
wait # for parallel configuration of followers
rm -rf $seed_dir
echo "Followers configured."