...
1help(){
2 echo "MISSING ENVIRONMENT VARIABLES"
3 echo "export API_URL=https://dev1.edge-preprod.dev/api/v2"
4 echo "export API_BANNER=f8n-containment-zone"
5 echo "export API_ORGANIZATION=edge-dev1-retail-b526aa"
6 echo "export API_USERNAME=<ncr id>"
7 echo "export API_PASSWORD=<edge password>"
8 exit
9}
10
11
12if [ -z "${API_URL}" ]; then
13 API_URL=https://dev1.edge-preprod.dev/api/v2
14fi
15
16if [ -z "${API_BANNER}" ]; then
17 API_BANNER=f8n-containment-zone
18fi
19
20if [ -z "${API_ORGANIZATION}" ]; then
21 API_ORGANIZATION=edge-dev1-retail-b526aa
22fi
23
24if [ -z "${API_USERNAME}" ]; then
25 echo "API_USERNAME ENV NOT PROVIDED"
26 help
27fi
28
29if [ -z "${API_PASSWORD}" ]; then
30 echo "API_PASSWORD ENV NOT PROVIDED"
31 help
32fi
33
34
35STORE="$API_USERNAME-$(date +"%Y-%m-%d-%H-%M-%S")"
36
37echo "API_URL: $API_URL"
38echo "API_BANNER: $API_BANNER"
39echo "API_ORGANIZATION: $API_ORGANIZATION"
40echo "API_USERNAME: $API_USERNAME"
41echo "STORE_NAME: $STORE"
42
43k3d="$1"
44kubectl="$2"
45tag="$3"
46
47edge connect \
48 --banner="$API_BANNER" \
49 --organization="$API_ORGANIZATION" \
50 --store="$STORE" \
51 --create-site \
52 --kubeconfig="$HOME/.kube/config" \
53 --kubeconfig-context=k3d-f8n-ien-0 \
54 --cluster-type=dsds \
55 --api-endpoint="$API_URL" \
56 --username="$API_USERNAME" \
57 --password="$API_PASSWORD"
58
59if [ $? -ne 0 ]; then
60 echo "could not connect cluster: $CLUSTER_ID"
61 exit
62fi
63
64$kubectl -n warehouse-system scale --replicas=0 deployment/lumperctl
65
66if [ $? -ne 0 ]; then
67 echo "LUMPER NOT FOUND"
68 exit
69fi
70
71# stop once lumper is scaled
72# exit
73
74$kubectl create ns fluent-operator
75$kubectl create ns pxe
76$kubectl create ns vpn
77$kubectl create ns sds
78$kubectl create ns spegel
79$kubectl create ns edge-iam
80$kubectl apply -k ../../../config/components/edge-iam-v2/crds
81$kubectl apply -f ../../../config/components/edge-iam-v2/targets/env/kind/crds # Prometheus
82$kubectl apply -f ../../../config/pallets/linkerdctl/base/crds/linkerd-crds.yaml # LinkerD
83
84echo "Checking for shipments-sync kustomization"
85while ! $kubectl wait --for=jsonpath='{.status.conditions[0].reason}'=ReconciliationSucceeded Kustomization shipments-sync -n edge-flux &> /dev/null
86do
87 echo "waiting for Kustomization shipments-sync"
88 sleep 2
89done
90
91echo "Checking for chariot-sync kustomization"
92while ! $kubectl wait --for=jsonpath='{.status.conditions[0].reason}'=ReconciliationSucceeded Kustomization chariot-sync -n edge-flux &> /dev/null
93do
94 echo "waiting for Kustomization chariot-sync"
95 sleep 2
96done
97
98echo "Done with kustomizations"
99
100CLUSTER_ID=$($kubectl get Shipment --no-headers -o custom-columns=":metadata.name")
101if [ -z "${CLUSTER_ID}" ]; then
102 echo "SHIPMENT NOT FOUND"
103 exit
104fi
105
106echo "SHIPMENT: $CLUSTER_ID"
107
108$kubectl -n flux-system scale --replicas=0 deployment/kustomize-controller
109$kubectl -n flux-system scale --replicas=0 deployment/helm-controller
110$kubectl -n flux-system scale --replicas=0 deployment/source-controller
111
112# Do we need datasync right now?
113# $kubectl patch Shipment --type=merge -p '{"spec": {"pallets": [{"name":"datasync", "tag": '"\"$tag\""'}]}}' "$CLUSTER_ID"
114# $kubectl patch Shipment --type=merge -p '{"spec": {"unpack": {"capabilities": [] }}}' "$CLUSTER_ID"
115
116# $kubectl create ns data-sync-couchdb
117# $kubectl create secret generic couchdb-local-creds -n data-sync-couchdb --from-literal=username="$API_USERNAME" --from-literal=password="$API_PASSWORD" --from-literal=cookieAuthSecret=cookiemonster
118
119# $kubectl -n warehouse-system scale --replicas=1 deployment/lumperctl
View as plain text