You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
distinguish unset and empty values for storageClassName #2600
In a Kubernetes 1.6 PVC, storageClassName has different behaviour when passed an empty string versus not specified. An empty string means disable dynamic provisioning, not specified means use the default provisioner.
Charts should enable this behaviour, but I can't figure out how to make it happen using the go template syntax. go template's if treats the empty string as falsy, and everything i try to use to distinguish an empty string either works the same on an undefined value (len), or crashes (eq nil).
Perhaps this is why Hugo added the 'isset' function. Something like this would likely work if we had isset:
{{- if (isset .Values.alertmanager.persistentVolume "storageClass") }}
storageClassName: "{{ .Values.alertmanager.persistentVolume.storageClass }}"
{{- end }}
Is there any way to do this? If not can we pull in Hugo's isset or some other way to do it?
While I agree that isset is a nicer solution, one workaround to consider is to honor a sentinel storage class name that's invalid. A valid name must be a DNS subdomain. Following that down into kubernetes/apimachinery, we find the governing regular expression, which is a lowercase letter or digit, followed by any number of lowercase letters, digits, or hyphens, followed by a lowercase letter or digit. In other words, hyphens are only allowed in the middle. Hence, the following are invalid storage class names:
-default
default-
!default
You can imagine many more. What if you chose one of them and said that that's the value an release uses to choose the default provisioner?
That's a very reasonable solution for my own charts, but it's fairly hacky to get adopted as the right way to do things for public charts. I'll try a PR for the prometheus chart using:
{{- if .Values.alertmanager.persistentVolume.storageClass }}
{{- if (eq "-" .Values.alertmanager.persistentVolume.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.alertmanager.persistentVolume.storageClass }}"
{{- end }}
{{- end }}
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale
Activity
seh commentedon Jun 21, 2017
While I agree that
issetis a nicer solution, one workaround to consider is to honor a sentinel storage class name that's invalid. A valid name must be a DNS subdomain. Following that down into kubernetes/apimachinery, we find the governing regular expression, which is a lowercase letter or digit, followed by any number of lowercase letters, digits, or hyphens, followed by a lowercase letter or digit. In other words, hyphens are only allowed in the middle. Hence, the following are invalid storage class names:You can imagine many more. What if you chose one of them and said that that's the value an release uses to choose the default provisioner?
bryanlarsen commentedon Jun 21, 2017
That's a very reasonable solution for my own charts, but it's fairly hacky to get adopted as the right way to do things for public charts. I'll try a PR for the prometheus chart using:
seh commentedon Jun 21, 2017
Yes, Bryan, I wasn't trying to knock your proposed enhancement. I was just trying to help you make progress in the meantime.
thomastaylor312 commentedon Jun 23, 2017
Thanks for the request here @bryanlarsen. I'll tag it as a feature. If you wanted to submit something for this, please let us know!
prometheus: switch to Kubernetes 1.6 storage class specification
prometheus: switch to Kubernetes 1.6 storage class specification (#1332)
technosophos commentedon Sep 7, 2017
A PR on Sprig would be the best way to do this. I'll be rolling a new Sprig release for the upcoming Helm update.
fejta-bot commentedon Jan 4, 2018
Issues go stale after 90d of inactivity.
Mark the issue as fresh with
/remove-lifecycle stale.Stale issues rot after an additional 30d of inactivity and eventually close.
Prevent issues from auto-closing with an
/lifecycle frozencomment.If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or
@fejta./lifecycle stale
thomastaylor312 commentedon Jan 9, 2018
/remove-lifecycle stale
fejta-bot commentedon Apr 9, 2018
Issues go stale after 90d of inactivity.
Mark the issue as fresh with
/remove-lifecycle stale.Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
fejta-bot commentedon May 9, 2018
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with
/remove-lifecycle rotten.Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale
fejta-bot commentedon Jun 8, 2018
Rotten issues close after 30d of inactivity.
Reopen the issue with
/reopen.Mark the issue as fresh with
/remove-lifecycle rotten.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
Use by default the default storage class for PVCs (#58)
prometheus: switch to Kubernetes 1.6 storage class specification (#1332)
prometheus: switch to Kubernetes 1.6 storage class specification (#1332)
prometheus: switch to Kubernetes 1.6 storage class specification (#1332)