netbox: Update to 3.5.0

This also adds in proper plugin configuration as well as making the
build-in Redis optional - but still requiring _a_ Redis install for
regular operation
This commit is contained in:
Alexander Olofsson 2023-04-28 11:09:46 +02:00
parent f7f49a8370
commit cb3833bfcd
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
7 changed files with 105 additions and 26 deletions

View file

@ -7,10 +7,10 @@ description: |
Important; With chart version 4.0.0 there are major upgrades to the packaged Redis and Postgres,
as well as a major version bump of Netbox that introduces housekeeping. Take care when upgrading.
icon: https://raw.githubusercontent.com/digitalocean/netbox/develop/netbox/project-static/img/netbox.ico
appVersion: 3.4.10
appVersion: 3.5.0
type: application
version: 5.1.1
version: 5.2.0
maintainers:
- name: Alexander Olofsson
email: ace@haxalot.com
@ -23,3 +23,4 @@ dependencies:
- name: redis
version: ^17.3.17
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled

View file

@ -1,3 +1,6 @@
{{- if and (not .Values.redis.enabled) (not .Values.redis.host) }}
{{ fail "Redis host must be provided if built-in redis is disabled" }}
{{- end }}
{{- if .Values.extraConfiguration }}
---
apiVersion: v1
@ -10,7 +13,23 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "netbox.chart" . }}
data:
extra.py: {{ .Values.extraConfiguration | toYaml | indent 2 }}
extra.py: |
{{- .Values.extraConfiguration | nindent 4 }}
{{- end }}
{{- if .Values.extraPlugins }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-plugins
labels:
app.kubernetes.io/name: {{ include "netbox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "netbox.chart" . }}
data:
plugins.py: |
{{- .Values.extraPlugins | nindent 4 }}
{{- end }}
---
apiVersion: v1
@ -28,7 +47,7 @@ data:
DB_HOST: {{ .Values.postgresql.postgresqlHost | default (include "netbox.postgresql.fullname" .) }}
DB_PORT: {{ .Values.postgresql.postgresqlPort | default 5432 | quote }}
REDIS_HOST: {{ include "netbox.redisHost" . }}
REDIS_HOST: {{ .Values.redis.host | default (include "netbox.redisHost" .) }}
REDIS_PORT: {{ .Values.redis.master.service.port | default 6379 | quote }}
REDIS_SSL: "false"

View file

@ -33,11 +33,13 @@ spec:
image: "{{ .Values.image.repository }}:{{ include "netbox.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if and (or .Values.redis.auth.existingSecret .Values.redis.enabled) (not .Values.redis.auth.password) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "netbox.redis.fullname" . }}
key: redis-password
name: {{ .Values.redis.auth.existingSecret | default (include "netbox.redis.fullname" .) }}
key: {{ .Values.redis.auth.existingSecretPasswordKey | default "redis-password" }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: DB_PASSWORD
valueFrom:
@ -57,21 +59,35 @@ spec:
name: {{ include "netbox.fullname" . }}
resources:
{{- toYaml .Values.housekeeping.resources | nindent 12 }}
{{- if .Values.extraConfiguration }}
{{- if or .Values.extraConfiguration .Values.extraPlugins }}
volumeMounts:
{{- if .Values.extraConfiguration }}
- name: netbox-extra-config
mountPath: /etc/netbox/config/extra.py
subPath: extra.py
{{- end }}
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
mountPath: /etc/netbox/config/plugins.py
subPath: plugins.py
{{- end }}
{{- end }}
{{- with .Values.housekeeping.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.extraConfiguration }}
volumes:
{{- if or .Values.extraConfiguration .Values.extraPlugins }}
{{- if .Values.extraConfiguration }}
- name: netbox-extra-config
configMap:
name: {{ .Chart.Name }}-extra
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
configMap:
name: {{ .Chart.Name }}-plugins
{{- end }}
{{- end }}
{{- with .Values.housekeeping.affinity }}
affinity:

View file

@ -35,11 +35,13 @@ spec:
image: "{{ .Values.image.repository }}:{{ include "netbox.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if and (or .Values.redis.auth.existingSecret .Values.redis.enabled) (not .Values.redis.auth.password) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "netbox.redis.fullname" . }}
key: redis-password
name: {{ .Values.redis.auth.existingSecret | default (include "netbox.redis.fullname" .) }}
key: {{ .Values.redis.auth.existingSecretPasswordKey | default "redis-password" }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: DB_PASSWORD
valueFrom:
@ -59,21 +61,35 @@ spec:
name: {{ include "netbox.fullname" . }}
resources:
{{- toYaml .Values.worker.resources | nindent 12 }}
{{- if .Values.extraConfiguration }}
{{- if or .Values.extraConfiguration .Values.extraPlugins }}
volumeMounts:
{{- if .Values.extraConfiguration }}
- name: netbox-extra-config
mountPath: /etc/netbox/config/extra.py
subPath: extra.py
{{- end }}
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
mountPath: /etc/netbox/config/plugins.py
subPath: plugins.py
{{- end }}
{{- end }}
{{- with .Values.worker.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.extraConfiguration }}
{{- if or .Values.extraConfiguration .Values.extraPlugins }}
volumes:
{{- if .Values.extraConfiguration }}
- name: netbox-extra-config
configMap:
name: {{ .Chart.Name }}-extra
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
configMap:
name: {{ .Chart.Name }}-plugins
{{- end }}
{{- end }}
{{- with .Values.worker.affinity }}
affinity:

View file

@ -39,11 +39,13 @@ spec:
image: "{{ .Values.image.repository }}:{{ include "netbox.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if and (or .Values.redis.auth.existingSecret .Values.redis.enabled) (not .Values.redis.auth.password) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "netbox.redis.fullname" . }}
key: redis-password
name: {{ .Values.redis.auth.existingSecret | default (include "netbox.redis.fullname" .) }}
key: {{ .Values.redis.auth.existingSecretPasswordKey | default "redis-password" }}
{{- end }}
{{- if .Values.existingDjangoSecret }}
- name: SECRET_KEY
valueFrom:
@ -94,6 +96,11 @@ spec:
mountPath: /etc/netbox/config/extra.py
subPath: extra.py
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
mountPath: /etc/netbox/config/plugins.py
subPath: plugins.py
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{ toYaml . | nindent 12 }}
{{- end }}
@ -114,6 +121,11 @@ spec:
configMap:
name: {{ .Chart.Name }}-extra
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
configMap:
name: {{ .Chart.Name }}-plugins
{{- end }}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}

