help(){ echo "MISSING ENVIRONMENT VARIABLES" echo "export API_URL=https://dev1.edge-preprod.dev/api/v2" echo "export API_BANNER=f8n-containment-zone" echo "export API_ORGANIZATION=edge-dev1-retail-b526aa" echo "export API_USERNAME=" echo "export API_PASSWORD=" exit } if [ -z "${API_URL}" ]; then API_URL=https://dev1.edge-preprod.dev/api/v2 fi if [ -z "${API_BANNER}" ]; then API_BANNER=f8n-containment-zone fi if [ -z "${API_ORGANIZATION}" ]; then API_ORGANIZATION=edge-dev1-retail-b526aa fi if [ -z "${API_USERNAME}" ]; then echo "API_USERNAME ENV NOT PROVIDED" help fi if [ -z "${API_PASSWORD}" ]; then echo "API_PASSWORD ENV NOT PROVIDED" help fi STORE="$API_USERNAME-$(date +"%Y-%m-%d-%H-%M-%S")" echo "API_URL: $API_URL" echo "API_BANNER: $API_BANNER" echo "API_ORGANIZATION: $API_ORGANIZATION" echo "API_USERNAME: $API_USERNAME" echo "STORE_NAME: $STORE" k3d="$1" kubectl="$2" tag="$3" edge connect \ --banner="$API_BANNER" \ --organization="$API_ORGANIZATION" \ --store="$STORE" \ --create-site \ --kubeconfig="$HOME/.kube/config" \ --kubeconfig-context=k3d-f8n-ien-0 \ --cluster-type=dsds \ --api-endpoint="$API_URL" \ --username="$API_USERNAME" \ --password="$API_PASSWORD" if [ $? -ne 0 ]; then echo "could not connect cluster: $CLUSTER_ID" exit fi $kubectl -n warehouse-system scale --replicas=0 deployment/lumperctl if [ $? -ne 0 ]; then echo "LUMPER NOT FOUND" exit fi # stop once lumper is scaled # exit $kubectl create ns fluent-operator $kubectl create ns pxe $kubectl create ns vpn $kubectl create ns sds $kubectl create ns spegel $kubectl create ns edge-iam $kubectl apply -k ../../../config/components/edge-iam-v2/crds $kubectl apply -f ../../../config/components/edge-iam-v2/targets/env/kind/crds # Prometheus $kubectl apply -f ../../../config/pallets/linkerdctl/base/crds/linkerd-crds.yaml # LinkerD echo "Checking for shipments-sync kustomization" while ! $kubectl wait --for=jsonpath='{.status.conditions[0].reason}'=ReconciliationSucceeded Kustomization shipments-sync -n edge-flux &> /dev/null do echo "waiting for Kustomization shipments-sync" sleep 2 done echo "Checking for chariot-sync kustomization" while ! $kubectl wait --for=jsonpath='{.status.conditions[0].reason}'=ReconciliationSucceeded Kustomization chariot-sync -n edge-flux &> /dev/null do echo "waiting for Kustomization chariot-sync" sleep 2 done echo "Done with kustomizations" CLUSTER_ID=$($kubectl get Shipment --no-headers -o custom-columns=":metadata.name") if [ -z "${CLUSTER_ID}" ]; then echo "SHIPMENT NOT FOUND" exit fi echo "SHIPMENT: $CLUSTER_ID" $kubectl -n flux-system scale --replicas=0 deployment/kustomize-controller $kubectl -n flux-system scale --replicas=0 deployment/helm-controller $kubectl -n flux-system scale --replicas=0 deployment/source-controller # Do we need datasync right now? # $kubectl patch Shipment --type=merge -p '{"spec": {"pallets": [{"name":"datasync", "tag": '"\"$tag\""'}]}}' "$CLUSTER_ID" # $kubectl patch Shipment --type=merge -p '{"spec": {"unpack": {"capabilities": [] }}}' "$CLUSTER_ID" # $kubectl create ns data-sync-couchdb # $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 # $kubectl -n warehouse-system scale --replicas=1 deployment/lumperctl