Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder values and their documentation #199

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ for further information.

* NetBox has been updated to 3.6.4, but older 3.5+ versions should still work (this is not tested or supported, however).
* **Potentially breaking changes:**
* The `extraContainers` setting has been renamed `sidecars` to match conventions.
* The `extraInitContainers` setting has been renamed `initContainers` to match conventions.
* The `metricsEnabled` setting has been renamed `metrics.enabled` to match conventions.
* The `serviceMonitor` setting has been moved to `metrics.serviceMonitor` to match conventions.
* The `jobResultRetention` setting has been renamed `jobRetention` to match the change in NetBox 3.5.
* The `remoteAuth.backend` setting has been renamed `remoteAuth.backends` and is now an array.
* The `remoteAuth.autoCreateUser` setting now defaults to `false`.
Expand Down Expand Up @@ -201,7 +205,6 @@ The following table lists the configurable parameters for this chart and their d
| `maxPageSize` | Maximum number of objects that can be returned by a single API call | `1000` |
| `storageBackend` | Django-storages backend class name | `null` |
| `storageConfig` | Django-storages backend configuration | `{}` |
| `metricsEnabled` | Expose Prometheus metrics at the `/metrics` HTTP endpoint | `false` |
| `paginateCount` | The default number of objects to display per page in the web UI | `50` |
| `plugins` | Additional plugins to load into NetBox | `[]` |
| `pluginsConfig` | Configuration for the additional plugins | `{}` |
Expand Down Expand Up @@ -256,10 +259,11 @@ The following table lists the configurable parameters for this chart and their d
| `dateFormat` | Django date format for long-form date strings | `"N j, Y"` |
| `shortDateFormat` | Django date format for short-form date strings | `"Y-m-d"` |
| `timeFormat` | Django date format for long-form time strings | `"g:i a"` |
| `serviceMonitor.enabled` | Whether to enable a [ServiceMonitor](https://prometheus-operator.dev/docs/operator/design/#servicemonitor) for Netbox | `false` |
| `serviceMonitor.additionalLabels` | Additonal labels to apply to the ServiceMonitor | `{}` |
| `serviceMonitor.interval` | Interval to scrape metrics. | `1m` |
| `serviceMonitor.scrapeTimeout` | Timeout duration for scraping metrics | `10s` |
| `metrics.enabled` | Expose Prometheus metrics at the `/metrics` HTTP endpoint | `false` |
| `metrics.serviceMonitor.enabled` | Whether to enable a [ServiceMonitor](https://prometheus-operator.dev/docs/operator/design/#servicemonitor) for Netbox | `false` |
| `metrics.serviceMonitor.additionalLabels` | Additonal labels to apply to the ServiceMonitor | `{}` |
| `metrics.serviceMonitor.interval` | Interval to scrape metrics. | `1m` |
| `metrics.serviceMonitor.scrapeTimeout` | Timeout duration for scraping metrics | `10s` |
| `shortTimeFormat` | Django date format for short-form time strings | `"H:i:s"` |
| `dateTimeFormat` | Django date format for long-form date and time strings | `"N j, Y g:i a"` |
| `shortDateTimeFormat` | Django date format for short-form date and time strongs | `"Y-m-d H:i"` |
Expand Down Expand Up @@ -376,8 +380,8 @@ The following table lists the configurable parameters for this chart and their d
| `extraEnvs` | Additional environment variables to set in the NetBox container | `[]` |
| `extraVolumeMounts` | Additional volumes to mount in the NetBox container | `[]` |
| `extraVolumes` | Additional volumes to reference in pods | `[]` |
| `extraContainers` | Additional sidecar containers to be added to pods | `[]` |
| `extraInitContainers` | Additional init containers to run before starting main containers | `[]` |
| `sidecars` | Additional sidecar containers to be added to pods | `[]` |
| `initContainers` | Additional init containers to run before starting main containers | `[]` |
| `worker` | Worker specific variables. Most global variables also apply here. | *see `values.yaml`* |
| `housekeeping.enabled` | Whether the [Housekeeping][housekeeping] `CronJob` should be active | `true` |
| `housekeeping.concurrencyPolicy` | ConcurrencyPolicy for the Housekeeping CronJob. | `Forbid` |
Expand All @@ -398,8 +402,8 @@ The following table lists the configurable parameters for this chart and their d
| `housekeeping.extraEnvs` | Additional environment variables to set in housekeeping CronJob | `[]` |
| `housekeeping.extraVolumeMounts` | Additional volumes to mount in the housekeeping CronJob | `[]` |
| `housekeeping.extraVolumes` | Additional volumes to reference in housekeeping CronJob pods | `[]` |
| `housekeeping.extraContainers` | Additional sidecar containers to be added to housekeeping CronJob | `[]` |
| `housekeeping.extraInitContainers` | Additional init containers for housekeeping CronJob pods | `[]` |
| `housekeeping.sidecars` | Additional sidecar containers to be added to housekeeping CronJob | `[]` |
| `housekeeping.initContainers` | Additional init containers for housekeeping CronJob pods | `[]` |

[netbox-docker startup scripts]: https://github.com/netbox-community/netbox-docker/tree/master/startup_scripts
[CORS]: https://github.com/ottoyiu/django-cors-headers
Expand Down
2 changes: 1 addition & 1 deletion charts/netbox/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: netbox
version: 5.0.0-beta4
version: 5.0.0-beta6
appVersion: "v3.6.4"
type: application
kubeVersion: ^1.25.0-0
Expand Down
7 changes: 7 additions & 0 deletions charts/netbox/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ Return the proper image name
{{- include "common.images.image" (dict "imageRoot" $imageRoot "global" .Values.global) -}}
{{- end -}}

{{/*
Return the proper image name (for the init container image)
*/}}
{{- define "netbox.init.image" -}}
{{- include "common.images.image" (dict "imageRoot" .Values.init.image "global" .Values.global) -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
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 @@ -145,7 +145,7 @@ data:
STORAGE_BACKEND: {{ .Values.storageBackend | quote }}
STORAGE_CONFIG: {{ toJson .Values.storageConfig }}
{{- end }}
METRICS_ENABLED: {{ toJson .Values.metricsEnabled }}
METRICS_ENABLED: {{ toJson .Values.metrics.enabled }}
PAGINATE_COUNT: {{ int .Values.paginateCount }}
PLUGINS: {{ toJson .Values.plugins }}
PLUGINS_CONFIG: {{ toJson .Values.pluginsConfig }}
Expand Down
16 changes: 7 additions & 9 deletions charts/netbox/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,20 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) | nindent 6 }}
serviceAccountName: {{ include "netbox.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.housekeeping.automountServiceAccountToken }}
securityContext:
{{- toYaml .Values.housekeeping.podSecurityContext | nindent 12 }}
{{- with .Values.housekeeping.extraInitContainers }}
{{- with .Values.housekeeping.initContainers }}
initContainers:
{{- toYaml . | nindent 10 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-housekeeping
securityContext:
{{- toYaml .Values.housekeeping.securityContext | nindent 14 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: {{ include "netbox.image" . | quote }}
command:
- /opt/netbox/venv/bin/python
- /opt/netbox/netbox/manage.py
Expand Down Expand Up @@ -91,10 +88,11 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.housekeeping.resources }}
resources:
{{- toYaml .Values.housekeeping.resources | nindent 14 }}
resources: {{ toYaml .Values.housekeeping.resources | nindent 14 }}
{{- else if ne .Values.housekeeping.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.housekeeping.resourcesPreset) | nindent 14 }}
{{- end }}
{{- with .Values.housekeeping.extraContainers }}
{{- with .Values.housekeeping.sidecars }}
{{- toYaml . | nindent 10 }}
{{- end }}
volumes:
Expand Down
42 changes: 21 additions & 21 deletions charts/netbox/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,34 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) | nindent 6 }}
serviceAccountName: {{ include "netbox.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.podSecurityContext.enabled }}
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
- name: init-dirs
image: "{{ .Values.init.image.repository }}:{{ .Values.init.image.tag }}"
imagePullPolicy: {{ .Values.init.image.pullPolicy }}
image: {{ include "netbox.init.image" . | quote }}
imagePullPolicy: {{ .Values.init.image.pullPolicy | quote }}
command: [/bin/sh, -c, mkdir -p /opt/unit/state /opt/unit/tmp]
{{- if .Values.init.resources }}
resources:
{{- toYaml .Values.init.resources | nindent 10 }}
resources: {{- toYaml .Values.init.resources | nindent 11 }}
{{- else if ne .Values.init.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.init.resourcesPreset) | nindent 10 }}
{{- end }}
securityContext:
{{- toYaml .Values.init.securityContext | nindent 10 }}
securityContext: {{- .Values.init.securityContext | toYaml | nindent 10 }}
volumeMounts:
- name: optunit
mountPath: /opt/unit
{{- with .Values.extraInitContainers }}
{{- toYaml . | nindent 6 }}
{{- if .Values.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | trim | nindent 6 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
{{- if .Values.securityContext.enabled }}
securityContext: {{- omit .Values.securityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
image: {{ include "netbox.image" . | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
Expand Down Expand Up @@ -150,14 +149,15 @@ spec:
mountPath: /run/secrets/superuser_api_token
subPath: superuser_api_token
readOnly: true
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 10 }}
resources: {{ toYaml .Values.resources | nindent 12 }}
{{- else if ne .Values.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.resourcesPreset) | nindent 10 }}
{{- end }}
{{- with .Values.extraContainers }}
{{- with .Values.sidecars }}
{{- toYaml . | nindent 6 }}
{{- end }}
volumes:
Expand Down
2 changes: 1 addition & 1 deletion charts/netbox/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
externalIPs:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- if .Values.service.externalTrafficPolicy }}
{{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if .Values.service.ipFamilyPolicy }}
Expand Down
4 changes: 0 additions & 4 deletions charts/netbox/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@ metadata:
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
14 changes: 7 additions & 7 deletions charts/netbox/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if and .Values.metricsEnabled .Values.serviceMonitor.enabled -}}
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceMonitor.additionalLabels .Values.commonLabels ) "context" . ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.serviceMonitor.additionalLabels .Values.commonLabels ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand All @@ -19,11 +19,11 @@ spec:
{{- include "common.labels.matchLabels" . | nindent 6 }}
endpoints:
- port: http
path: /metrics
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
path: "/metrics"
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- end }}
9 changes: 5 additions & 4 deletions charts/netbox/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
automountServiceAccountToken: {{ .Values.worker.automountServiceAccountToken }}
securityContext:
{{- toYaml .Values.worker.podSecurityContext | nindent 8 }}
{{- with .Values.worker.extraInitContainers }}
{{- with .Values.worker.initContainers }}
initContainers:
{{- toYaml . | nindent 6 }}
{{- end }}
Expand Down Expand Up @@ -96,10 +96,11 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.worker.resources }}
resources:
{{- toYaml .Values.worker.resources | nindent 10 }}
resources: {{ toYaml .Values.worker.resources | nindent 10 }}
{{- else if ne .Values.worker.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.worker.resourcesPreset) | nindent 10 }}
{{- end }}
{{- with .Values.worker.extraContainers }}
{{- with .Values.worker.sidecars }}
{{- toYaml . | nindent 6 }}
{{- end }}
volumes:
Expand Down
Loading
Loading