Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into leo/feat/schema
Browse files Browse the repository at this point in the history
  • Loading branch information
RangerRick committed Oct 22, 2024
2 parents 82ee633 + a13b904 commit 921d524
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 33 deletions.
10 changes: 5 additions & 5 deletions charts/netbox/Chart.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions charts/netbox/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: netbox
version: 5.0.0-beta.121
appVersion: "v4.1.3"
version: 5.0.0-beta.132
appVersion: "v4.1.4"
type: application
kubeVersion: ^1.25.0-0
description: IP address management (IPAM) and data center infrastructure management (DCIM) tool
Expand All @@ -18,15 +18,15 @@ maintainers:
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: ^2.24.0
version: ^2.26.0
tags:
- bitnami-common
- name: postgresql
version: ^16.0.0
version: ^16.0.4
repository: oci://registry-1.docker.io/bitnamicharts
condition: postgresql.enabled
- name: redis
version: ^20.1.7
version: ^20.2.1
repository: oci://registry-1.docker.io/bitnamicharts
condition: redis.enabled
annotations:
Expand Down
22 changes: 10 additions & 12 deletions charts/netbox/files/ldap_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This file serves as a LDAP configuration for Netbox
https://netboxlabs.com/docs/netbox/en/stable/configuration/
https://netboxlabs.com/docs/netbox/en/stable/installation/6-ldap/#configuration
https://django-auth-ldap.readthedocs.io/en/latest/reference.html
"""

from functools import reduce
Expand Down Expand Up @@ -56,7 +57,7 @@ def _import_group_type(group_type_name: str) -> Any | None:
AUTH_LDAP_USER_SEARCH = LDAPSearch(
AUTH_LDAP_USER_SEARCH_BASEDN,
ldap.SCOPE_SUBTREE,
"(" + AUTH_LDAP_USER_SEARCH_ATTR + "=%(user)s)",
f"({AUTH_LDAP_USER_SEARCH_ATTR}=%(user)s)",
)
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
AUTH_LDAP_GROUP_SEARCH_BASEDN,
Expand All @@ -66,19 +67,16 @@ def _import_group_type(group_type_name: str) -> Any | None:
AUTH_LDAP_GROUP_TYPE = _import_group_type(AUTH_LDAP_GROUP_TYPE)

# Define a group required to login.
AUTH_LDAP_REQUIRE_GROUP = reduce(
lambda query, group: query | LDAPGroupQuery(group),
AUTH_LDAP_REQUIRE_GROUP_LIST,
LDAPGroupQuery(""),
)

# Define special user types using groups. Exercise great caution when assigning superuser status.
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": reduce(
if AUTH_LDAP_REQUIRE_GROUP_LIST:
AUTH_LDAP_REQUIRE_GROUP = reduce(
lambda query, group: query | LDAPGroupQuery(group),
AUTH_LDAP_REQUIRE_GROUP_LIST,
LDAPGroupQuery(""),
),
)

# Define special user types using groups. Exercise great caution when assigning superuser status.
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": AUTH_LDAP_REQUIRE_GROUP,
"is_staff": reduce(
lambda query, group: query | LDAPGroupQuery(group),
AUTH_LDAP_IS_ADMIN_LIST,
Expand Down
4 changes: 2 additions & 2 deletions charts/netbox/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Name of the key in Secret that contains the Redis cache password
Volumes that need to be mounted for .Values.extraConfig entries
*/}}
{{- define "netbox.extraConfig.volumes" -}}
{{- range $index, $config := .Values.extraConfig -}}
{{- range $index, $config := .Values.extraConfig }}
- name: extra-config-{{ $index }}
{{- if $config.values }}
configMap:
Expand All @@ -123,7 +123,7 @@ Volumes that need to be mounted for .Values.extraConfig entries
Volume mounts for .Values.extraConfig entries
*/}}
{{- define "netbox.extraConfig.volumeMounts" -}}
{{- range $index, $config := .Values.extraConfig -}}
{{- range $index, $config := .Values.extraConfig }}
- name: extra-config-{{ $index }}
mountPath: /run/config/extra/{{ $index }}
readOnly: true
Expand Down
2 changes: 1 addition & 1 deletion charts/netbox/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ data:
{{- toPrettyJson .Values.overrideUnitConfig | nindent 4 }}
{{- end }}

{{- range $index, $config := .Values.extraConfig -}}
{{- range $index, $config := .Values.extraConfig }}
{{- if $config.values }}
extra-{{ $index }}.yaml: |-
{{- toYaml $config.values | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/netbox/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spec:
- name: secrets
mountPath: /run/secrets/netbox
readOnly: true
{{- include "netbox.extraConfig.volumeMounts" . | nindent 12 -}}
{{- include "netbox.extraConfig.volumeMounts" . | nindent 12 }}
- name: netbox-tmp
mountPath: /tmp
- name: media
Expand Down Expand Up @@ -142,7 +142,7 @@ spec:
items:
- key: {{ include "netbox.cachingRedis.secretKey" . | quote }}
path: redis_cache_password
{{- include "netbox.extraConfig.volumes" . | nindent 10 -}}
{{- include "netbox.extraConfig.volumes" . | nindent 10 }}
- name: netbox-tmp
emptyDir:
medium: Memory
Expand Down
4 changes: 2 additions & 2 deletions charts/netbox/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ spec:
- name: secrets
mountPath: /run/secrets/netbox
readOnly: true
{{- include "netbox.extraConfig.volumeMounts" . | nindent 8 -}}
{{- include "netbox.extraConfig.volumeMounts" . | nindent 8 }}
- name: netbox-tmp
mountPath: /tmp
- name: media
Expand Down Expand Up @@ -249,7 +249,7 @@ spec:
items:
- key: {{ include "netbox.cachingRedis.secretKey" . | quote }}
path: redis_cache_password
{{- include "netbox.extraConfig.volumes" . | nindent 6 -}}
{{- include "netbox.extraConfig.volumes" . | nindent 6 }}
- name: netbox-tmp
emptyDir:
medium: Memory
Expand Down
4 changes: 2 additions & 2 deletions charts/netbox/templates/worker/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
- name: secrets
mountPath: /run/secrets/netbox
readOnly: true
{{- include "netbox.extraConfig.volumeMounts" . | nindent 8 -}}
{{- include "netbox.extraConfig.volumeMounts" . | nindent 8 }}
- name: netbox-tmp
mountPath: /tmp
- name: media
Expand Down Expand Up @@ -155,7 +155,7 @@ spec:
items:
- key: {{ include "netbox.cachingRedis.secretKey" . | quote }}
path: redis_cache_password
{{- include "netbox.extraConfig.volumes" . | nindent 6 -}}
{{- include "netbox.extraConfig.volumes" . | nindent 6 }}
- name: netbox-tmp
emptyDir:
medium: Memory
Expand Down
35 changes: 35 additions & 0 deletions charts/netbox/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,20 @@ serviceAccount:
##
hostAliases: []
## @param extraVolumes Array of extra volumes to be added to the deployment (evaluated as template). Requires setting `extraVolumeMounts`
## e.g:
## extraVolumes:
## - name: redis-ca
## secret:
## secretName: redis-ca
##
extraVolumes: []
## @param extraVolumeMounts Array of extra volume mounts to be added to the container (evaluated as template). Normally used with `extraVolumes`.
## e.g:
## extraVolumeMounts:
## - name: redis-ca
## mountPath: /tmp/redis-ca
## subPath: redis_ca
## readOnly: true
##
extraVolumeMounts: []
## @param sidecars Add additional sidecar containers to the pod
Expand Down Expand Up @@ -1028,6 +1039,7 @@ tasksRedis:
database: 0
ssl: false
insecureSkipTlsVerify: false
# When defining caCertPath, make sure you mount the secret containing the CA certificate on all the necessary containers
caCertPath: ""

# Used only when redis.enabled is false. host and port are not used if
Expand All @@ -1047,6 +1059,7 @@ cachingRedis:
database: 1
ssl: false
insecureSkipTlsVerify: false
# When defining caCertPath, make sure you mount the secret containing the CA certificate on all the necessary containers
caCertPath: ""

# Used only when redis.enabled is false. host and port are not used if
Expand Down Expand Up @@ -1321,9 +1334,20 @@ housekeeping:
## name: secret-resource
extraEnvs: []
## @param housekeeping.extraVolumes Array of extra volumes to be added to the deployment (evaluated as template). Requires setting `extraVolumeMounts`
## e.g:
## extraVolumes:
## - name: redis-ca
## secret:
## secretName: redis-ca
##
extraVolumes: []
## @param housekeeping.extraVolumeMounts Array of extra volume mounts to be added to the container (evaluated as template). Normally used with `extraVolumes`.
## e.g:
## extraVolumeMounts:
## - name: redis-ca
## mountPath: /tmp/redis-ca
## subPath: redis_ca
## readOnly: true
##
extraVolumeMounts: []
## @param housekeeping.sidecars Add additional sidecar containers to the pod
Expand Down Expand Up @@ -1538,9 +1562,20 @@ worker:
## name: secret-resource
extraEnvs: []
## @param worker.extraVolumes Array of extra volumes to be added to the deployment (evaluated as template). Requires setting `extraVolumeMounts`
## e.g:
## extraVolumes:
## - name: redis-ca
## secret:
## secretName: redis-ca
##
extraVolumes: []
## @param worker.extraVolumeMounts Array of extra volume mounts to be added to the container (evaluated as template). Normally used with `extraVolumes`.
## e.g:
## extraVolumeMounts:
## - name: redis-ca
## mountPath: /tmp/redis-ca
## subPath: redis_ca
## readOnly: true
##
extraVolumeMounts: []
## @param worker.sidecars Add additional sidecar containers to the pod
Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line_length = 100
target-version = ['py38']
target-version = ["py38"]
include = '\.pyi?$'
exclude = '''
(
Expand All @@ -20,7 +20,13 @@ multi_line_output = 3
line_length = 100

[tool.pylint.main]
disable = ["duplicate-code", "import-error", "used-before-assignment", "undefined-variable"]
disable = [
"duplicate-code",
"import-error",
"possibly-used-before-assignment",
"used-before-assignment",
"undefined-variable",
]

[tool.pylint.format]
max-line-length = "100"
Expand Down

0 comments on commit 921d524

Please sign in to comment.