Skip to content

Commit

Permalink
Merge pull request #69 from startechnica/netbox-240202
Browse files Browse the repository at this point in the history
[netbox] Release version 5.0.9
  • Loading branch information
firmansyahn authored May 8, 2024
2 parents 722e1b0 + 466bcc4 commit 5b8b9e5
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 102 deletions.
22 changes: 16 additions & 6 deletions charts/netbox/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
annotations:
artifacthub.io/changes: |
- kind: fixed
description: External redis secret name
description: Add missing import if allowedHostsIncludesPodIp is true
links:
- name: GitHub Issue
url: https://github.com/startechnica/apps/issues/61
- name: GitHub Pull Request
url: https://github.com/startechnica/apps/pull/68
- kind: changed
description: Update Netbox Docker to v2.8.0
links:
- name: GitHub Releases
url: https://github.com/netbox-community/netbox-docker/releases/tag/2.8.0
- kind: changed
description: Update Netbox v3.7.8
links:
- name: GitHub Releases
url: https://github.com/netbox-community/netbox/releases/tag/v3.7.8
licenses: Apache-2.0
images: |
- name: netbox
image: docker.io/netboxcommunity/netbox:v3.7.6-2.8.0
image: docker.io/netboxcommunity/netbox:v3.7.8-2.8.0
apiVersion: v2
appVersion: v3.7.6
appVersion: v3.7.8
name: netbox
kubeVersion: ">=1.25.0"
description: IP address management (IPAM) and data center infrastructure management (DCIM) tool
Expand Down Expand Up @@ -43,4 +53,4 @@ keywords:
- ipam
- netbox
type: application
version: 5.0.8
version: 5.0.9
14 changes: 8 additions & 6 deletions charts/netbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ network automation. Read on to discover why thousands of organizations worldwide

