Skip to content

Conversation

jeremyascott
Copy link
Contributor

@jeremyascott jeremyascott commented Mar 20, 2023

We have many StatefulSet workloads requiring the provisioner to create local volumes during provisioning. For several of these StatefulSets, we are unable to add the volumeType annotation which results in us having to use hostPath volumes which is unacceptable for us. Furthermore, it is tedious and error-prone to have to specify the volumeType annotation on every single PVC and would therefore prove useful to be able to specify a default volume type on the StorageClass.

I propose the addition of an annotation called defaultVolumeType on storage classes which will set the volume type for all volumes using that class. The annotation for the PVC can still be applied and will supersede the annotation on the storage class.

A basic example of a StorageClass with this annotation:

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

Copy link
Member

@derekbit derekbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, LGTM.

Suggest having a test case.

@jeremyascott jeremyascott requested a review from derekbit March 21, 2023 14:50
Copy link
Member

@derekbit derekbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Will test and merge it tomorrow.

@derekbit
Copy link
Member

@js185692
Thanks for your contribution.

@derekbit derekbit merged commit 2bf3316 into rancher:master Mar 22, 2023
@jeremyascott jeremyascott deleted the storage-class-default-volume-type branch March 28, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants