You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pe...@apache.org on 2025/11/03 18:07:05 UTC

(cloudstack) branch delete-resources-tied-pvc updated (22b42b61b46 -> a20dd4483e1)

This is an automated email from the ASF dual-hosted git repository.

pearl11594 pushed a change to branch delete-resources-tied-pvc
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


 discard 22b42b61b46 CKS/CSI: fix PVC deletion script to avoid '(standard input)' and use kubectl -o name/jsonpath
    omit 71f47d61304 Updating pom.xml version numbers for release 4.22.0.0
     new a20dd4483e1 CKS/CSI: fix PVC deletion script to avoid '(standard input)' and use kubectl -o name/jsonpath

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (22b42b61b46)
            \
             N -- N -- N   refs/heads/delete-resources-tied-pvc (a20dd4483e1)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 agent/pom.xml                                                       | 2 +-
 api/pom.xml                                                         | 2 +-
 client/pom.xml                                                      | 2 +-
 core/pom.xml                                                        | 2 +-
 debian/changelog                                                    | 6 ------
 developer/pom.xml                                                   | 2 +-
 engine/api/pom.xml                                                  | 2 +-
 engine/components-api/pom.xml                                       | 2 +-
 engine/orchestration/pom.xml                                        | 2 +-
 engine/pom.xml                                                      | 2 +-
 engine/schema/pom.xml                                               | 2 +-
 engine/service/pom.xml                                              | 2 +-
 engine/storage/cache/pom.xml                                        | 2 +-
 engine/storage/configdrive/pom.xml                                  | 2 +-
 engine/storage/datamotion/pom.xml                                   | 2 +-
 engine/storage/image/pom.xml                                        | 2 +-
 engine/storage/integration-test/pom.xml                             | 2 +-
 engine/storage/object/pom.xml                                       | 2 +-
 engine/storage/pom.xml                                              | 2 +-
 engine/storage/snapshot/pom.xml                                     | 2 +-
 engine/storage/volume/pom.xml                                       | 2 +-
 engine/userdata/cloud-init/pom.xml                                  | 2 +-
 engine/userdata/pom.xml                                             | 2 +-
 framework/agent-lb/pom.xml                                          | 2 +-
 framework/ca/pom.xml                                                | 2 +-
 framework/cluster/pom.xml                                           | 2 +-
 framework/config/pom.xml                                            | 2 +-
 framework/db/pom.xml                                                | 2 +-
 framework/direct-download/pom.xml                                   | 2 +-
 framework/events/pom.xml                                            | 2 +-
 framework/extensions/pom.xml                                        | 6 +++---
 framework/ipc/pom.xml                                               | 2 +-
 framework/jobs/pom.xml                                              | 2 +-
 framework/managed-context/pom.xml                                   | 2 +-
 framework/pom.xml                                                   | 2 +-
 framework/quota/pom.xml                                             | 2 +-
 framework/rest/pom.xml                                              | 2 +-
 framework/security/pom.xml                                          | 2 +-
 framework/spring/lifecycle/pom.xml                                  | 2 +-
 framework/spring/module/pom.xml                                     | 2 +-
 plugins/acl/dynamic-role-based/pom.xml                              | 2 +-
 plugins/acl/project-role-based/pom.xml                              | 2 +-
 plugins/acl/static-role-based/pom.xml                               | 2 +-
 plugins/affinity-group-processors/explicit-dedication/pom.xml       | 2 +-
 plugins/affinity-group-processors/host-affinity/pom.xml             | 2 +-
 plugins/affinity-group-processors/host-anti-affinity/pom.xml        | 2 +-
 plugins/affinity-group-processors/non-strict-host-affinity/pom.xml  | 2 +-
 .../affinity-group-processors/non-strict-host-anti-affinity/pom.xml | 2 +-
 plugins/alert-handlers/snmp-alerts/pom.xml                          | 2 +-
 plugins/alert-handlers/syslog-alerts/pom.xml                        | 2 +-
 plugins/api/discovery/pom.xml                                       | 2 +-
 plugins/api/rate-limit/pom.xml                                      | 2 +-
 plugins/api/solidfire-intg-test/pom.xml                             | 2 +-
 plugins/api/vmware-sioc/pom.xml                                     | 2 +-
 plugins/backup/dummy/pom.xml                                        | 2 +-
 plugins/backup/nas/pom.xml                                          | 2 +-
 plugins/backup/networker/pom.xml                                    | 2 +-
 plugins/backup/veeam/pom.xml                                        | 2 +-
 plugins/ca/root-ca/pom.xml                                          | 2 +-
 plugins/database/mysql-ha/pom.xml                                   | 2 +-
 plugins/database/quota/pom.xml                                      | 2 +-
 plugins/dedicated-resources/pom.xml                                 | 2 +-
 plugins/deployment-planners/implicit-dedication/pom.xml             | 2 +-
 plugins/deployment-planners/user-concentrated-pod/pom.xml           | 2 +-
 plugins/deployment-planners/user-dispersing/pom.xml                 | 2 +-
 plugins/drs/cluster/balanced/pom.xml                                | 2 +-
 plugins/drs/cluster/condensed/pom.xml                               | 2 +-
 plugins/event-bus/inmemory/pom.xml                                  | 2 +-
 plugins/event-bus/kafka/pom.xml                                     | 2 +-
 plugins/event-bus/rabbitmq/pom.xml                                  | 2 +-
 plugins/event-bus/webhook/pom.xml                                   | 2 +-
 plugins/ha-planners/skip-heurestics/pom.xml                         | 2 +-
 plugins/host-allocators/random/pom.xml                              | 2 +-
 plugins/hypervisors/baremetal/pom.xml                               | 2 +-
 plugins/hypervisors/external/pom.xml                                | 2 +-
 plugins/hypervisors/hyperv/pom.xml                                  | 2 +-
 plugins/hypervisors/kvm/pom.xml                                     | 2 +-
 plugins/hypervisors/simulator/pom.xml                               | 2 +-
 plugins/hypervisors/ucs/pom.xml                                     | 2 +-
 plugins/hypervisors/vmware/pom.xml                                  | 2 +-
 plugins/hypervisors/xenserver/pom.xml                               | 2 +-
 plugins/integrations/cloudian/pom.xml                               | 2 +-
 plugins/integrations/kubernetes-service/pom.xml                     | 2 +-
 plugins/integrations/prometheus/pom.xml                             | 2 +-
 plugins/maintenance/pom.xml                                         | 2 +-
 plugins/metrics/pom.xml                                             | 2 +-
 plugins/network-elements/bigswitch/pom.xml                          | 2 +-
 plugins/network-elements/brocade-vcs/pom.xml                        | 2 +-
 plugins/network-elements/cisco-vnmc/pom.xml                         | 2 +-
 plugins/network-elements/dns-notifier/pom.xml                       | 2 +-
 plugins/network-elements/elastic-loadbalancer/pom.xml               | 2 +-
 plugins/network-elements/globodns/pom.xml                           | 2 +-
 plugins/network-elements/internal-loadbalancer/pom.xml              | 2 +-
 plugins/network-elements/juniper-contrail/pom.xml                   | 2 +-
 plugins/network-elements/netris/pom.xml                             | 2 +-
 plugins/network-elements/netscaler/pom.xml                          | 2 +-
 plugins/network-elements/nicira-nvp/pom.xml                         | 2 +-
 plugins/network-elements/nsx/pom.xml                                | 2 +-
 plugins/network-elements/opendaylight/pom.xml                       | 2 +-
 plugins/network-elements/ovs/pom.xml                                | 2 +-
 plugins/network-elements/palo-alto/pom.xml                          | 2 +-
 plugins/network-elements/stratosphere-ssp/pom.xml                   | 2 +-
 plugins/network-elements/tungsten/pom.xml                           | 2 +-
 plugins/network-elements/vxlan/pom.xml                              | 2 +-
 plugins/outofbandmanagement-drivers/ipmitool/pom.xml                | 2 +-
 plugins/outofbandmanagement-drivers/nested-cloudstack/pom.xml       | 2 +-
 plugins/outofbandmanagement-drivers/redfish/pom.xml                 | 2 +-
 plugins/pom.xml                                                     | 2 +-
 plugins/storage-allocators/random/pom.xml                           | 2 +-
 plugins/storage/image/default/pom.xml                               | 2 +-
 plugins/storage/image/s3/pom.xml                                    | 2 +-
 plugins/storage/image/sample/pom.xml                                | 2 +-
 plugins/storage/image/swift/pom.xml                                 | 2 +-
 plugins/storage/object/ceph/pom.xml                                 | 2 +-
 plugins/storage/object/cloudian/pom.xml                             | 2 +-
 plugins/storage/object/minio/pom.xml                                | 2 +-
 plugins/storage/object/simulator/pom.xml                            | 2 +-
 plugins/storage/sharedfs/storagevm/pom.xml                          | 2 +-
 plugins/storage/volume/adaptive/pom.xml                             | 2 +-
 plugins/storage/volume/cloudbyte/pom.xml                            | 2 +-
 plugins/storage/volume/datera/pom.xml                               | 2 +-
 plugins/storage/volume/default/pom.xml                              | 2 +-
 plugins/storage/volume/flasharray/pom.xml                           | 2 +-
 plugins/storage/volume/linstor/pom.xml                              | 2 +-
 plugins/storage/volume/nexenta/pom.xml                              | 2 +-
 plugins/storage/volume/primera/pom.xml                              | 2 +-
 plugins/storage/volume/sample/pom.xml                               | 2 +-
 plugins/storage/volume/scaleio/pom.xml                              | 2 +-
 plugins/storage/volume/solidfire/pom.xml                            | 2 +-
 plugins/storage/volume/storpool/pom.xml                             | 2 +-
 plugins/user-authenticators/ldap/pom.xml                            | 2 +-
 plugins/user-authenticators/md5/pom.xml                             | 2 +-
 plugins/user-authenticators/oauth2/pom.xml                          | 2 +-
 plugins/user-authenticators/pbkdf2/pom.xml                          | 2 +-
 plugins/user-authenticators/plain-text/pom.xml                      | 2 +-
 plugins/user-authenticators/saml2/pom.xml                           | 2 +-
 plugins/user-authenticators/sha256salted/pom.xml                    | 2 +-
 plugins/user-two-factor-authenticators/static-pin/pom.xml           | 2 +-
 plugins/user-two-factor-authenticators/totp/pom.xml                 | 2 +-
 pom.xml                                                             | 2 +-
 quickcloud/pom.xml                                                  | 2 +-
 server/pom.xml                                                      | 4 ++--
 services/console-proxy/pom.xml                                      | 2 +-
 services/console-proxy/rdpconsole/pom.xml                           | 2 +-
 services/console-proxy/server/pom.xml                               | 2 +-
 services/pom.xml                                                    | 2 +-
 services/secondary-storage/controller/pom.xml                       | 2 +-
 services/secondary-storage/pom.xml                                  | 2 +-
 services/secondary-storage/server/pom.xml                           | 2 +-
 systemvm/pom.xml                                                    | 2 +-
 test/pom.xml                                                        | 2 +-
 tools/apidoc/pom.xml                                                | 2 +-
 tools/checkstyle/pom.xml                                            | 2 +-
 tools/devcloud-kvm/pom.xml                                          | 2 +-
 tools/devcloud4/pom.xml                                             | 2 +-
 tools/docker/Dockerfile                                             | 2 +-
 tools/docker/Dockerfile.marvin                                      | 4 ++--
 tools/marvin/pom.xml                                                | 2 +-
 tools/marvin/setup.py                                               | 2 +-
 tools/pom.xml                                                       | 2 +-
 usage/pom.xml                                                       | 2 +-
 utils/pom.xml                                                       | 2 +-
 vmware-base/pom.xml                                                 | 2 +-
 163 files changed, 166 insertions(+), 172 deletions(-)


