Drop kebab-case configuration notation (#196)

Currently there are two different styles for defining both ldap and oauth configuration in _values.yaml_ file: `camelCase` and `kebab-case`.
Supporting both styles created multiple regressions in the past.

⚠️ BREAKING ⚠️
---------------
These changes completely remove any support for `kebab-case` notation in _values.yaml_ in favor of `camelCase`. Configuration keys must use `camelCase`.
Only exception are Kubernetes resource keys for annotations or labels.

Fixes: #188

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/196
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: justusbunsi <justusbunsi@noreply.gitea.io>
Co-committed-by: justusbunsi <justusbunsi@noreply.gitea.io>
This commit is contained in:
justusbunsi 2021-07-06 13:28:13 +08:00 committed by Lunny Xiao
parent 767a073a0a
commit 7de326d931
3 changed files with 16 additions and 57 deletions

View File

@ -314,9 +314,6 @@ gitea:
Like the admin user the LDAP settings can be updated, but also disabled or deleted. Like the admin user the LDAP settings can be updated, but also disabled or deleted.
All LDAP values from <https://docs.gitea.io/en-us/command-line/#admin> are available. All LDAP values from <https://docs.gitea.io/en-us/command-line/#admin> are available.
You can either use them in camel case or kebab case.
camelCase:
```yaml ```yaml
gitea: gitea:
@ -336,25 +333,6 @@ camelCase:
sshPublicKeyAttribute: sshPublicKey sshPublicKeyAttribute: sshPublicKey
``` ```
kebab-case:
```yaml
gitea:
ldap:
enabled: true
name: 'MyAwesomeGiteaLdap'
security-protocol: unencrypted
host: "127.0.0.1"
port: "389"
user-search-base: ou=Users,dc=example,dc=com
user-filter: sAMAccountName=%s
admin-filter: CN=Admin,CN=Group,DC=example,DC=com
email-attribute: mail
bind-dn: CN=ldap read,OU=Spezial,DC=example,DC=com
bind-password: JustAnotherBindPw
username-attribute: CN
```
You can also use an existing secret to set the bindDn and bindPassword: You can also use an existing secret to set the bindDn and bindPassword:
```yaml ```yaml
@ -376,19 +354,16 @@ gitea:
:warning: Some options are just flags and therefore don't any values. If they are defined in `gitea.ldap` configuration, they will be passed to the gitea cli without any value. Affected options: :warning: Some options are just flags and therefore don't any values. If they are defined in `gitea.ldap` configuration, they will be passed to the gitea cli without any value. Affected options:
- notActive | not-active - notActive
- skipTlsVerify | skip-tls-verify - skipTlsVerify
- allowDeactivateAll | allow-deactivate-all - allowDeactivateAll
- synchronizeUsers | synchronize-users - synchronizeUsers
- attributesInBind | attributes-in-bind - attributesInBind
### OAuth2 Settings ### OAuth2 Settings
Like the admin user, OAuth2 settings can be updated and disabled but not deleted. Deleting OAuth2 settings has to be done in the ui. Like the admin user, OAuth2 settings can be updated and disabled but not deleted. Deleting OAuth2 settings has to be done in the ui.
All OAuth2 values from <https://docs.gitea.io/en-us/command-line/#admin> are available. All OAuth2 values from <https://docs.gitea.io/en-us/command-line/#admin> are available.
You can either use them in camel case or kebab case.
camelCase:
```yaml ```yaml
gitea: gitea:
@ -406,24 +381,6 @@ camelCase:
#customEmailUrl: #customEmailUrl:
``` ```
kebab-case:
```yaml
gitea:
oauth:
enabled: true
name: 'MyAwesomeGiteaOAuth'
provider: 'openidConnect'
key: 'hello'
secret: 'world'
auto-discover-url: 'https://gitea.example.com/.well-known/openid-configuration'
#use-custom-urls:
#custom-auth-url:
#custom-token-url:
#custom-profile-url:
#custom-email-url:
```
### Metrics and profiling ### Metrics and profiling
A Prometheus `/metrics` endpoint on the `HTTP_PORT` and `pprof` profiling endpoints on port 6060 can be enabled under `gitea`. Beware that the metrics endpoint is exposed via the ingress, manage access using ingress annotations for example. A Prometheus `/metrics` endpoint on the `HTTP_PORT` and `pprof` profiling endpoints on port 6060 can be enabled under `gitea`. Beware that the metrics endpoint is exposed via the ingress, manage access using ingress annotations for example.

View File

@ -108,24 +108,24 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end -}}
{{- define "gitea.ldap_settings" -}} {{- define "gitea.ldap_settings" -}}
{{- if and (not (hasKey .Values.gitea.ldap "bindDn")) (not (hasKey .Values.gitea.ldap "bind-dn")) -}} {{- if not (hasKey .Values.gitea.ldap "bindDn") -}}
{{- $_ := set .Values.gitea.ldap "bindDn" "" -}} {{- $_ := set .Values.gitea.ldap "bindDn" "" -}}
{{- end -}} {{- end -}}
{{- if and (not (hasKey .Values.gitea.ldap "bindPassword")) (not (hasKey .Values.gitea.ldap "bind-password")) -}} {{- if not (hasKey .Values.gitea.ldap "bindPassword") -}}
{{- $_ := set .Values.gitea.ldap "bindPassword" "" -}} {{- $_ := set .Values.gitea.ldap "bindPassword" "" -}}
{{- end -}} {{- end -}}
{{- $flags := list "not-active" "skip-tls-verify" "allow-deactivate-all" "synchronize-users" "attributes-in-bind" -}} {{- $flags := list "notActive" "skipTlsVerify" "allowDeactivateAll" "synchronizeUsers" "attributesInBind" -}}
{{- range $key, $val := .Values.gitea.ldap -}} {{- range $key, $val := .Values.gitea.ldap -}}
{{- if and (ne $key "enabled") (ne $key "existingSecret") -}} {{- if and (ne $key "enabled") (ne $key "existingSecret") -}}
{{- if eq ($key | kebabcase) "bind-dn" -}} {{- if eq $key "bindDn" -}}
{{- printf "--%s %s " ($key | kebabcase) ("${GITEA_LDAP_BIND_DN}" | quote ) -}} {{- printf "--%s %s " ($key | kebabcase) ("${GITEA_LDAP_BIND_DN}" | quote ) -}}
{{- else if eq ($key | kebabcase) "bind-password" -}} {{- else if eq $key "bindPassword" -}}
{{- printf "--%s %s " ($key | kebabcase) ("${GITEA_LDAP_PASSWORD}" | quote ) -}} {{- printf "--%s %s " ($key | kebabcase) ("${GITEA_LDAP_PASSWORD}" | quote ) -}}
{{- else if eq $key "port" -}} {{- else if eq $key "port" -}}
{{- printf "--%s %d " ($key | kebabcase) ($val | int) -}} {{- printf "--%s %d " $key ($val | int) -}}
{{- else if (has ($key | kebabcase) $flags) -}} {{- else if has $key $flags -}}
{{- printf "--%s " ($key | kebabcase) -}} {{- printf "--%s " ($key | kebabcase) -}}
{{- else -}} {{- else -}}
{{- printf "--%s %s " ($key | kebabcase) ($val | squote) -}} {{- printf "--%s %s " ($key | kebabcase) ($val | squote) -}}

