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

feat: add support for parameters for storageClass #2434

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/cinder-csi-plugin/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: v1.28.0
description: Cinder CSI Chart for OpenStack
name: openstack-cinder-csi
version: 2.29.0-alpha.2
version: 2.29.0-alpha.3
home: https://github.com/kubernetes/cloud-provider-openstack
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
maintainers:
Expand Down
24 changes: 24 additions & 0 deletions charts/cinder-csi-plugin/templates/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ metadata:
{{- end }}
provisioner: cinder.csi.openstack.org
reclaimPolicy: Delete
{{ if .Values.storageClass.parameters.enabled }}
parameters:
{{ if .Values.storageClass.parameters.type }}
type: {{ .Values.storageClass.parameters.type }}
{{ end }}
{{ if .Values.storageClass.parameters.availabilityZone }}
availabilityZone: {{ .Values.storageClass.parameters.availabilityZone }}
{{ end }}
{{ range .Values.storageClass.parameters.additionalParameters }}
{{ .key }}: {{ .value }}
{{ end }}
{{ end }}
allowVolumeExpansion: {{ .Values.storageClass.delete.allowVolumeExpansion }}
---
apiVersion: storage.k8s.io/v1
Expand All @@ -21,5 +33,17 @@ metadata:
{{- end }}
provisioner: cinder.csi.openstack.org
reclaimPolicy: Retain
{{ if .Values.storageClass.parameters.enabled }}
parameters:
{{ if .Values.storageClass.parameters.type }}
type: {{ .Values.storageClass.parameters.type }}
{{ end }}
{{ if .Values.storageClass.parameters.availabilityZone }}
availabilityZone: {{ .Values.storageClass.parameters.availabilityZone }}
{{ end }}
{{ range .Values.storageClass.parameters.additionalParameters }}
{{ .key }}: {{ .value }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this will be properly indented? Could we do it like here instead?

{{- with .Values.nodeplugin.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}

Copy link
Contributor

Choose a reason for hiding this comment

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

@sakshi-1505: Seems like you've missed this one comment.

{{ end }}
{{ end }}
allowVolumeExpansion: {{ .Values.storageClass.retain.allowVolumeExpansion }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/cinder-csi-plugin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ secret:

storageClass:
enabled: true
parameters:
Copy link
Contributor

Choose a reason for hiding this comment

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

is this sample ? so should be comment out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really believe commenting our things in helm's values but always like to put each & every change behind a toggle to maintain backward compatibility. It's not a sample but actual values file, & I have kept all changed behind the storageClass.parameters.Enabled toggle, so this is a backward compatible change where folks if want can enable & by default it won't take effect.

enabled: false
# type: gp2
# availabilityZone: us-east-1a
# additionalParameters:
# volumeSize: 10Gi
delete:
isDefault: false
allowVolumeExpansion: true
Expand Down