From 22bfc9de3d518d640d4beea4c0296ba6ede4fb1d Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 7 Aug 2023 14:42:34 +0200 Subject: [PATCH 1/2] csi: add holder pods to the list to delete pod Add holder pods label to the list so that Rook can get all the pods on the failed node and force delete the pods stuck in terminating state. Signed-off-by: Madhu Rajanna --- pkg/operator/ceph/cluster/cephstatus.go | 3 +++ pkg/operator/ceph/cluster/cephstatus_test.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/cluster/cephstatus.go b/pkg/operator/ceph/cluster/cephstatus.go index 9cc8ae515..b2c0237e1 100644 --- a/pkg/operator/ceph/cluster/cephstatus.go +++ b/pkg/operator/ceph/cluster/cephstatus.go @@ -314,8 +314,11 @@ func (c *cephStatusChecker) getRookPodsOnNode(node string) ([]v1.Pod, error) { appLabels := []string{ "csi-rbdplugin-provisioner", "csi-rbdplugin", + "csi-rbdplugin-holder", + "csi-cephfsplugin-holder", "csi-cephfsplugin-provisioner", "csi-cephfsplugin", + "csi-nfsplugin-holder", "rook-ceph-operator", "rook-ceph-mon", "rook-ceph-osd", diff --git a/pkg/operator/ceph/cluster/cephstatus_test.go b/pkg/operator/ceph/cluster/cephstatus_test.go index 564f72316..8be6352af 100644 --- a/pkg/operator/ceph/cluster/cephstatus_test.go +++ b/pkg/operator/ceph/cluster/cephstatus_test.go @@ -326,8 +326,11 @@ func TestGetRookPodsOnNode(t *testing.T) { {"app": "rook-ceph-osd"}, {"app": "csi-rbdplugin-provisioner"}, {"app": "csi-rbdplugin"}, + {"app": "csi-rbdplugin-holder"}, {"app": "csi-cephfsplugin-provisioner"}, {"app": "csi-cephfsplugin"}, + {"app": "csi-cephfsplugin-holder"}, + {"app": "csi-nfsplugin-holder"}, {"app": "rook-ceph-operator"}, {"app": "rook-ceph-crashcollector"}, {"app": "rook-ceph-mgr"}, @@ -363,7 +366,7 @@ func TestGetRookPodsOnNode(t *testing.T) { pods, err := c.getRookPodsOnNode("node0") assert.NoError(t, err) // A pod is having two matching labels and its returned only once - assert.Equal(t, 12, len(pods)) + assert.Equal(t, 15, len(pods)) podNames := []string{} for _, pod := range pods { From 29faca9032a72bed543cb442a2665c9458627c6a Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 7 Aug 2023 14:47:42 +0200 Subject: [PATCH 2/2] csi: add nfs pods to the list to delete pod Add nfs pods label to the list so that Rook can get all the pods on the failed node and force delete the pods stuck in terminating state. Signed-off-by: Madhu Rajanna --- pkg/operator/ceph/cluster/cephstatus.go | 2 ++ pkg/operator/ceph/cluster/cephstatus_test.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/cluster/cephstatus.go b/pkg/operator/ceph/cluster/cephstatus.go index b2c0237e1..249054148 100644 --- a/pkg/operator/ceph/cluster/cephstatus.go +++ b/pkg/operator/ceph/cluster/cephstatus.go @@ -319,6 +319,8 @@ func (c *cephStatusChecker) getRookPodsOnNode(node string) ([]v1.Pod, error) { "csi-cephfsplugin-provisioner", "csi-cephfsplugin", "csi-nfsplugin-holder", + "csi-nfsplugin-provisioner", + "csi-nfsplugin", "rook-ceph-operator", "rook-ceph-mon", "rook-ceph-osd", diff --git a/pkg/operator/ceph/cluster/cephstatus_test.go b/pkg/operator/ceph/cluster/cephstatus_test.go index 8be6352af..1dc01a67b 100644 --- a/pkg/operator/ceph/cluster/cephstatus_test.go +++ b/pkg/operator/ceph/cluster/cephstatus_test.go @@ -330,6 +330,8 @@ func TestGetRookPodsOnNode(t *testing.T) { {"app": "csi-cephfsplugin-provisioner"}, {"app": "csi-cephfsplugin"}, {"app": "csi-cephfsplugin-holder"}, + {"app": "csi-nfsplugin-provisioner"}, + {"app": "csi-nfsplugin"}, {"app": "csi-nfsplugin-holder"}, {"app": "rook-ceph-operator"}, {"app": "rook-ceph-crashcollector"}, @@ -366,7 +368,7 @@ func TestGetRookPodsOnNode(t *testing.T) { pods, err := c.getRookPodsOnNode("node0") assert.NoError(t, err) // A pod is having two matching labels and its returned only once - assert.Equal(t, 15, len(pods)) + assert.Equal(t, 17, len(pods)) podNames := []string{} for _, pod := range pods {