openebs / dynamic-localpv-provisioner

Dynamically deploy Stateful Persistent Node-Local Volumes & Filesystems for Kubernetes that is provisioned from simple Local-Hostpath /root storage.
https://openebs.io
Apache License 2.0
138 stars 62 forks source link

When docker overlay2.size is enabled, the actual size of the pvc request is always the overlay2.size setting size #176

Open wutz opened 6 months ago

wutz commented 6 months ago

Describe the bug: Always docker overlay2.size and not pvc request size.

Expected behaviour: The actual size should be the pvc request size.

Steps to reproduce the bug:

  1. openebs localpv and docker in same xfs with prjquota enabled

  2. enable overlay.size in docker daemon config

    cat /etc/docker/daemon.json
    {
    "storage-driver": "overlay2",
      "storage-opts": [
          "overlay2.size=10GB"
      ]
    }
  3. deploy a pod and pvc with size equal 5 GB

The output of the following commands will help us better understand what's going on:

Anything else we need to know?: Add any other context about the problem here.

Environment details:

wutz commented 6 months ago

I notice that overwriting hostpathClass.name from openebs-hostpath to local-ssd will trigger this problem, as described in helm chart values. You must redeploy openebs without modifying hostpathClass.name to work properly

wutz commented 6 months ago

I should have followed the tutorial to create a new storageClass instead of renaming openebs-hostpath

wutz commented 6 months ago

The use of quota on the worker node is set correctly, but setting quota on the master node is still equivalent to docker overlay.size

The master and the worker nodes with different, the master node has taint node-role.kubernetes.io/control-plane:NoSchedule and docker overlay.size is 30GB

Create a size 50GB pvc, the localpv logs:

I0330 09:27:25.421180       1 controller.go:1366] provision "default/localpv-vol" class "openebs-hostpath": started
I0330 09:27:25.427411       1 event.go:285] Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"default", Name:"localpv-vol", UID:"d6b4589f-1c60-449f-9a62-dba6849d09a7", APIVersion:"v1", ResourceVersion:"11873609", FieldPath:""}): type: 'Normal' reason: 'Provisioning' External provisioner is provisioning volume for claim "default/localpv-vol"
I0330 09:27:25.429837       1 provisioner_hostpath.go:77] Creating volume pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7 at node with labels {map[kubernetes.io/hostname:mn03.zw1.local]}, path:/var/openebs/local/pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7,ImagePullSecrets:[]
2024-03-30T09:27:31.477Z    INFO    app/provisioner_hostpath.go:131     {"eventcode": "local.pv.quota.success", "msg": "Successfully applied quota", "rname": "pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7", "storagetype": "hostpath"}
2024-03-30T09:27:31.478Z    INFO    app/provisioner_hostpath.go:215     {"eventcode": "local.pv.provision.success", "msg": "Successfully provisioned Local PV", "rname": "pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7", "storagetype": "hostpath"}
I0330 09:27:31.478134       1 controller.go:1449] provision "default/localpv-vol" class "openebs-hostpath": volume "pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7" provisioned
I0330 09:27:31.478150       1 controller.go:1462] provision "default/localpv-vol" class "openebs-hostpath": succeeded
I0330 09:27:31.478162       1 volume_store.go:212] Trying to save persistentvolume "pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7"
I0330 09:27:31.481748       1 volume_store.go:219] persistentvolume "pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7" saved
I0330 09:27:31.481862       1 event.go:285] Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"default", Name:"localpv-vol", UID:"d6b4589f-1c60-449f-9a62-dba6849d09a7", APIVersion:"v1", ResourceVersion:"11873609", FieldPath:""}): type: 'Normal' reason: 'ProvisioningSucceeded' Successfully provisioned volume pvc-d6b4589f-1c60-449f-9a62-dba6849d09a7
wutz commented 6 months ago

https://github.com/openebs/dynamic-localpv-provisioner/blob/2f165df9e37cd60ec88772d20e0acd2b655a347c/cmd/provisioner-localpv/app/helper_hostpath.go#L292-L293

Generating a project id based on the above code may cause docker to compete for concurrency