Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csiaddonsNode: Recreate CSIAddonsNode with active sidecar(s) #765

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

black-dragon74
Copy link
Member

@black-dragon74 black-dragon74 commented Feb 13, 2025

This patch adds a watcher to csi-addons sidecar which is responsible for re-creating CSIAddonNode(s) in case they
are deleted manually.

Fixes: #762

@black-dragon74
Copy link
Member Author

black-dragon74 commented Feb 13, 2025

Logs from testing


// Delete CephFS CSIAddonsNode
❯ oc delete csiaddonsnode/minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner
csiaddonsnode.csiaddons.openshift.io "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner" deleted

///
// Logs
//

// CephFS sidecar
...
2025-02-14T10:35:38.438Z        INFO    Starting watcher for CSIAddonsNode: minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner
2025-02-14T10:37:31.852Z        INFO    WARNING: An active CSIAddonsNode: minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner was deleted, it will be recreated
2025-02-14T10:37:31.895Z        INFO    CSIAddonsNode: minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner recreated
...

// CSI Addons controller
...
2025-02-14T10:37:31.835Z        INFO    Deleting connection     {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "897863db-e488-4c14-a71f-0526cfcab4a2", "NodeID": "minikube", "DriverName": "rook-ceph.cephfs.csi.ceph.com", "EndPoint": "10.244.0.20:9070", "Key": "rook-ceph/csi-cephfsplugin-provisioner-6fff6848bf-hg4nm"}
2025-02-14T10:37:31.836Z        INFO    Removing finalizer      {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "897863db-e488-4c14-a71f-0526cfcab4a2", "NodeID": "minikube", "DriverName": "rook-ceph.cephfs.csi.ceph.com", "EndPoint": "10.244.0.20:9070"}
2025-02-14T10:37:31.852Z        INFO    CSIAddonsNode resource not found        {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "fe82a4bc-4adc-46c0-bab2-f4674210c6db"}
2025-02-14T10:37:31.893Z        INFO    Adding finalizer        {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "c1232f97-9b1b-414b-ab0b-867e14918f6c", "NodeID": "minikube", "DriverName": "rook-ceph.cephfs.csi.ceph.com", "EndPoint": "10.244.0.20:9070"}
2025-02-14T10:37:31.904Z        INFO    Connecting to sidecar   {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "c1232f97-9b1b-414b-ab0b-867e14918f6c", "NodeID": "minikube", "DriverName": "rook-ceph.cephfs.csi.ceph.com", "EndPoint": "10.244.0.20:9070"}
2025-02-14T10:37:31.918Z        INFO    No networkfenceclasses found in annotation      {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "c1232f97-9b1b-414b-ab0b-867e14918f6c", "NodeID": "minikube", "DriverName": "rook-ceph.cephfs.csi.ceph.com", "EndPoint": "10.244.0.20:9070"}
2025-02-14T10:37:31.918Z        INFO    Successfully connected to sidecar       {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "c1232f97-9b1b-414b-ab0b-867e14918f6c", "NodeID": "minikube", "DriverName": "rook-ceph.cephfs.csi.ceph.com", "EndPoint": "10.244.0.20:9070"}
2025-02-14T10:37:31.918Z        INFO    Added connection to connection pool     {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner", "reconcileID": "c1232f97-9b1b-414b-ab0b-867e14918f6c", "NodeID": "minikube", "DriverName": "rook-ceph.cephfs.csi.ceph.com", "EndPoint": "10.244.0.20:9070", "Key": "rook-ceph/csi-cephfsplugin-provisioner-6fff6848bf-hg4nm"}
...

#########################################################################

// Delete RBD CSIAddonsNode
❯ oc delete csiaddonsnode/minikube-rook-ceph-deployment-csi-rbdplugin-provisioner
csiaddonsnode.csiaddons.openshift.io "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner" deleted

//
// Logs
//

// RBD Sidecar
...
2025-02-14T10:35:40.473Z        INFO    Starting watcher for CSIAddonsNode: minikube-rook-ceph-deployment-csi-rbdplugin-provisioner
2025-02-14T10:37:38.026Z        INFO    WARNING: An active CSIAddonsNode: minikube-rook-ceph-deployment-csi-rbdplugin-provisioner was deleted, it will be recreated
2025-02-14T10:37:38.051Z        INFO    CSIAddonsNode: minikube-rook-ceph-deployment-csi-rbdplugin-provisioner recreated
...

// CSI Addons controller
...
2025-02-14T10:37:38.013Z        INFO    Deleting connection     {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "66037391-e262-4a69-89ac-3b18c2ec404e", "NodeID": "minikube", "DriverName": "rook-ceph.rbd.csi.ceph.com", "EndPoint": "10.244.0.19:9070", "Key": "rook-ceph/csi-rbdplugin-provisioner-57d7d9fc45-2s7fv"}
2025-02-14T10:37:38.013Z        INFO    Removing finalizer      {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "66037391-e262-4a69-89ac-3b18c2ec404e", "NodeID": "minikube", "DriverName": "rook-ceph.rbd.csi.ceph.com", "EndPoint": "10.244.0.19:9070"}
2025-02-14T10:37:38.026Z        INFO    CSIAddonsNode resource not found        {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "aa6ee9a0-3b7f-43e9-b682-2af18640355c"}
2025-02-14T10:37:38.052Z        INFO    Adding finalizer        {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "94336eb0-51ec-47d9-9c69-6fe4afd5fb63", "NodeID": "minikube", "DriverName": "rook-ceph.rbd.csi.ceph.com", "EndPoint": "10.244.0.19:9070"}
2025-02-14T10:37:38.061Z        INFO    Connecting to sidecar   {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "94336eb0-51ec-47d9-9c69-6fe4afd5fb63", "NodeID": "minikube", "DriverName": "rook-ceph.rbd.csi.ceph.com", "EndPoint": "10.244.0.19:9070"}
2025-02-14T10:37:38.073Z        INFO    No networkfenceclasses found in annotation      {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "94336eb0-51ec-47d9-9c69-6fe4afd5fb63", "NodeID": "minikube", "DriverName": "rook-ceph.rbd.csi.ceph.com", "EndPoint": "10.244.0.19:9070"}
2025-02-14T10:37:38.073Z        INFO    Successfully connected to sidecar       {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "94336eb0-51ec-47d9-9c69-6fe4afd5fb63", "NodeID": "minikube", "DriverName": "rook-ceph.rbd.csi.ceph.com", "EndPoint": "10.244.0.19:9070"}
2025-02-14T10:37:38.073Z        INFO    Added connection to connection pool     {"controller": "csiaddonsnode", "controllerGroup": "csiaddons.openshift.io", "controllerKind": "CSIAddonsNode", "CSIAddonsNode": {"name":"minikube-rook-ceph-deployment-csi-rbdplugin-provisioner","namespace":"rook-ceph"}, "namespace": "rook-ceph", "name": "minikube-rook-ceph-deployment-csi-rbdplugin-provisioner", "reconcileID": "94336eb0-51ec-47d9-9c69-6fe4afd5fb63", "NodeID": "minikube", "DriverName": "rook-ceph.rbd.csi.ceph.com", "EndPoint": "10.244.0.19:9070", "Key": "rook-ceph/csi-rbdplugin-provisioner-57d7d9fc45-2s7fv"}
...

#########################################################################

// Check if resources are recreated (name and age)
❯ oc get csiaddonsnode
NAME                                                         NAMESPACE   AGE   DRIVERNAME                      ENDPOINT                                                             NODEID
minikube-rook-ceph-deployment-csi-cephfsplugin-provisioner   rook-ceph   12s   rook-ceph.cephfs.csi.ceph.com   pod://csi-cephfsplugin-provisioner-6fff6848bf-hg4nm.rook-ceph:9070   minikube
minikube-rook-ceph-deployment-csi-rbdplugin-provisioner      rook-ceph   5s    rook-ceph.rbd.csi.ceph.com      pod://csi-rbdplugin-provisioner-57d7d9fc45-2s7fv.rook-ceph:9070      minikube

@Madhu-1
Copy link
Member

Madhu-1 commented Feb 13, 2025

The reconciler should not be creating the CR, it should be done by the sidecar which is creating it earlier, watch for delete event and recreate it from the sidecar.

Copy link
Collaborator

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reconciler should not be creating the CR, it should be done by the sidecar which is creating it earlier, watch for delete event and recreate it from the sidecar.

Indeed, the sidecar creates the initial CSIAddonsNode, and so should it re-create one if it was deleted (and report a big warning about the unexpected deletion of it).

@black-dragon74 black-dragon74 force-pushed the node-recreate branch 2 times, most recently from 194fa16 to e46f08a Compare February 14, 2025 10:44
@black-dragon74 black-dragon74 changed the title csiaddonsNode: Recreate if an active sidecar connection is found csiaddonsNode: Recreate CSIAddonsNode with active sidecar(s) Feb 14, 2025
@black-dragon74 black-dragon74 force-pushed the node-recreate branch 5 times, most recently from bf41ace to 35e0993 Compare February 14, 2025 13:32
Copy link
Collaborator

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2nd commit is not related to the actual issue reported, it is cleaner to split it out.

@black-dragon74
Copy link
Member Author

The 2nd commit is not related to the actual issue reported, it is cleaner to split it out.

Done at #770

@black-dragon74 black-dragon74 force-pushed the node-recreate branch 2 times, most recently from ab56f47 to 957b289 Compare February 17, 2025 08:52
Copy link
Member

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit, LGTM

Copy link
Member

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope it been tested by restarting the pod many times in a loop and also deleting the CR manually in a loop

black-dragon74 added a commit to black-dragon74/ceph-csi-operator that referenced this pull request Feb 17, 2025
This patch adds `watch` and `list` verbs for CSIAddonsNode objects.

These permissions are required by the csi-addons sidecar.
Ref: csi-addons/kubernetes-csi-addons#765

Signed-off-by: Niraj Yadav <[email protected]>
@Madhu-1 Madhu-1 requested a review from nixpanic February 17, 2025 09:44
black-dragon74 added a commit to black-dragon74/ceph-csi-operator that referenced this pull request Feb 17, 2025
This patch adds `watch` and `list` verbs for CSIAddonsNode objects.

These permissions are required by the csi-addons sidecar.
Ref: csi-addons/kubernetes-csi-addons#765

Signed-off-by: Niraj Yadav <[email protected]>
Copy link

mergify bot commented Feb 17, 2025

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@Madhu-1
Copy link
Member

Madhu-1 commented Feb 17, 2025

@Mergifyio requeue

Copy link

mergify bot commented Feb 17, 2025

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

This patch adds a watcher to csi-addons sidecar which is
responsible for re-creating CSIAddonNode(s) in case they
are deleted manually.

Signed-off-by: Niraj Yadav <[email protected]>
@mergify mergify bot merged commit 4cdbe23 into csi-addons:main Feb 17, 2025
15 checks passed
Madhu-1 pushed a commit to Madhu-1/ceph-csi-operator that referenced this pull request Feb 18, 2025
This patch adds `watch` and `list` verbs for CSIAddonsNode objects.

These permissions are required by the csi-addons sidecar.
Ref: csi-addons/kubernetes-csi-addons#765

Signed-off-by: Niraj Yadav <[email protected]>
(cherry picked from commit a0d2dc6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sideeffect on csiaddonsnode object deletion
3 participants