-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add bash script for uninstalling ACM (#1453)
This is an alternative approach to uninstalling Config Management and the operator. This is intended as a simple/portable alternative to using the nomos migrate command.
- Loading branch information
Showing
3 changed files
with
208 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
!/scripts | ||
!/e2e | ||
!/examples | ||
!/installation |
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 | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This script uninstalls ConfigManagement | ||
|
||
set -euox pipefail | ||
|
||
hnc_enabled="$(kubectl get configmanagements.configmanagement.gke.io config-management -o=jsonpath="{.spec.hierarchyController.enabled}" --ignore-not-found)" | ||
|
||
if [[ "${hnc_enabled}" == "true" ]]; then | ||
echo "Hierarchy Controller is enabled on the ConfigManagement object. It must be disabled before migrating." | ||
echo "This can be done by unsetting the spec.hierarchyController field on ConfigManagement." | ||
exit 1 | ||
fi | ||
|
||
kubectl delete deployment -n config-management-system config-management-operator --ignore-not-found --cascade=foreground | ||
|
||
if kubectl get configmanagement config-management &> /dev/null ; then | ||
kubectl patch configmanagement config-management --type="merge" -p '{"metadata":{"finalizers":[]}}' | ||
kubectl delete configmanagement config-management --cascade=orphan --ignore-not-found | ||
fi | ||
|
||
kubectl delete clusterrolebinding config-management-operator --ignore-not-found | ||
kubectl delete clusterrole config-management-operator --ignore-not-found | ||
kubectl delete serviceaccount -n config-management-system config-management-operator --ignore-not-found | ||
kubectl delete customresourcedefinition configmanagements.configmanagement.gke.io --ignore-not-found |