diff --git a/charts/netbox/Chart.lock b/charts/netbox/Chart.lock index da31558b..eef3efa9 100644 --- a/charts/netbox/Chart.lock +++ b/charts/netbox/Chart.lock @@ -1,12 +1,12 @@ dependencies: - name: common repository: oci://registry-1.docker.io/bitnamicharts - version: 2.24.0 + version: 2.26.0 - name: postgresql repository: oci://registry-1.docker.io/bitnamicharts - version: 16.0.0 + version: 16.0.4 - name: redis repository: oci://registry-1.docker.io/bitnamicharts - version: 20.1.7 -digest: sha256:5d9412ea0156a8d97c4f3026f41667f8ee0937214206dcff202dd7f4a502cc97 -generated: "2024-10-03T16:58:55.793050933Z" + version: 20.2.1 +digest: sha256:0a08d65fc3ce1e6594b6353b4df48a363958a8c9eee3f6a33a6964ca9d1b94ce +generated: "2024-10-21T14:01:10.675692716Z" diff --git a/charts/netbox/Chart.yaml b/charts/netbox/Chart.yaml index 04e4832d..bc23a409 100644 --- a/charts/netbox/Chart.yaml +++ b/charts/netbox/Chart.yaml @@ -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 @@ -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: diff --git a/charts/netbox/files/ldap_config.py b/charts/netbox/files/ldap_config.py index 69536ece..ca820d79 100644 --- a/charts/netbox/files/ldap_config.py +++ b/charts/netbox/files/ldap_config.py @@ -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 @@ -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, @@ -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, diff --git a/charts/netbox/templates/_helpers.tpl b/charts/netbox/templates/_helpers.tpl index 79bd58cf..5dc2b363 100644 --- a/charts/netbox/templates/_helpers.tpl +++ b/charts/netbox/templates/_helpers.tpl @@ -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: @@ -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 diff --git a/charts/netbox/templates/configmap.yaml b/charts/netbox/templates/configmap.yaml index 712615fc..491dfce6 100644 --- a/charts/netbox/templates/configmap.yaml +++ b/charts/netbox/templates/configmap.yaml @@ -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 }} diff --git a/charts/netbox/templates/cronjob.yaml b/charts/netbox/templates/cronjob.yaml index fe8041dd..a7653065 100644 --- a/charts/netbox/templates/cronjob.yaml +++ b/charts/netbox/templates/cronjob.yaml @@ -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 @@ -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 diff --git a/charts/netbox/templates/deployment.yaml b/charts/netbox/templates/deployment.yaml index 633074a8..f24b4089 100644 --- a/charts/netbox/templates/deployment.yaml +++ b/charts/netbox/templates/deployment.yaml @@ -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 @@ -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 diff --git a/charts/netbox/templates/worker/deployment.yaml b/charts/netbox/templates/worker/deployment.yaml index d18added..7c7e9a33 100644 --- a/charts/netbox/templates/worker/deployment.yaml +++ b/charts/netbox/templates/worker/deployment.yaml @@ -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 @@ -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 diff --git a/charts/netbox/values.yaml b/charts/netbox/values.yaml index e9d457b0..bfc285c9 100644 --- a/charts/netbox/values.yaml +++ b/charts/netbox/values.yaml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 961775c2..1c77ca30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line_length = 100 -target-version = ['py38'] +target-version = ["py38"] include = '\.pyi?$' exclude = ''' ( @@ -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"