Skip to content

Commit bf14c17

Browse files
authored
Merge pull request #172 from Nabsku/develop
Changed Templates to use the new remoteAuth.backends array, instead of .backend
2 parents acc811e + 72b1315 commit bf14c17

File tree

6 files changed

+49
-33
lines changed

6 files changed

+49
-33
lines changed

charts/netbox/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: netbox
3-
version: 5.0.0-beta7
3+
version: 5.0.0-beta8
44
appVersion: "v4.0.0"
55
type: application
66
kubeVersion: ^1.25.0-0

charts/netbox/templates/configmap.yaml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ data:
224224
DATETIME_FORMAT: {{ .Values.dateTimeFormat | quote }}
225225
SHORT_DATETIME_FORMAT: {{ .Values.shortDateTimeFormat | quote }}
226226
227-
{{- if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" }}
227+
{{- range .Values.remoteAuth.backends }}
228+
{{- if eq . "netbox.authentication.LDAPBackend" }}
228229

229230
ldap_config.py: |-
230231
from importlib import import_module
@@ -276,32 +277,33 @@ data:
276277
# Define special user types using groups. Exercise great caution when assigning superuser status.
277278
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
278279
"is_active": AUTH_LDAP_REQUIRE_GROUP,
279-
"is_staff": {{ .Values.remoteAuth.ldap.isAdminDn | quote }},
280-
"is_superuser": {{ .Values.remoteAuth.ldap.isSuperUserDn | quote }},
280+
"is_staff": {{ $.Values.remoteAuth.ldap.isAdminDn | quote }},
281+
"is_superuser": {{ $.Values.remoteAuth.ldap.isSuperUserDn | quote }},
281282
}
282283
# Populate the Django user from the LDAP directory.
283284
AUTH_LDAP_USER_ATTR_MAP = {
284-
"first_name": {{ .Values.remoteAuth.ldap.attrFirstName | quote }},
285-
"last_name": {{ .Values.remoteAuth.ldap.attrLastName | quote }},
286-
"email": {{ .Values.remoteAuth.ldap.attrMail | quote }},
285+
"first_name": {{ $.Values.remoteAuth.ldap.attrFirstName | quote }},
286+
"last_name": {{ $.Values.remoteAuth.ldap.attrLastName | quote }},
287+
"email": {{ $.Values.remoteAuth.ldap.attrMail | quote }},
287288
}
288289
289290
ldap.yaml: |-
290-
AUTH_LDAP_SERVER_URI: {{ .Values.remoteAuth.ldap.serverUri | quote }}
291-
AUTH_LDAP_BIND_DN: {{ .Values.remoteAuth.ldap.bindDn | quote }}
292-
AUTH_LDAP_START_TLS: {{ toJson .Values.remoteAuth.ldap.startTls }}
293-
LDAP_IGNORE_CERT_ERRORS: {{ toJson .Values.remoteAuth.ldap.ignoreCertErrors }}
294-
AUTH_LDAP_USER_DN_TEMPLATE: {{ default nil .Values.remoteAuth.ldap.userDnTemplate }}
295-
AUTH_LDAP_USER_SEARCH_BASEDN: {{ .Values.remoteAuth.ldap.userSearchBaseDn | quote }}
296-
AUTH_LDAP_USER_SEARCH_ATTR: {{ .Values.remoteAuth.ldap.userSearchAttr | quote }}
297-
AUTH_LDAP_GROUP_SEARCH_BASEDN: {{ .Values.remoteAuth.ldap.groupSearchBaseDn | quote }}
298-
AUTH_LDAP_GROUP_SEARCH_CLASS: {{ .Values.remoteAuth.ldap.groupSearchClass | quote }}
299-
AUTH_LDAP_GROUP_TYPE: {{ .Values.remoteAuth.ldap.groupType | quote }}
300-
AUTH_LDAP_REQUIRE_GROUP: {{ .Values.remoteAuth.ldap.requireGroupDn | quote }}
301-
AUTH_LDAP_FIND_GROUP_PERMS: {{ toJson .Values.remoteAuth.ldap.findGroupPerms }}
302-
AUTH_LDAP_MIRROR_GROUPS: {{ toJson .Values.remoteAuth.ldap.mirrorGroups }}
303-
AUTH_LDAP_MIRROR_GROUPS_EXCEPT: {{ toJson .Values.remoteAuth.ldap.mirrorGroupsExcept }}
304-
AUTH_LDAP_CACHE_TIMEOUT: {{ int .Values.remoteAuth.ldap.cacheTimeout }}
291+
AUTH_LDAP_SERVER_URI: {{ $.Values.remoteAuth.ldap.serverUri | quote }}
292+
AUTH_LDAP_BIND_DN: {{ $.Values.remoteAuth.ldap.bindDn | quote }}
293+
AUTH_LDAP_START_TLS: {{ toJson $.Values.remoteAuth.ldap.startTls }}
294+
LDAP_IGNORE_CERT_ERRORS: {{ toJson $.Values.remoteAuth.ldap.ignoreCertErrors }}
295+
AUTH_LDAP_USER_DN_TEMPLATE: {{ default nil $.Values.remoteAuth.ldap.userDnTemplate }}
296+
AUTH_LDAP_USER_SEARCH_BASEDN: {{ $.Values.remoteAuth.ldap.userSearchBaseDn | quote }}
297+
AUTH_LDAP_USER_SEARCH_ATTR: {{ $.Values.remoteAuth.ldap.userSearchAttr | quote }}
298+
AUTH_LDAP_GROUP_SEARCH_BASEDN: {{ $.Values.remoteAuth.ldap.groupSearchBaseDn | quote }}
299+
AUTH_LDAP_GROUP_SEARCH_CLASS: {{ $.Values.remoteAuth.ldap.groupSearchClass | quote }}
300+
AUTH_LDAP_GROUP_TYPE: {{ $.Values.remoteAuth.ldap.groupType | quote }}
301+
AUTH_LDAP_REQUIRE_GROUP: {{ $.Values.remoteAuth.ldap.requireGroupDn | quote }}
302+
AUTH_LDAP_FIND_GROUP_PERMS: {{ toJson $.Values.remoteAuth.ldap.findGroupPerms }}
303+
AUTH_LDAP_MIRROR_GROUPS: {{ toJson $.Values.remoteAuth.ldap.mirrorGroups }}
304+
AUTH_LDAP_MIRROR_GROUPS_EXCEPT: {{ toJson $.Values.remoteAuth.ldap.mirrorGroupsExcept }}
305+
AUTH_LDAP_CACHE_TIMEOUT: {{ int $.Values.remoteAuth.ldap.cacheTimeout }}
306+
{{- end }}
305307
{{- end }}
306308
{{- if .Values.overrideUnitConfig }}
307309

charts/netbox/templates/cronjob.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ spec:
6161
mountPath: /etc/netbox/config/configuration.py
6262
subPath: configuration.py
6363
readOnly: true
64-
{{ if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" -}}
64+
{{- range .Values.remoteAuth.backends }}
65+
{{- if eq . "netbox.authentication.LDAPBackend" }}
6566
- name: config
6667
mountPath: /etc/netbox/config/ldap/ldap_config.py
6768
subPath: ldap_config.py
6869
readOnly: true
69-
{{ end -}}
70+
{{- end }}
71+
{{- end }}
7072
- name: config
7173
mountPath: /run/config/netbox
7274
readOnly: true
@@ -110,10 +112,12 @@ spec:
110112
path: email_password
111113
- key: secret_key
112114
path: secret_key
113-
{{- if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" }}
115+
{{- range .Values.remoteAuth.backends }}
116+
{{- if eq . "netbox.authentication.LDAPBackend" }}
114117
- key: ldap_bind_password
115118
path: ldap_bind_password
116119
{{- end }}
120+
{{- end }}
117121
- secret:
118122
name: {{ include "netbox.postgresql.secret" . | quote }}
119123
items:

charts/netbox/templates/deployment.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,14 @@ spec:
116116
mountPath: /etc/netbox/config/configuration.py
117117
subPath: configuration.py
118118
readOnly: true
119-
{{ if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" -}}
119+
{{- range .Values.remoteAuth.backends }}
120+
{{- if eq . "netbox.authentication.LDAPBackend" }}
120121
- name: config
121122
mountPath: /etc/netbox/config/ldap/ldap_config.py
122123
subPath: ldap_config.py
123124
readOnly: true
124-
{{ end -}}
125+
{{- end }}
126+
{{- end }}
125127
- name: config
126128
mountPath: /run/config/netbox
127129
readOnly: true
@@ -180,10 +182,12 @@ spec:
180182
path: email_password
181183
- key: secret_key
182184
path: secret_key
183-
{{- if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" }}
185+
{{- range .Values.remoteAuth.backends }}
186+
{{- if eq . "netbox.authentication.LDAPBackend" }}
184187
- key: ldap_bind_password
185188
path: ldap_bind_password
186189
{{- end }}
190+
{{- end }}
187191
- secret:
188192
name: {{ include "netbox.postgresql.secret" . | quote }}
189193
items:

charts/netbox/templates/secret.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ data:
2323
secret_key: {{ .Values.secretKey | default (randAscii 60) | b64enc }}
2424
superuser_password: {{ .Values.superuser.password | default (randAlphaNum 16) | b64enc }}
2525
superuser_api_token: {{ .Values.superuser.apiToken | default uuidv4 | b64enc }}
26-
{{ if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" -}}
27-
ldap_bind_password: {{ .Values.remoteAuth.ldap.bindPassword | b64enc | quote }}
26+
{{- range .Values.remoteAuth.backends }}
27+
{{- if eq . "netbox.authentication.LDAPBackend" }}
28+
ldap_bind_password: {{ $.Values.remoteAuth.ldap.bindPassword | b64enc | quote }}
29+
{{ end -}}
2830
{{ end -}}
2931
{{- end -}}

charts/netbox/templates/worker-deployment.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,14 @@ spec:
6969
mountPath: /etc/netbox/config/configuration.py
7070
subPath: configuration.py
7171
readOnly: true
72-
{{ if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" -}}
72+
{{- range .Values.remoteAuth.backends }}
73+
{{- if eq . "netbox.authentication.LDAPBackend" }}
7374
- name: config
7475
mountPath: /etc/netbox/config/ldap/ldap_config.py
7576
subPath: ldap_config.py
7677
readOnly: true
77-
{{ end -}}
78+
{{- end }}
79+
{{- end }}
7880
- name: config
7981
mountPath: /run/config/netbox
8082
readOnly: true
@@ -118,10 +120,12 @@ spec:
118120
path: email_password
119121
- key: secret_key
120122
path: secret_key
121-
{{- if eq .Values.remoteAuth.backend "netbox.authentication.LDAPBackend" }}
123+
{{- range .Values.remoteAuth.backends }}
124+
{{- if eq . "netbox.authentication.LDAPBackend" }}
122125
- key: ldap_bind_password
123126
path: ldap_bind_password
124127
{{- end }}
128+
{{- end }}
125129
- secret:
126130
name: {{ include "netbox.postgresql.secret" . | quote }}
127131
items:

0 commit comments

Comments
 (0)