rancher / local-path-provisioner

Dynamically provisioning persistent local storage with Kubernetes
Apache License 2.0
2.24k stars 453 forks source link

Node Affinity not set on v0.0.29 #454

Open msander opened 1 month ago

msander commented 1 month ago

I am using the local-path-provisioner with the volumeType "local". Since 0.0.29 I have the problem that the node affinity of the PV is not set. In 0.0.28 it worked correctly. I am using rke2 (1.30.4). The PV is created as follows:

root@vm1:~# kubectl describe pv pvc-8b95ded6-dbc9-4e6c-8b7b-531c62ba28b6
Name:              pvc-8b95ded6-dbc9-4e6c-8b7b-531c62ba28b6
Labels:            <none>
Annotations:       local.path.provisioner/selected-node: vm1
                   pv.kubernetes.io/provisioned-by: rancher.io/local-path
Finalizers:        [kubernetes.io/pv-protection]
StorageClass:      local-path
Status:            Bound
Claim:             default/cnpg-database-1
Reclaim Policy:    Delete
Access Modes:      RWO
VolumeMode:        Filesystem
Capacity:          10Gi
Node Affinity:     
  Required Terms:  
    Term 0:        <none>
Message:           
Source:
    Type:  LocalVolume (a persistent volume backed by local storage on a node)
    Path:  /opt/local-path-provisioner/pvc-8b95ded6-dbc9-4e6c-8b7b-531c62ba28b6_default_cnpg-database-1
Events:    <none>

When going back to 0.0.28, the node affinity gets set correctly.

This is my storage class

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-path
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
    defaultVolumeType: local
provisioner: rancher.io/local-path
volumeBindingMode: WaitForFirstConsumer

PVC

Name:          cnpg-database-1
Namespace:     default
StorageClass:  local-path
Status:        Bound
Volume:        pvc-8b95ded6-dbc9-4e6c-8b7b-531c62ba28b6
Labels:        cnpg.io/cluster=cnpg-database
               cnpg.io/instanceName=cnpg-database-1
               cnpg.io/pvcRole=PG_DATA
Annotations:   cnpg.io/nodeSerial: 1
               cnpg.io/operatorVersion: 1.24.0
               cnpg.io/pvcStatus: ready
               pv.kubernetes.io/bind-completed: yes
               pv.kubernetes.io/bound-by-controller: yes
               volume.beta.kubernetes.io/storage-provisioner: rancher.io/local-path
               volume.kubernetes.io/selected-node: vm1
               volume.kubernetes.io/storage-provisioner: rancher.io/local-path
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      10Gi
Access Modes:  RWO
VolumeMode:    Filesystem
Used By:       cnpg-database-1
               cnpg-database-1-initdb-rbpld
huangguoqiang commented 1 month ago

yes, i met same issue.

derekbit commented 1 month ago

Thanks for raising the issue. I will check and fix it soon.