Add additional clean targets 04/4704/1
authorTodd Malsbary <todd.malsbary@intel.com>
Tue, 1 Mar 2022 20:56:01 +0000 (12:56 -0800)
committerTodd Malsbary <todd.malsbary@intel.com>
Wed, 2 Mar 2022 17:00:07 +0000 (09:00 -0800)
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Change-Id: I60306d7663cf35a7645af21f5f873167730e4672

Makefile
deploy/baremetal-operator/baremetal-operator.sh
deploy/cert-manager/cert-manager.sh
deploy/flux/flux.sh
deploy/ironic/ironic.sh
deploy/site/pod11/pod11.sh
deploy/site/vm/vm.sh

index 6be0148..9e6115d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,8 @@ jump_server: management_cluster \
        ironic_bridge \
        controllers
 
-jump_server_clean: ironic_bridge_clean \
+jump_server_clean: controllers_clean \
+       ironic_bridge_clean \
        management_cluster_clean
 
 # The jump server requires a K8s cluster to install into
@@ -73,11 +74,19 @@ ironic_bridge_clean:
 
 # Jump server components
 
-controllers: baremetal_operator \
+controllers: ironic \
+       cert_manager \
+       baremetal_operator \
        cluster_api \
        flux
 
-baremetal_operator: ironic cert_manager
+controllers_clean: flux_clean \
+       cluster_api_clean \
+       baremetal_operator_clean \
+       cert_manager_clean \
+       ironic_clean
+
+baremetal_operator:
        ./deploy/baremetal-operator/baremetal-operator.sh deploy
 
 baremetal_operator_clean:
@@ -86,15 +95,27 @@ baremetal_operator_clean:
 ironic:
        ./deploy/ironic/ironic.sh deploy
 
+ironic_clean:
+       ./deploy/ironic/ironic.sh clean
+
 cert_manager:
        ./deploy/cert-manager/cert-manager.sh deploy
 
+cert_manager_clean:
+       ./deploy/cert-manager/cert-manager.sh clean
+
 cluster_api:
        ./deploy/cluster-api/cluster-api.sh deploy
 
+cluster_api_clean:
+       ./deploy/cluster-api/cluster-api.sh clean
+
 flux:
        ./deploy/flux/flux.sh deploy
 
+flux_clean:
+       ./deploy/flux/flux.sh clean
+
 # Example compute clusters
 
 pod11_cluster:
@@ -105,6 +126,7 @@ pod11_cluster:
 
 pod11_cluster_clean:
        ./deploy/site/pod11/pod11.sh clean
+       ./deploy/site/pod11/pod11.sh wait-clean
 
 vm_cluster:
        ./deploy/site/vm/vm.sh deploy
@@ -114,6 +136,7 @@ vm_cluster:
 
 vm_cluster_clean:
        ./deploy/site/vm/vm.sh clean
+       ./deploy/site/vm/vm.sh wait-clean
 
 # Test targets
 
index 4aa3eff..34c5977 100755 (executable)
@@ -32,7 +32,7 @@ function deploy {
 }
 
 function clean {
-    kustomize build ${SCRIPTDIR}/icn | kubectl delete -f -
+    kustomize build ${SCRIPTDIR}/icn | kubectl delete --ignore-not-found=true -f -
 }
 
 case $1 in
index 89ca9cc..8983ce2 100755 (executable)
@@ -29,7 +29,7 @@ function deploy {
 }
 
 function clean {
-    kustomize build ${SCRIPTDIR}/icn | kubectl delete -f -
+    kustomize build ${SCRIPTDIR}/icn | kubectl delete --ignore-not-found=true -f -
 }
 
 case $1 in
index cf1ec8f..ac31281 100755 (executable)
@@ -12,7 +12,7 @@ function deploy {
 }
 
 function clean {
-    flux uninstall
+    flux uninstall -s
 }
 
 case $1 in
index d4f4bdd..6aefde6 100755 (executable)
@@ -100,7 +100,7 @@ function deploy {
 }
 
 function clean {
-    kustomize build ${SCRIPTDIR}/icn | kubectl delete -f -
+    kustomize build ${SCRIPTDIR}/icn | kubectl delete --ignore-not-found=true -f -
     rm -rf ${IRONIC_DATA_DIR}
 }
 
index 7c052ff..28530fc 100644 (file)
@@ -49,11 +49,22 @@ function wait_for_all_ready {
     wait_for is_control_plane_ready
 }
 
+function is_cluster_deleted {
+    ! kubectl -n ${SITE_NAMESPACE} get cluster icn
+}
+
+function wait_for_all_deleted {
+    WAIT_FOR_INTERVAL=60s
+    WAIT_FOR_TRIES=30
+    wait_for is_cluster_deleted
+}
+
 case $1 in
     "build-source") build_source ;;
     "clean") clean ;;
     "deploy") deploy ;;
     "wait") wait_for_all_ready ;;
+    "wait-clean") wait_for_all_deleted ;;
     *) cat <<EOF
 Usage: $(basename $0) COMMAND
 
index c533f27..51ad4c9 100644 (file)
@@ -107,11 +107,22 @@ function wait_for_all_ready {
     insert_control_plane_network_identity_into_ssh_config
 }
 
+function is_cluster_deleted {
+    ! kubectl -n ${SITE_NAMESPACE} get cluster icn
+}
+
+function wait_for_all_deleted {
+    WAIT_FOR_INTERVAL=60s
+    WAIT_FOR_TRIES=30
+    wait_for is_cluster_deleted
+}
+
 case $1 in
     "build-source") build_source ;;
     "clean") clean ;;
     "deploy") deploy ;;
     "wait") wait_for_all_ready ;;
+    "wait-clean") wait_for_all_deleted ;;
     *) cat <<EOF
 Usage: $(basename $0) COMMAND