-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_kubeworkz.sh
46 lines (35 loc) · 1.54 KB
/
install_kubeworkz.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
#!/usr/bin/env bash
source /etc/kubeworkz/manifests/utils.sh
source /etc/kubeworkz/manifests/install.conf
if [ $(kubectl get nodes | wc -l) -eq 2 ]
then
echo "[WARN]delete taint of master node while only one node found"
kubectl get nodes | grep -v "NAME" | awk '{print $1}' | sed -n '1p' | xargs -t -i kubectl taint node {} node-role.kubernetes.io/master- > /dev/null
kubectl get nodes | grep -v "NAME" | awk '{print $1}' | sed -n '1p' | xargs -t -i kubectl taint node {} node-role.kubernetes.io/control-plane- > /dev/null
fi
if [ ! -z ${KUBERNETES_BIND_ADDRESS} ]; then
IPADDR=${KUBERNETES_BIND_ADDRESS}
fi
function render_values() {
clog info "render pivot values for kubeworkz chart values"
cat > render-values.yaml <<EOF
# pivot-value.yaml
global:
# control-plane node IP which is used for exporting NodePort svc.
nodeIP: ${IPADDR}
dependenciesEnable:
ingressController: "${INGRESS_CONTROLLER_ENABLE}" # set "true" to deploy if ingress is not already in cluster.
localPathStorage: "${LOCAL_PATH_STORAGE_ENABLE}"
metricServer: "${METRIC_SERVER_ENABLE}"
localKubeConfig: $(cat /root/.kube/config | base64 -w 0) # local cluster kubeconfig base64
pivotKubeConfig: $(cat /root/.kube/config | base64 -w 0) # pivot cluster kubeconfig base64
warden:
containers:
warden:
args:
cluster: "pivot-cluster" # set current cluster name
EOF
}
render_values
clog info "deploy kubeworkz"
/usr/local/bin/helm install kubeworkz -n ${INSTALL_NAMESPACE} --create-namespace /etc/kubeworkz/kubeworkz-chart -f ./render-values.yaml