diff --git a/scripts/library/argo.sh b/scripts/library/argo.sh index d17e5d9d..972124cb 100644 --- a/scripts/library/argo.sh +++ b/scripts/library/argo.sh @@ -69,3 +69,23 @@ argo_install(){ argo_print_info } + +argo_disable_management(){ + ARGO_DEPLOY_STABLE=(cluster kam openshift-gitops-applicationset-controller openshift-gitops-redis openshift-gitops-repo-server openshift-gitops-server) + + for i in "${ARGO_DEPLOY_STABLE[@]}" + do + echo "Scaling OpenShift GitOps deployment $i to 0" + oc scale --replicas=0 deployment "$i" -n "${ARGO_NS}" + done + + # shellcheck disable=SC2034 + NAMESPACE="${ARGO_NS}" + k8s_null_finalizers_for_all_resource_instances applicationsets.argoproj.io + oc delete applicationsets.argoproj.io -n "${ARGO_NS}" --all + k8s_null_finalizers_for_all_resource_instances application.argoproj.io + oc delete application.argoproj.io -n "${ARGO_NS}" --all + + oc delete -k "${ARGO_KUSTOMIZE_OPERATOR}" + oc delete -k "${ARGO_KUSTOMIZE_INSTANCE}" +} diff --git a/scripts/library/aws.sh b/scripts/library/aws.sh index 1da511ea..2f9bcbc4 100644 --- a/scripts/library/aws.sh +++ b/scripts/library/aws.sh @@ -1,7 +1,7 @@ #!/bin/bash aws_check_cli(){ - which aws || \ + which aws >/dev/null 2>&1 || \ pip install awscli -q || return } diff --git a/scripts/library/k8s.sh b/scripts/library/k8s.sh index f028cfc1..d5ded681 100644 --- a/scripts/library/k8s.sh +++ b/scripts/library/k8s.sh @@ -27,7 +27,7 @@ k8s_null_finalizers(){ # -p '[{"op": "remove", "path":"/metadata/finalizers"}]' } -k8s_null_finalizers_for_all_resource(){ +k8s_null_finalizers_for_all_resource_instances(){ RESOURCE=${1} [ -z ${RESOURCE+x} ] && return 1 @@ -96,7 +96,7 @@ k8s_ns_delete_most_resources_force(){ for i in $(k8s_get_most_api_resources) do echo "Resource:" "${i}" - k8s_null_finalizers_for_all_resource "${i}" + k8s_null_finalizers_for_all_resource_instances "${i}" kubectl -n "${NAMESPACE}" \ delete "${i}" \ --all diff --git a/scripts/library/macros.sh b/scripts/library/macros.sh index 5ce98b49..7738de3e 100644 --- a/scripts/library/macros.sh +++ b/scripts/library/macros.sh @@ -18,7 +18,7 @@ setup_operator_nvidia(){ # setup nvidia gpu operator oc apply -k components/operators/gpu-operator-certified/operator/overlays/stable k8s_wait_for_crd clusterpolicies.nvidia.com - oc apply -k components/operators/gpu-operator-certified/instance/overlays/time-slicing-4 + oc apply -k components/operators/gpu-operator-certified/instance/overlays/time-slicing-2 } setup_operator_pipelines(){ @@ -29,5 +29,5 @@ setup_operator_pipelines(){ setup_namespaces(){ # setup namespaces - oc apply -k components/configs/namespaces/overlays/default + oc apply -k components/configs/cluster/namespaces/overlays/default }