-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from MikeEdgar/MGDSTRM-10618
[MGDSTRM-10618] Re-factor uninstall for enterprise de-registration
- Loading branch information
Showing
11 changed files
with
225 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
DIR_NAME="$(dirname $0)" | ||
source "${DIR_NAME}/utils/common.sh" | ||
source "${DIR_NAME}/kas-installer.env" | ||
source "${DIR_NAME}/kas-installer-defaults.env" | ||
|
||
CLUSTER_ID="${1:-""}" | ||
ACCESS_TOKEN="$(${DIR_NAME}/get_access_token.sh --owner 2>/dev/null)" | ||
CLUSTERS_BASE_URL="https://kas-fleet-manager-kas-fleet-manager-${USER}.apps.${K8S_CLUSTER_DOMAIN}/api/kafkas_mgmt/v1/clusters" | ||
|
||
if [ -z "${CLUSTER_ID}" ] ; then | ||
CLUSTERS=$(curl -sXGET -H "Authorization: Bearer ${ACCESS_TOKEN}" ${CLUSTERS_BASE_URL}) | ||
CLUSTER_COUNT=$(echo "${CLUSTERS}" | jq -r .total) | ||
|
||
if [ "${CLUSTER_COUNT}" -eq "0" ] ; then | ||
echo "No clusters found to deregister" | ||
exit 1 | ||
elif [ "${CLUSTER_COUNT}" -gt "1" ] ; then | ||
echo "Multiple clusters found, please provide a cluster_id" | ||
exit 1 | ||
else | ||
CLUSTER_ID=$(echo "${CLUSTERS}" | jq -r .items[0].cluster_id) | ||
echo "Single cluster found: ${CLUSTER_ID}" | ||
fi | ||
fi | ||
|
||
for MKID in $(${DIR_NAME}/managed_kafka.sh --list --search "cluster_id = ${CLUSTER_ID}" | jq -r '.items[] | .id') ; do | ||
echo "Removing Kafka instance ${MKID}" | ||
${DIR_NAME}/managed_kafka.sh --delete ${MKID} --wait | ||
done | ||
|
||
echo "De-registering cluster ${CLUSTER_ID} from kas-fleet-manager" | ||
curl -sXDELETE -H "Authorization: Bearer ${ACCESS_TOKEN}" ${CLUSTERS_BASE_URL}/${CLUSTER_ID}?async=true | ||
|
||
delete_dataplane_resources 'true' 'true' "${CLUSTER_ID}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.