netbox: Improve secrets handling, default probes

This commit is contained in:
Alexander Olofsson 2023-05-08 11:19:26 +02:00
parent aeebc6aa3e
commit 4d99ea41f9
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
6 changed files with 46 additions and 13 deletions

View file

@ -10,7 +10,7 @@ icon: https://raw.githubusercontent.com/digitalocean/netbox/develop/netbox/proje
appVersion: 3.5.1 appVersion: 3.5.1
type: application type: application
version: 5.2.2 version: 5.3.0
maintainers: maintainers:
- name: Alexander Olofsson - name: Alexander Olofsson
email: ace@haxalot.com email: ace@haxalot.com

View file

@ -40,13 +40,13 @@ spec:
name: {{ .Values.redis.auth.existingSecret | default (include "netbox.redis.fullname" .) }} name: {{ .Values.redis.auth.existingSecret | default (include "netbox.redis.fullname" .) }}
key: {{ .Values.redis.auth.existingSecretPasswordKey | default "redis-password" }} key: {{ .Values.redis.auth.existingSecretPasswordKey | default "redis-password" }}
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} {{- if (or .Values.postgresql.auth.existingSecret .Values.postgresql.enabled) }}
- name: DB_PASSWORD - name: DB_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
{{- if .Values.postgresql.existingSecret }} {{- if .Values.postgresql.auth.existingSecret }}
name: {{ .Values.postgresql.existingSecret }} name: {{ .Values.postgresql.auth.existingSecret }}
key: password key: {{ .Values.postgresql.auth.existingSecretKey | default "password" }}
{{- else }} {{- else }}
name: {{ include "netbox.postgresql.fullname" . }} name: {{ include "netbox.postgresql.fullname" . }}
key: password key: password
@ -57,6 +57,9 @@ spec:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
- secretRef: - secretRef:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
{{- with .Values.extraEnvFrom -}}
{{ . | toYaml | nindent 12 }}
{{- end }}
resources: resources:
{{- toYaml .Values.housekeeping.resources | nindent 12 }} {{- toYaml .Values.housekeeping.resources | nindent 12 }}
{{- if or .Values.extraConfiguration .Values.extraPlugins }} {{- if or .Values.extraConfiguration .Values.extraPlugins }}

View file

@ -42,13 +42,13 @@ spec:
name: {{ .Values.redis.auth.existingSecret | default (include "netbox.redis.fullname" .) }} name: {{ .Values.redis.auth.existingSecret | default (include "netbox.redis.fullname" .) }}
key: {{ .Values.redis.auth.existingSecretPasswordKey | default "redis-password" }} key: {{ .Values.redis.auth.existingSecretPasswordKey | default "redis-password" }}
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} {{- if (or .Values.postgresql.auth.existingSecret .Values.postgresql.enabled) }}
- name: DB_PASSWORD - name: DB_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
{{- if .Values.postgresql.existingSecret }} {{- if .Values.postgresql.auth.existingSecret }}
name: {{ .Values.postgresql.existingSecret }} name: {{ .Values.postgresql.auth.existingSecret }}
key: password key: {{ .Values.postgresql.auth.existingSecretKey | default "password" }}
{{- else }} {{- else }}
name: {{ include "netbox.postgresql.fullname" . }} name: {{ include "netbox.postgresql.fullname" . }}
key: password key: password
@ -59,6 +59,9 @@ spec:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
- secretRef: - secretRef:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
{{- with .Values.extraEnvFrom -}}
{{ . | toYaml | nindent 12 }}
{{- end }}
resources: resources:
{{- toYaml .Values.worker.resources | nindent 12 }} {{- toYaml .Values.worker.resources | nindent 12 }}
{{- if or .Values.extraConfiguration .Values.extraPlugins }} {{- if or .Values.extraConfiguration .Values.extraPlugins }}

View file

@ -53,13 +53,13 @@ spec:
name: {{ .Values.existingDjangoSecret }} name: {{ .Values.existingDjangoSecret }}
key: {{ .Values.existingDjangoSecretKey }} key: {{ .Values.existingDjangoSecretKey }}
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} {{- if (or .Values.postgresql.auth.existingSecret .Values.postgresql.enabled) }}
- name: DB_PASSWORD - name: DB_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
{{- if .Values.postgresql.existingSecret }} {{- if .Values.postgresql.auth.existingSecret }}
name: {{ .Values.postgresql.existingSecret }} name: {{ .Values.postgresql.auth.existingSecret }}
key: {{ .Values.postgresql.existingSecretKey }} key: {{ .Values.postgresql.auth.existingSecretKey | default "password" }}
{{- else }} {{- else }}
name: {{ include "netbox.postgresql.fullname" . }} name: {{ include "netbox.postgresql.fullname" . }}
key: password key: password
@ -70,6 +70,9 @@ spec:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
- secretRef: - secretRef:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
{{- with .Values.extraEnvFrom -}}
{{ . | toYaml | nindent 12 }}
{{- end }}
ports: ports:
- name: http - name: http
containerPort: 8080 containerPort: 8080

View file

@ -1,3 +1,4 @@
{{ $secret := (lookup "v1" "Secret" .Release.Namespace (include "netbox.fullname" .)) -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@ -17,6 +18,8 @@ data:
{{- end }} {{- end }}
{{- if .Values.djangoSecret }} {{- if .Values.djangoSecret }}
SECRET_KEY: {{ .Values.djangoSecret | b64enc }} SECRET_KEY: {{ .Values.djangoSecret | b64enc }}
{{- else if and $secret $secret.data.SECRET_KEY }}
SECRET_KEY: {{ $secret.data.SECRET_KEY }}
{{- else if not .Values.existingDjangoSecret }} {{- else if not .Values.existingDjangoSecret }}
SECRET_KEY: {{ randAlphaNum 50 | b64enc }} SECRET_KEY: {{ randAlphaNum 50 | b64enc }}
{{- end }} {{- end }}

View file

@ -90,6 +90,12 @@ extraEnv: {}
# MAX_PAGE_SIZE: 1000 # MAX_PAGE_SIZE: 1000
# WEBHOOKS_ENABLED: true # WEBHOOKS_ENABLED: true
extraEnvFrom: []
# - configMapRef:
# name: custom-config
# - secretRef:
# name: custom-secrets
extraSecrets: {} extraSecrets: {}
# EMAIL_PASSWORD: netbox # EMAIL_PASSWORD: netbox
@ -134,6 +140,21 @@ extraVolumes: []
extraVolumeMounts: [] extraVolumeMounts: []
readinessProbe:
httpGet:
port: http
path: /
livenessProbe:
httpGet:
port: http
path: /
startupProbe:
tcpSocket:
port: http
failureThreshold: 12
persistence: persistence:
enabled: false enabled: false
# existingClaim: netbox-data # existingClaim: netbox-data