forked from billimek/k8s-gitops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap-objects.sh
executable file
·60 lines (47 loc) · 1.57 KB
/
bootstrap-objects.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
REPO_ROOT=$(git rev-parse --show-toplevel)
need() {
which "$1" &>/dev/null || die "Binary '$1' is missing but required"
}
need "kubectl"
message() {
echo -e "\n######################################################################"
echo "# $1"
echo "######################################################################"
}
kapply() {
if output=$(envsubst < "$@"); then
printf '%s' "$output" | kubectl apply -f -
fi
}
installManualObjects(){
. "$REPO_ROOT"/setup/.env
message "installing manual secrets and objects"
##########
# secrets
##########
kubectl -n kube-system create secret generic kms-vault --from-literal=account.json="$(echo $VAULT_KMS_ACCOUNT_JSON | base64 --decode)"
kubectl -n kube-system create secret docker-registry registry-creds-secret --namespace kube-system --docker-username=$DOCKER_USERNAME --docker-password=$DOCKER_TOKEN --docker-email=$EMAIL
###################
# nginx
###################
# for i in "$REPO_ROOT"/kube-system/nginx/nginx-external/*.txt
# do
# kapply "$i"
# done
###################
# rook
###################
ROOK_NAMESPACE_READY=1
while [ $ROOK_NAMESPACE_READY != 0 ]; do
echo "waiting for rook-ceph namespace to be fully ready..."
# this is a hack to check for the namespace
kubectl -n rook-ceph wait --for condition=Established crd/volumes.rook.io > /dev/null 2>&1
ROOK_NAMESPACE_READY="$?"
sleep 5
done
kapply "$REPO_ROOT"/rook-ceph/dashboard/ingress.txt
}
export KUBECONFIG="$REPO_ROOT/setup/kubeconfig"
installManualObjects
message "all done!"