Skip to content

Commit

Permalink
Merge pull request #16 from edenlabllc/release/v1.25.0
Browse files Browse the repository at this point in the history
Release/v1.25.0
  • Loading branch information
apanasiuk-el authored Nov 26, 2024
2 parents 96fcdfe + 1f3dcf3 commit 94058f1
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
50 changes: 50 additions & 0 deletions bin/gcp-cluster-postsync-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

set -e

RELEASE_NAME="${1}"
NAMESPACE="${2:-gcp}"
LIMIT="${3:-1200}"

GO_TEMPLATE='
{{- range .items -}}
{{- if eq .kind "Cluster" -}}
{{- if ne .status.phase "Provisioned" }}0{{- end }}
{{- if not .status.controlPlaneReady }}0{{- end }}
{{- if not .status.infrastructureReady }}0{{- end }}
{{- end -}}
{{- if eq .kind "GCPManagedCluster" -}}
{{- if not .status.ready }}0{{- end }}
{{- end -}}
{{- if eq .kind "GCPManagedControlPlane" -}}
{{- if not .status.ready }}0{{- end }}
{{- if not .status.initialized }}0{{- end }}
{{- end -}}
{{- if eq .kind "GCPManagedMachinePool" -}}
{{- if not .status.ready }}0{{- end -}}
{{- end -}}
{{- if eq .kind "MachinePool" -}}
{{- if ne .status.phase "Running" }}0{{- end }}
{{- if not .status.bootstrapReady }}0{{- end }}
{{- if not .status.infrastructureReady }}0{{- end }}
{{- end -}}
{{- end -}}
'

COUNT=1
while true; do
STATUS="$(kubectl --namespace "${NAMESPACE}" get cluster-api \
--selector "app.kubernetes.io/instance=${RELEASE_NAME}" \
--output "go-template=${GO_TEMPLATE}")"
if [[ "${STATUS}" != "" && "${COUNT}" -le "${LIMIT}" ]]; then
sleep 1
((++COUNT))
elif [[ "${COUNT}" -gt "${LIMIT}" ]]; then
>2& echo "Limit exceeded."
exit 1
else
echo
kubectl --namespace "${NAMESPACE}" get cluster-api --selector "app.kubernetes.io/instance=${RELEASE_NAME}"
break
fi
done
12 changes: 12 additions & 0 deletions bin/gcp-cluster-uninstall-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e

CLUSTER_NAME="${1}"
NAMESPACE="${2}"
WAIT_FOR_CLUSTER_DELETION="${3:-false}"

kubectl --namespace "${NAMESPACE}" delete cluster "${CLUSTER_NAME}" "--wait=${WAIT_FOR_CLUSTER_DELETION}"

# Required for correct release removal of gcp-cluster via Helm
sleep 3

0 comments on commit 94058f1

Please sign in to comment.