Skip to content

Enhancement request: node selection based on node labels #523

@Xnyle

Description

@Xnyle

Use case is as follows:

I have X nodes, some have ssd other hdd, created two storage classes fastStorage and slowStorage.
Also created nodeLabes haveSsd / haveHdd.

Currently I could manually configure every node in local path provisioner config to only have a path available that corresponds to the right storage class.

So how this would then work (to my current understanding) is

  • k8s selects a node
  • lpp cant find matching path definition for storage class and removes selected-node-annotation
  • k8s selects another node
  • ipp finally can provision

Ok workflow seems weird but ok, only problem is for this to work I would have to define storage class relations for every node manually in the lpp config. And the nodeLabes are useless.

So I looked into the code and to my understanding its all already there within 5 lines of code to make this work better?

Inside provisionClaimOperation around "reschedule and remove volume.kubernetes.io/selected-node annotation" is everything in order to process node labels?

Suggestion

One could add StorageClass.parameters.mustHaveNodeLabel = haveSsd.

And then the provisioner would just have to check if mustHaveNodeLabel is set and selectedNode.metadata.labels contains claim.storageClass.parameters.mustHaveNodeLabel right after selectedNode has been defied. If there is no match it would then do the same as on error below, remove selected-node annotation.

I was about to create a PR but my go knowledge is basically nonexistent, also I have no idea how to toolchain a test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions