forked from kyma-project/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset-up-workload-cluster.sh
executable file
·64 lines (50 loc) · 1.89 KB
/
set-up-workload-cluster.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
61
62
63
#!/bin/bash
# Source development/prow/set-up-workload-cluster.sh
set -o errexit
###
readonly CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
readonly KUBECONFIG=${KUBECONFIG:-"${HOME}/.kube/config"}
readonly PROW_WORKLOAD_CLUSTER_DIR="$( cd "${CURRENT_DIR}/workload-cluster" && pwd )"
if [ -z "$BUCKET_NAME" ]; then
echo "\$BUCKET_NAME is empty"
exit 1
fi
if [ -z "$KEYRING_NAME" ]; then
echo "\$KEYRING_NAME is empty"
exit 1
fi
if [ -z "$ENCRYPTION_KEY_NAME" ]; then
echo "\$ENCRYPTION_KEY_NAME is empty"
exit 1
fi
if [ -z "${LOCATION}" ]; then
LOCATION="global"
fi
# requried by secretspopulator
if [ -z "$GOOGLE_APPLICATION_CREDENTIALS" ]; then
echo "\$GOOGLE_APPLICATION_CREDENTIALS is empty"
exit 1
fi
if [ -z "$PROJECT" ]; then
echo "\$PROJECT is empty"
exit 1
fi
# Set up ClusterRoleBinding for User: Client which plank needs to operate on this cluster
kubectl apply -f "${PROW_WORKLOAD_CLUSTER_DIR}/00-clusterrolebinding.yaml"
# Install PodDisruptionBudgets
kubectl apply -f "${PROW_WORKLOAD_CLUSTER_DIR}/02-kube-system_poddisruptionbudgets.yaml"
# Overwrite kube-dns-autoscaler config map
cat <<EOF | kubectl replace -f -
apiVersion: v1
data:
linear: '{"coresPerReplica":256,"nodesPerReplica":8,"preventSinglePointFailure":true}'
kind: ConfigMap
metadata:
name: kube-dns-autoscaler
namespace: kube-system
EOF
# Configure stub-domains to speed up DNS propagation
kubectl -n kube-system patch cm kube-dns --type merge --patch \
"$(cat "${PROW_WORKLOAD_CLUSTER_DIR}"/03-kube-dns-stub-domains-patch.yaml)"
# Create secrets
go run "${CURRENT_DIR}/../development/tools/cmd/secretspopulator/main.go" --project="${PROJECT}" --location "${LOCATION}" --bucket "${BUCKET_NAME}" --keyring "${KEYRING_NAME}" --key "${ENCRYPTION_KEY_NAME}" --kubeconfig "${KUBECONFIG}" --secrets-def-file="${PROW_WORKLOAD_CLUSTER_DIR}/required-secrets.yaml"