(cloudstack) 01/01: CKS/CSI: fix PVC deletion script to avoid '(standard input)' and use kubectl -o name/jsonpath

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pearl11594 pushed a commit to branch delete-resources-tied-pvc
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit a20dd4483e149f7780d6731463d057f78ecf13fb
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Mon Nov 3 13:06:53 2025 -0500

    CKS/CSI: fix PVC deletion script to avoid '(standard input)' and use kubectl -o name/jsonpath
---
 .../script/delete-pv-reclaimpolicy-delete          | 82 ++++++++++++++--------
 1 file changed, 52 insertions(+), 30 deletions(-)

diff --git a/plugins/integrations/kubernetes-service/src/main/resources/script/delete-pv-reclaimpolicy-delete b/plugins/integrations/kubernetes-service/src/main/resources/script/delete-pv-reclaimpolicy-delete
index aac0cbf07e4..34e07e0bbe3 100755
--- a/plugins/integrations/kubernetes-service/src/main/resources/script/delete-pv-reclaimpolicy-delete
+++ b/plugins/integrations/kubernetes-service/src/main/resources/script/delete-pv-reclaimpolicy-delete
@@ -33,23 +33,33 @@ delete_workloads_using_pvc() {
     local deleted_count=0
 
     # Find & delete any deployment using the PVC
-    /opt/bin/kubectl get deployments -n "$namespace" -o json 2>/dev/null | grep -l "$pvc_name" | \
-    while IFS= read -r deployment; do
-        if [ -n "$deployment" ]; then
-            deployment_name=$(echo "$deployment" | cut -d'/' -f2)
-            echo "$(timestamp) -   Deleting Deployment: $deployment_name"
-            /opt/bin/kubectl delete deployment "$deployment_name" -n "$namespace" --ignore-not-found=true
+    # Iterate resource names and check the volumes via jsonpath to avoid grep -l on JSON (which prints "(standard input)")
+    /opt/bin/kubectl get deployments -n "$namespace" -o name 2>/dev/null | \
+    while IFS= read -r resource; do
+        if [ -z "$resource" ]; then
+            continue
+        fi
+        name=${resource#*/}
+        dep_volumes=$(/opt/bin/kubectl get deployment "$name" -n "$namespace" -o jsonpath='{.spec.template.spec.volumes[*].persistentVolumeClaim.claimName}' 2>/dev/null || echo "")
+        if [ -n "$dep_volumes" ] && echo "$dep_volumes" | grep -F -q "$pvc_name"; then
+            echo "$(timestamp) -   Deleting Deployment: $name"
+            /opt/bin/kubectl delete deployment "$name" -n "$namespace" --ignore-not-found=true
             deleted_count=$((deleted_count + 1))
         fi
     done
 
     # Find and delete any StatefulSet using the PVC
-    /opt/bin/kubectl get statefulsets -n "$namespace" -o json 2>/dev/null | grep -l "$pvc_name" | \
-    while IFS= read -r sts; do
-        if [ -n "$sts" ]; then
-            sts_name=$(echo "$sts" | cut -d'/' -f2)
-            echo "$(timestamp) -   Deleting StatefulSet: $sts_name"
-            /opt/bin/kubectl delete statefulset "$sts_name" -n "$namespace" --ignore-not-found=true
+    /opt/bin/kubectl get statefulsets -n "$namespace" -o name 2>/dev/null | \
+    while IFS= read -r resource; do
+        if [ -z "$resource" ]; then
+            continue
+        fi
+        name=${resource#*/}
+        # Check both template volumes and volumeClaimTemplates
+        sts_volumes=$(/opt/bin/kubectl get statefulset "$name" -n "$namespace" -o jsonpath='{.spec.template.spec.volumes[*].persistentVolumeClaim.claimName} {.spec.volumeClaimTemplates[*].metadata.name}' 2>/dev/null || echo "")
+        if [ -n "$sts_volumes" ] && echo "$sts_volumes" | grep -F -q "$pvc_name"; then
+            echo "$(timestamp) -   Deleting StatefulSet: $name"
+            /opt/bin/kubectl delete statefulset "$name" -n "$namespace" --ignore-not-found=true
             deleted_count=$((deleted_count + 1))
         fi
     done
@@ -71,34 +81,46 @@ delete_workloads_using_pvc() {
     done
 
     # Find and delete any DaemonSet using the PVC
-    /opt/bin/kubectl get daemonsets -n "$namespace" -o json 2>/dev/null | grep -l "$pvc_name" | \
-    while IFS= read -r ds; do
-        if [ -n "$ds" ]; then
-            ds_name=$(echo "$ds" | cut -d'/' -f2)
-            echo "$(timestamp) -   Deleting DaemonSet: $ds_name"
-            /opt/bin/kubectl delete daemonset "$ds_name" -n "$namespace" --ignore-not-found=true
+    /opt/bin/kubectl get daemonsets -n "$namespace" -o name 2>/dev/null | \
+    while IFS= read -r resource; do
+        if [ -z "$resource" ]; then
+            continue
+        fi
+        name=${resource#*/}
+        ds_volumes=$(/opt/bin/kubectl get daemonset "$name" -n "$namespace" -o jsonpath='{.spec.template.spec.volumes[*].persistentVolumeClaim.claimName}' 2>/dev/null || echo "")
+        if [ -n "$ds_volumes" ] && echo "$ds_volumes" | grep -F -q "$pvc_name"; then
+            echo "$(timestamp) -   Deleting DaemonSet: $name"
+            /opt/bin/kubectl delete daemonset "$name" -n "$namespace" --ignore-not-found=true
             deleted_count=$((deleted_count + 1))
         fi
     done
 
     # Find and delete any Job using the PVC
-    /opt/bin/kubectl get jobs -n "$namespace" -o json 2>/dev/null | grep -l "$pvc_name" | \
-    while IFS= read -r job; do
-        if [ -n "$job" ]; then
-            job_name=$(echo "$job" | cut -d'/' -f2)
-            echo "$(timestamp) -   Deleting Job: $job_name"
-            /opt/bin/kubectl delete job "$job_name" -n "$namespace" --ignore-not-found=true
+    /opt/bin/kubectl get jobs -n "$namespace" -o name 2>/dev/null | \
+    while IFS= read -r resource; do
+        if [ -z "$resource" ]; then
+            continue
+        fi
+        name=${resource#*/}
+        job_volumes=$(/opt/bin/kubectl get job "$name" -n "$namespace" -o jsonpath='{.spec.template.spec.volumes[*].persistentVolumeClaim.claimName}' 2>/dev/null || echo "")
+        if [ -n "$job_volumes" ] && echo "$job_volumes" | grep -F -q "$pvc_name"; then
+            echo "$(timestamp) -   Deleting Job: $name"
+            /opt/bin/kubectl delete job "$name" -n "$namespace" --ignore-not-found=true
             deleted_count=$((deleted_count + 1))
         fi
     done
 
     # Find and delete any CronJobs using the PVC
-    /opt/bin/kubectl get cronjobs -n "$namespace" -o json 2>/dev/null | grep -l "$pvc_name" | \
-    while IFS= read -r cronjob; do
-        if [ -n "$cronjob" ]; then
-            cronjob_name=$(echo "$cronjob" | cut -d'/' -f2)
-            echo "$(timestamp) -   Deleting CronJob: $cronjob_name"
-            /opt/bin/kubectl delete cronjob "$cronjob_name" -n "$namespace" --ignore-not-found=true
+    /opt/bin/kubectl get cronjobs -n "$namespace" -o name 2>/dev/null | \
+    while IFS= read -r resource; do
+        if [ -z "$resource" ]; then
+            continue
+        fi
+        name=${resource#*/}
+        cron_volumes=$(/opt/bin/kubectl get cronjob "$name" -n "$namespace" -o jsonpath='{.spec.jobTemplate.spec.template.spec.volumes[*].persistentVolumeClaim.claimName}' 2>/dev/null || echo "")
+        if [ -n "$cron_volumes" ] && echo "$cron_volumes" | grep -F -q "$pvc_name"; then
+            echo "$(timestamp) -   Deleting CronJob: $name"
+            /opt/bin/kubectl delete cronjob "$name" -n "$namespace" --ignore-not-found=true
             deleted_count=$((deleted_count + 1))
         fi
     done