sergelogvinov / proxmox-csi-plugin

Proxmox CSI Plugin
Apache License 2.0
330 stars 28 forks source link

AllowedTopologies in storage class requires both region and zone #126

Closed camaeel closed 10 months ago

camaeel commented 10 months ago

Bug Report

Description

When I created a storage class with:

        allowedTopologies:
        - matchLabelExpressions:
          - key: topology.kubernetes.io/region
            values:
            - homelab-proxmox-1

Proxmox CSI controller can't create a PVC. When I add topology.kubernetes.io/zone label selector it works properly. I would like to be able to set only regions supported and not zones.

Logs

Controller: [kubectl logs -c proxmox-csi-plugin-controller proxmox-csi-plugin-controller-...]

proxmox-csi-controller-68d46bdf74-4t855 csi-provisioner I1228 23:07:29.866624       1 event.go:298] Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"test-proxmox-csi", Name:"test-pvc", UID:"86da7701-0705-49f2-be8b-d29eb46a223d", APIVersion:"v1", ResourceVersion:"3766286", FieldPath:""}): type: 'Normal' reason: 'Provisioning' External provisioner is provisioning volume for claim "test-proxmox-csi/test-pvc"
proxmox-csi-controller-68d46bdf74-4t855 proxmox-csi-controller I1228 23:07:29.866911       1 controller.go:81] CreateVolume: called with args {"accessibility_requirements":{"preferred":[{"segments":{"topology.kubernetes.io/region":"homelab-proxmox-1"}}],"requisite":[{"segments":{"topology.kubernetes.io/region":"homelab-proxmox-1"}}]},"capacity_range":{"required_bytes":1073741824},"name":"pvc-86da7701-0705-49f2-be8b-d29eb46a223d","parameters":{"cache":"none","ssd":"true","storage":"local-lvm"},"volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4","mount_flags":["discard"]}},"access_mode":{"mode":7}}]}
proxmox-csi-controller-68d46bdf74-4t855 proxmox-csi-controller E1228 23:07:29.867047       1 controller.go:126] CreateVolume: region or zone is empty: accessibleTopology=requisite:<segments:<key:"topology.kubernetes.io/region" value:"homelab-proxmox-1" > > preferred:<segments:<key:"topology.kubernetes.io/region" value:"homelab-proxmox-1" > >
proxmox-csi-controller-68d46bdf74-4t855 proxmox-csi-controller E1228 23:07:29.867092       1 main.go:75] GRPC error: rpc error: code = InvalidArgument desc = cannot find best region and zone

Node: [kubectl logs -c proxmox-csi-plugin-node proxmox-csi-plugin-node-...]

Environment

sergelogvinov commented 10 months ago

allowedTopologies in PV is immutable. You cannot change it, only recreate. The bast way to set region/zone is nodeSelector/affinity pod resource. Kubernetes scheduler will utilize both node capacity and CSI capacity to choose the best node.

I've introduce a basic logic to find the node, but repeate the scheduler would necessitate extensive code modifications.