View file

@ -12,6 +12,9 @@ data:
{{- if and (.Values.postgresql.auth.password) (not .Values.postgresql.enabled) }}
DB_PASSWORD: {{ .Values.postgresql.auth.password | b64enc }}
{{- end }}
{{- if .Values.redis.auth.password }}
REDIS_PASSWORD: {{ .Values.redis.auth.password | b64enc }}
{{- end }}
{{- if .Values.djangoSecret }}
SECRET_KEY: {{ .Values.djangoSecret | b64enc }}
{{- else if not .Values.existingDjangoSecret }}

View file

@ -56,11 +56,17 @@ postgresql:
# postgresqlHost: postgres
# postgresqlPort: 5432
# For standalone redis, set enabled=false and host to your redis server
redis:
enabled: true
# host: example.com
architecture: standalone
auth:
enabled: true
# password: netbox
# existingSecret:
# existingSecretPasswordKey:
master:
kind: Deployment
@ -81,18 +87,29 @@ extraEnv: {}
# EMAIL_USERNAME: netbox
# EMAIL_TIMEOUT: 5
# EMAIL_FROM: netbox@example.com
# NAPALM_USERNAME: ''
# NAPALM_TIMEOUT: 10
# MAX_PAGE_SIZE: 1000
# WEBHOOKS_ENABLED: true
extraSecrets: {}
# EMAIL_PASSWORD: netbox
# NAPALM_PASSWORD: ''
# Ends up stored as extra.py in the netbox configuration
# Ends up stored as extra.py in the netbox configuration, must be valid Python
extraConfiguration: ''
# Will be stored in plugins.py in the netbox configuration, requires
# using/building a netbox image containing the required plugins, must be valid
# Python
#
# https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins
extraPlugins: ''
# PLUGINS = ["netbox_bgp"]
#
# PLUGINS_CONFIG = {
# "netbox_bgp": {
# ADD YOUR SETTINGS HERE
# }
# }
superuser:
name: ''
email: ''
@ -116,10 +133,6 @@ affinity: {}
extraVolumes: []
extraVolumeMounts: []
# - name: extra-music-data
# mountPath: /srv/funkwhale/data/music
# readOnly: true
# existingClaim: volume-claim
persistence:
enabled: false
@ -147,9 +160,8 @@ worker:
affinity: {}
# Handles the Netbox 3.0+ housekeeping pod
housekeeping:
## Netbox 3.0.0 and upwards need a housekeeping pod, if you're not using
## 3.0 then you may need to set this parameter
enabled: true
resources: {}