[Overview of Netbox](https://docs.netbox.dev/en/stable/)

**Note:** This repository was forked from [bootc/netbox-chart](https://github.com/bootc/netbox-chart) at versions
v5.0.0 and up are from this fork will have diverged from any changes in the original fork. A list of changes can be seen in the CHANGELOG.
> [!IMPORTANT]
> This is last helm chart release for Netbox v3.x.
> Please consult Netbox [v4.x release notes](https://github.com/netbox-community/netbox/releases/tag/v4.0.0) for any breaking changes before migrating.
> [!NOTE]
> This repository was forked from [bootc/netbox-chart](https://github.com/bootc/netbox-chart) at versions v5.0.0 and up are from this fork will have diverged from any changes in the original fork. A list of changes can be seen in the CHANGELOG.
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/startechnica/apps/issues/new/choose)**

Expand All @@ -19,11 +23,11 @@ helm install netbox startechnica/netbox
```
⚠️ **WARNING:** Please see [Production Usage](#production-usage) below before using this chart for production environment.

## Prerequisites
## Compatibility

- Kubernetes 1.25.0+ (a [current](https://kubernetes.io/releases/) version)
- Helm 3.10.0+ (a version [compatible](https://helm.sh/docs/topics/version_skew/) with your cluster)
- This chart works with NetBox 3.5.0+ (3.7.0+ recommended)
- This chart only works with NetBox 3.7.0+ and above.

## Installing the Chart

Expand Down Expand Up @@ -782,8 +786,6 @@ extraConfig:
> The following notice applies to all files contained within this Helm Chart and
> the Git repository which contains it:
>
> Copyright 2019-2020 Chris Boot
>
> Licensed under the Apache License, Version 2.0 (the "License");
> you may not use this file except in compliance with the License.
> You may obtain a copy of the License at
Expand Down
4 changes: 4 additions & 0 deletions charts/netbox/templates/ConfigMap/netbox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
data:
configuration.py: |-
{{- if .Values.allowedHostsIncludesPodIp }}
import os
{{- end }}
import re
from pathlib import Path
Expand Down Expand Up @@ -94,6 +97,7 @@ data:
BANNER_BOTTOM: {{ .Values.banner.bottom | quote }}
BANNER_LOGIN: {{ .Values.banner.login | quote }}
BASE_PATH: {{ .Values.basePath | quote }}
CENSUS_REPORTING_ENABLED: {{ toJson .Values.censusReporting }}
CHANGELOG_RETENTION: {{ int .Values.changelogRetention }}
CUSTOM_VALIDATORS: {{ toJson .Values.customValidators }}
DEFAULT_USER_PREFERENCES: {{ toJson .Values.defaultUserPreferences }}
Expand Down
7 changes: 6 additions & 1 deletion charts/netbox/templates/CronJob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CronJob
metadata:
name: {{ template "netbox.housekeeping.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.housekeeping.image "chart" .Chart ) ) }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" (dict "imageRoot" .Values.housekeeping.image "global" .Values.global "chart" .Chart) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: housekeeping
Expand Down Expand Up @@ -77,6 +77,11 @@ spec:
- /opt/netbox/netbox/manage.py
- housekeeping
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 14 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.housekeeping.args "context" $) | nindent 14 }}
{{- end }}
env:
- name: HOUSEKEEPING_INTERVAL
value: "20"
Expand Down
14 changes: 7 additions & 7 deletions charts/netbox/templates/Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Deployment
metadata:
name: {{ include "netbox.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.image "chart" .Chart ) ) }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" (dict "imageRoot" .Values.image "global" .Values.global "chart" .Chart) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
labels: {{- include "common.labels.standard" (dict "customLabels" $labels "context" $) | nindent 4 }}
app.kubernetes.io/component: server
app.kubernetes.io/part-of: netbox
{{- if .Values.commonAnnotations }}
Expand All @@ -15,9 +15,9 @@ spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ default 1 .Values.replicaCount }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels $versionLabel ) "context" . ) }}
{{- $podLabels := include "common.tplvalues.merge" (dict "values" ( list .Values.podLabels .Values.commonLabels $versionLabel) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" $podLabels "context" $) | nindent 6 }}
app.kubernetes.io/component: server
app.kubernetes.io/part-of: netbox
{{ if .Values.updateStrategy -}}
Expand All @@ -34,13 +34,13 @@ spec:
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
labels: {{- include "common.labels.standard" (dict "customLabels" $podLabels "context" $) | nindent 8 }}
app.kubernetes.io/component: server
app.kubernetes.io/part-of: netbox
{{- if and .Values.metrics.enabled .Values.metrics.podLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podLabels "context" $ ) | nindent 8 }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
{{- if .Values.affinity }}
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 @@ -3,7 +3,7 @@ kind: Service
metadata:
name: {{ template "netbox.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" (dict "imageRoot" .Values.image "chart" .Chart) ) }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" (dict "imageRoot" .Values.image "global" .Values.global "chart" .Chart) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: server
Expand Down
50 changes: 0 additions & 50 deletions charts/netbox/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,56 +54,6 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{ include "common.names.dependency.fullname" (dict "chartName" "redis" "chartValues" .Values.redis "context" $) }}
{{- end -}}

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

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

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

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

{{/*
Return the proper Redis image name
*/}}
{{- define "netbox.redis.image" -}}
{{- if .Values.redis.enabled -}}
{{- include "redis.image" .Subcharts.redis -}}
{{- else -}}
{{ include "common.images.image" ( dict "imageRoot" .Values.redis.image "global" .Values.global ) }}
{{- end -}}
{{- end -}}

{{/*
Return the proper Redis wait image name
*/}}
{{- define "netbox.redisWait.image" -}}
{{- if .Values.redis.enabled -}}
{{- include "redis.image" .Subcharts.redis -}}
{{- else -}}
{{ include "common.images.image" ( dict "imageRoot" .Values.redisWait.image "global" .Values.global ) }}
{{- end -}}
{{- end -}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
Expand Down
85 changes: 85 additions & 0 deletions charts/netbox/templates/_images.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{{/*
Return the proper Netbox image name
{{ include "netbox.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" .Values.global ) }}
*/}}
{{- define "netbox.images.image" -}}
{{- $registryName := default .imageRoot.registry ((.global).imageRegistry) -}}
{{- $repositoryName := default .imageRoot.repository ((.global).imageRepository) -}}
{{- $separator := ":" -}}
{{- $termination := default .imageRoot.tag ((.global).imageTag) | toString -}}

{{- if or (.imageRoot.digest) ((.global).imageDigest) }}
{{- $separator = "@" -}}
{{- $termination = default .imageRoot.digest ((.global).imageDigest) | toString -}}
{{- end -}}
{{- if $registryName }}
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
{{- else -}}
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
{{- end -}}
{{- end -}}

{{/*
Return the proper image version (ingores image revision/prerelease info & fallbacks to chart appVersion)
{{ include "netbox.images.version" ( dict "imageRoot" .Values.path.to.the.image "global" .Values.global "chart" .Chart ) }}
*/}}
{{- define "netbox.images.version" -}}
{{- $imageTag := default .imageRoot.tag ((.global).imageTag) | toString -}}
{{/* regexp from https://github.com/Masterminds/semver/blob/23f51de38a0866c5ef0bfc42b3f735c73107b700/version.go#L41-L44 */}}
{{- if regexMatch `^([0-9]+)(\.[0-9]+)?(\.[0-9]+)?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$` $imageTag -}}
{{- $version := semver $imageTag -}}
{{- printf "%d.%d.%d" $version.Major $version.Minor $version.Patch -}}
{{- else -}}
{{- print .chart.AppVersion -}}
{{- end -}}
{{- end -}}

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

{{/*
Return the proper Netbox worker image name
*/}}
{{- define "netbox.worker.image" -}}
{{ include "netbox.images.image" (dict "imageRoot" .Values.worker.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper Netbox housekeeping image name
*/}}
{{- define "netbox.housekeeping.image" -}}
{{ include "netbox.images.image" (dict "imageRoot" .Values.housekeeping.image "global" .Values.global) }}
{{- end -}}

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

{{/*
Return the proper Redis image name
*/}}
{{- define "netbox.redis.image" -}}
{{- if .Values.redis.enabled -}}
{{- include "redis.image" .Subcharts.redis -}}
{{- else -}}
{{ include "common.images.image" (dict "imageRoot" .Values.redis.image "global" .Values.global) }}
{{- end -}}
{{- end -}}

{{/*
Return the proper Redis wait image name
*/}}
{{- define "netbox.redisWait.image" -}}
{{- if .Values.redis.enabled -}}
{{- include "redis.image" .Subcharts.redis -}}
{{- else -}}
{{ include "common.images.image" ( dict "imageRoot" .Values.redisWait.image "global" .Values.global ) }}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/netbox/templates/metrics/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Service
metadata:
name: {{ printf "%s-metrics" (include "netbox.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.image "chart" .Chart ) ) }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" ( dict "imageRoot" .Values.image "global" .Values.global "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" (list .Values.metrics.labels .Values.commonLabels $versionLabel) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: metrics
Expand Down
2 changes: 1 addition & 1 deletion charts/netbox/templates/metrics/ServiceMonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceMonitor
metadata:
name: {{ template "netbox.fullname" . }}
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.serviceMonitor.namespace | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.image "chart" .Chart ) ) }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" ( dict "imageRoot" .Values.image "global" .Values.global "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.serviceMonitor.labels .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: server
Expand Down
2 changes: 1 addition & 1 deletion charts/netbox/templates/worker/Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Deployment
metadata:
name: {{ template "netbox.worker.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.worker.image "chart" .Chart ) ) }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" (dict "imageRoot" .Values.worker.image "global" .Values.global "chart" .Chart) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: worker
Expand Down
2 changes: 1 addition & 1 deletion charts/netbox/templates/worker/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Service
metadata:
name: {{ printf "%s-metrics" (include "netbox.worker.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.worker.image "chart" .Chart ) ) }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" (dict "imageRoot" .Values.worker.image "global" .Values.global "chart" .Chart) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" (list .Values.metrics.labels .Values.commonLabels $versionLabel) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: worker-metrics
Expand Down
Loading

0 comments on commit 5b8b9e5

Please sign in to comment.