forked from rancher/fleet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-fleet
executable file
·29 lines (23 loc) · 1.32 KB
/
setup-fleet
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
#!/bin/bash
# Description: install fleet standalone into the current kubectl context
set -euxo pipefail
cluster_name=${1-upstream}
if [ ! -d ./charts/fleet ]; then
echo "please change the current directory to the fleet repo checkout"
exit 1
fi
# single cluster
host=$( docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "k3d-$cluster_name-server-0" )
ca=$( kubectl config view --flatten -o jsonpath='{.clusters[?(@.name == "k3d-'"$cluster_name"'")].cluster.certificate-authority-data}' | base64 -d )
server="https://$host:6443"
helm -n cattle-fleet-system upgrade --install --create-namespace --wait fleet-crd charts/fleet-crd
helm -n cattle-fleet-system upgrade --install --create-namespace --wait --reset-values \
--set apiServerCA="$ca" \
--set apiServerURL="$server" \
--set debug=true --set debugLevel=1 fleet charts/fleet
# wait for controller and agent rollout
kubectl -n cattle-fleet-system rollout status deployment/fleet-controller
{ grep -E -q -m 1 "fleet-agent-local.*1/1"; kill $!; } < <(kubectl get bundles -n fleet-local -w)
kubectl -n cattle-fleet-system rollout status statefulset/fleet-agent
# label local cluster
kubectl patch clusters.fleet.cattle.io -n fleet-local local --type=json -p '[{"op": "add", "path": "/metadata/labels/management.cattle.io~1cluster-display-name", "value": "local" }]'