-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbootstrap-cluster.sh
executable file
·56 lines (42 loc) · 1.3 KB
/
bootstrap-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
#!/bin/bash
# Check if one argument is provided
if [[ $# -ne 1 ]]; then
echo "Please provide IP-Range, usage: $0 a.b.c.d-a.b.c.e"
exit 1
fi
ADDRESS_RANGE=$1
# Cluster Bootstrapping
# 0.0.1 1/9/24 Huse Initial version
### Service Account
echo "creating service account"
. ./bootstrap/service-account/create-sa.sh nai-admin
### MetalLB
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.10/config/manifests/metallb-native.yaml
sleep 20
cat << EOF | kubectl create -f -
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: subnetpool
namespace: metallb-system
spec:
addresses:
- $ADDRESS_RANGE
EOF
cat << EOF | kubectl create -f -
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: empty
namespace: metallb-system
EOF
### Handover to ArgoCD-Core
echo "deploy argocd-core"
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.9.3/manifests/core-install.yaml
kubectl wait --for condition=established crd applicationsets.argoproj.io
echo "start cluster bootstrapping"
kustomize build clusters/base/argocd | kubectl apply -f -
echo "everything´s finished. To log into ArgoCD to check apps, run:"
echo "kubectl config set-context --current --namespace=argocd"
echo "argocd login --core"