add global values support #322

Merged
luhahn merged 1 commits from cnfatal/helm-chart:master into master 2022-06-09 10:55:09 +00:00
Contributor

add global values support for .global.storageClass .global.imageRegistry and .global.imagePullSecrets

add global values support for `.global.storageClass` `.global.imageRegistry` and `.global.imagePullSecrets`
cnfatal force-pushed master from a87ec8a163 to f3d10f14c4 2022-05-23 03:24:27 +00:00 Compare
Contributor

+1 for switching to readme-generator. Thanks for the effort. Would you mind splitting the two parts into different PRs? That would make a review much easier.

EDIT: Splitted into different PRs.

~~+1 for switching to readme-generator. Thanks for the effort. Would you mind splitting the two parts into different PRs? That would make a review much easier.~~ EDIT: Splitted into different PRs.
cnfatal force-pushed master from f3d10f14c4 to 3e4e94b075 2022-05-23 07:10:07 +00:00 Compare
justusbunsi added a new dependency 2022-05-27 10:32:58 +00:00
justusbunsi reviewed 2022-05-27 11:15:49 +00:00
justusbunsi left a comment
Contributor

Many thanks for your contribution. I've marked some minor things.

Many thanks for your contribution. I've marked some minor things.
@@ -35,10 +35,50 @@ Create chart name and version as used by the chart label.
Create image name and tag used by the deployment.
*/}}
{{- define "gitea.image" -}}
{{- $registry := .Values.image.registry -}}
Contributor

.Values.image.registry does not exist yet. Do you mind adding it to the values.yaml?

In addition, we could simplify the override of $registry here.

- {{- $registry := .Values.image.registry -}} + {{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}} 
`.Values.image.registry` does not exist yet. Do you mind adding it to the values.yaml? In addition, we could simplify the override of `$registry` here. ```diff - {{- $registry := .Values.image.registry -}} + {{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}} ```
Contributor

.Values.image.registry does not exist yet. Do you mind adding it to the values.yaml?

Nevermind that part. Saw that it's added in the readme generator PR. ?

> `.Values.image.registry` does not exist yet. Do you mind adding it to the values.yaml? Nevermind that part. Saw that it's added in the readme generator PR. ?
cnfatal marked this conversation as resolved
@@ -42,0 +68,4 @@
Return the proper Storage Class
*/}}
{{- define "gitea.persistence.storageClass" -}}
{{- $storageClass := .Values.persistence.storageClass -}}
Contributor

We could simplify the override of $storageClass.

- {{- $storageClass := .Values.persistence.storageClass -}} + {{- $storageClass := .Values.global.storageClass | default .Values.persistence.storageClass -}} 
We could simplify the override of `$storageClass`. ```diff - {{- $storageClass := .Values.persistence.storageClass -}} + {{- $storageClass := .Values.global.storageClass | default .Values.persistence.storageClass -}} ```
cnfatal marked this conversation as resolved
@@ -42,0 +73,4 @@
{{- $storageClass = .Values.global.storageClass -}}
{{- end -}}
{{- if $storageClass -}}
{{- if (eq "-" $storageClass) -}}
Contributor

Where does the - come from? Isn't the default value ""?

Where does the `-` come from? Isn't the default value `""`?
Author
Contributor

Ref from other charts (bitnami's) ,it says:

 ## @param persistence.storageClass PVC Storage Class for Cassandra data volume  ## If defined, storageClassName: <storageClass>  ## If set to "-", storageClassName: "", which disables dynamic provisioning  ## If undefined (the default) or set to null, no storageClassName spec is  ## set, choosing the default provisioner. (gp2 on AWS, standard on  ## GKE, AWS & OpenStack)  ##  storageClass: "" 
{{- if $storageClass -}} storageClassName: {{ $storageClass }} {{- end -}} 

The empty "" and null val not pass the if check, lead to a no storageClassName spec


But the usage of "-" is really few,I'll remove it.

Ref from other charts (bitnami's) ,it says: ```yaml ## @param persistence.storageClass PVC Storage Class for Cassandra data volume ## If defined, storageClassName: <storageClass> ## If set to "-", storageClassName: "", which disables dynamic provisioning ## If undefined (the default) or set to null, no storageClassName spec is ## set, choosing the default provisioner. (gp2 on AWS, standard on ## GKE, AWS & OpenStack) ## storageClass: "" ``` ```tpl {{- if $storageClass -}} storageClassName: {{ $storageClass }} {{- end -}} ``` The empty `""` and `null` val not pass the `if` check, lead to a `no storageClassName spec` --- But the usage of "-" is really few,I'll remove it.
cnfatal marked this conversation as resolved
justusbunsi added the
kind
feature
label 2022-05-27 11:17:43 +00:00
cnfatal force-pushed master from 3e4e94b075 to 96b27e6a8f 2022-05-31 02:57:55 +00:00 Compare
cnfatal force-pushed master from 96b27e6a8f to adcc7b974a 2022-05-31 03:07:53 +00:00 Compare
justusbunsi reviewed 2022-06-06 16:56:07 +00:00
@@ -42,0 +68,4 @@
{{- $storageClass := .Values.global.storageClass | default .Values.persistence.storageClass -}}
{{- if $storageClass -}}
storageClassName: {{ $storageClass }}
{{- end -}}
Contributor

@cnfatal Right now generating the template fails. It seems this function uses incorrect line wrap trimming. A working function declaration would be:

{{/* Storage Class */}} {{- define "gitea.persistence.storageClass" -}} {{- $storageClass := .Values.global.storageClass | default .Values.persistence.storageClass }} {{- if $storageClass }} storageClassName: {{ $storageClass | quote }} {{- end }} {{- end -}} 

And we should quote the storage class value (as done in the proposed fix). Just to be sure. :)

@cnfatal Right now generating the template fails. It seems this function uses incorrect line wrap trimming. A working function declaration would be: ``` {{/* Storage Class */}} {{- define "gitea.persistence.storageClass" -}} {{- $storageClass := .Values.global.storageClass | default .Values.persistence.storageClass }} {{- if $storageClass }} storageClassName: {{ $storageClass | quote }} {{- end }} {{- end -}} ``` And we should quote the storage class value (as done in the proposed fix). Just to be sure. :)
Author
Contributor

you're right

you're right
cnfatal marked this conversation as resolved
cnfatal force-pushed master from adcc7b974a to 048b5c480e 2022-06-09 02:26:32 +00:00 Compare
luhahn approved these changes 2022-06-09 10:52:00 +00:00
luhahn left a comment
Member

LGTM

LGTM
justusbunsi approved these changes 2022-06-09 10:54:16 +00:00
justusbunsi left a comment
Contributor

LGTM

LGTM
luhahn merged commit 9cb822f41c into master 2022-06-09 10:55:09 +00:00
Sign in to join this conversation.
No description provided.