View File

@ -79,6 +79,7 @@ spec:
value: /data value: /data
- name: GITEA_TEMP - name: GITEA_TEMP
value: /tmp/gitea value: /tmp/gitea
{{- if .Values.gitea.ldap.enabled }}
{{- if .Values.gitea.ldap.existingSecret }} {{- if .Values.gitea.ldap.existingSecret }}
- name: GITEA_LDAP_BIND_DN - name: GITEA_LDAP_BIND_DN
valueFrom: valueFrom:
@ -92,9 +93,10 @@ spec:
name: {{ .Values.gitea.ldap.existingSecret }} name: {{ .Values.gitea.ldap.existingSecret }}
{{- else }} {{- else }}
- name: GITEA_LDAP_BIND_DN - name: GITEA_LDAP_BIND_DN
value: {{ default (index .Values.gitea.ldap "bind-dn") .Values.gitea.ldap.bindDn | quote }} value: {{ .Values.gitea.ldap.bindDn | quote }}
- name: GITEA_LDAP_PASSWORD - name: GITEA_LDAP_PASSWORD
value: {{ default (index .Values.gitea.ldap "bind-password") .Values.gitea.ldap.bindPassword | quote }} value: {{ .Values.gitea.ldap.bindPassword | quote }}
{{- end }}
{{- end }} {{- end }}
{{- if .Values.gitea.admin.existingSecret }} {{- if .Values.gitea.admin.existingSecret }}
- name: GITEA_ADMIN_USERNAME - name: GITEA_ADMIN_USERNAME