The PhysicalCSINodeReconciler module implements synchronization functionality from physical cluster CSINodes to virtual cluster CSINodes. This module works in coordination with PhysicalNodeReconciler, ensuring that CSINode objects in the virtual cluster maintain lifecycle consistency with corresponding virtual nodes.
- Monitor CSINode object changes in physical clusters
- Automatically create, update, and delete corresponding CSINode objects in virtual clusters
- Maintain consistency with virtual node lifecycle
- Validate if virtual nodes exist
- Validate if virtual node labels match current physical cluster and node
- Ensure accuracy of CSINode synchronization
- Automatically add Kubeocean management labels
- Record synchronization time and physical cluster information
- Support secure deletion with UID validation
PhysicalNodeReconciler
↓ (reference)
PhysicalCSINodeReconciler
↓ (monitor)
Physical Cluster CSINode
↓ (synchronize)
Virtual Cluster CSINode
-
Creation Process
- PhysicalNodeReconciler creates virtual node
- Call PhysicalCSINodeReconciler.CreateVirtualCSINode()
- Check if physical CSINode exists
- Create virtual CSINode and add labels and annotations
-
Update Process
- Monitor physical CSINode changes
- Validate virtual node label matches
- Update virtual CSINode spec and annotations
-
Deletion Process
- PhysicalNodeReconciler deletes virtual node
- Call PhysicalCSINodeReconciler.DeleteVirtualCSINode()
- Validate if CSINode is managed by Kubeocean
- Securely delete virtual CSINode
kubeocean.io/managed-by: Identifies managed by Kubeoceankubeocean.io/cluster-binding: Cluster binding namekubeocean.io/physical-cluster-id: Physical cluster IDkubeocean.io/physical-node-name: Physical node name
Note: These label constants are defined in
api/v1beta1/constants.go, ensuring consistency throughout the project.
kubeocean.io/last-sync-time: Last synchronization timekubeocean.io/physical-cluster-name: Physical cluster namekubeocean.io/physical-csinode-uid: Physical CSINode UID
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeocean-csinode-controller
rules:
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]- Maximum concurrent reconciliations: 1
- Synchronization interval: 300 seconds
- Support graceful shutdown
- CSINode creation and deletion functionality
- Label and annotation building
- Virtual node label validation
- Coordinated work with PhysicalNodeReconciler
- Complete lifecycle management
- Error handling and recovery
When a CSINode exists in the physical cluster, the system automatically creates the corresponding virtual CSINode:
# Physical Cluster CSINode
apiVersion: storage.k8s.io/v1
kind: CSINode
metadata:
name: worker-node-1
spec:
drivers:
- name: csi-driver
nodeID: worker-node-1# Automatically Created Virtual CSINode
apiVersion: storage.k8s.io/v1
kind: CSINode
metadata:
name: vnode-worker-node-1
labels:
kubeocean.io/managed-by: kubeocean
kubeocean.io/cluster-binding: my-cluster
kubeocean.io/physical-cluster-id: cluster-1
kubeocean.io/physical-node-name: worker-node-1
annotations:
kubeocean.io/last-sync-time: "2025-08-22T10:41:06Z"
kubeocean.io/physical-cluster-name: my-cluster
kubeocean.io/physical-csinode-uid: "12345678-1234-1234-1234-123456789abc"
spec:
drivers:
- name: csi-driver
nodeID: worker-node-1-
Virtual CSINode Not Created
- Check if physical CSINode exists
- Validate if virtual node labels are correct
- Review controller logs
-
Synchronization Failure
- Check RBAC permissions
- Validate cluster binding configuration
- Confirm network connectivity is normal
-
Deletion Failure
- Check if CSINode is managed by Kubeocean
- Validate UID matches
- Review deletion permissions
INFO Creating virtual CSINode
INFO Successfully created virtual CSINode
INFO Virtual node validation failed
ERROR Failed to create virtual CSINode