Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default volume type in storage class #311

Merged
merged 8 commits into from
Mar 22, 2023

Conversation

js185692
Copy link
Contributor

@js185692 js185692 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.

provisioner.go Outdated Show resolved Hide resolved
@js185692 js185692 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
@js185692 js185692 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