Add helm chart
This commit is contained in:
parent
ce9158eb07
commit
b9c35fb62f
19 changed files with 656 additions and 0 deletions
22
helm/.helmignore
Normal file
22
helm/.helmignore
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
6
helm/Chart.yaml
Normal file
6
helm/Chart.yaml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
appVersion: "2.5.2"
|
||||||
|
description: A Helm chart for Netbox
|
||||||
|
name: netbox
|
||||||
|
version: 0.1.0
|
1
helm/charts/.gitignore
vendored
Normal file
1
helm/charts/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.tgz
|
9
helm/requirements.lock
Normal file
9
helm/requirements.lock
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
dependencies:
|
||||||
|
- name: postgresql
|
||||||
|
repository: https://kubernetes-charts.storage.googleapis.com/
|
||||||
|
version: 6.3.2
|
||||||
|
- name: redis
|
||||||
|
repository: https://kubernetes-charts.storage.googleapis.com/
|
||||||
|
version: 9.1.3
|
||||||
|
digest: sha256:f67eaa0ded0a461e8e238bdba5b74e120e7b2ad101d7f0e78da259be4d2c8f61
|
||||||
|
generated: 2019-08-27T14:47:56.664093046Z
|
10
helm/requirements.yaml
Normal file
10
helm/requirements.yaml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- name: postgresql
|
||||||
|
version: '>=3.9.1'
|
||||||
|
repository: https://kubernetes-charts.storage.googleapis.com/
|
||||||
|
condition: postgresql.enabled
|
||||||
|
- name: redis
|
||||||
|
version: '>=9.1.2'
|
||||||
|
repository: https://kubernetes-charts.storage.googleapis.com/
|
||||||
|
condition: redis.enabled
|
21
helm/templates/NOTES.txt
Normal file
21
helm/templates/NOTES.txt
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
1. Get the application URL by running these commands:
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
{{- range $host := .Values.ingress.hosts }}
|
||||||
|
{{- range $.Values.ingress.paths }}
|
||||||
|
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if contains "NodePort" .Values.service.type }}
|
||||||
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "netbox.fullname" . }})
|
||||||
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||||
|
echo http://$NODE_IP:$NODE_PORT
|
||||||
|
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||||
|
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||||
|
You can watch the status of by running 'kubectl get svc -w {{ include "netbox.fullname" . }}'
|
||||||
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "netbox.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||||
|
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||||
|
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||||
|
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "netbox.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||||
|
kubectl port-forward $POD_NAME 8080:80
|
||||||
|
{{- end }}
|
37
helm/templates/_helpers.tpl
Normal file
37
helm/templates/_helpers.tpl
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "netbox.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "netbox.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride -}}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||||
|
{{- if contains $name .Release.Name -}}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "netbox.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "redis.child.fullname" }}
|
||||||
|
{{- $redis := (dict "Release" (dict "Name" .Release.Name) "Chart" (dict "Name" "redis") "Values" (index .Values "redis")) }}
|
||||||
|
{{ template "redis.fullname" $redis }}
|
||||||
|
{{- end }}
|
125
helm/templates/_netbox.tpl
Normal file
125
helm/templates/_netbox.tpl
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
{{- define "netbox.common" -}}
|
||||||
|
{{- $postgresql := (dict "Release" (dict "Name" .Release.Name) "Chart" (dict "Name" "postgresql") "Values" (index .Values.postgresql)) }}
|
||||||
|
{{- $netboxEnv := include (print $.Template.BasePath "/netbox-env.yaml") . }}
|
||||||
|
{{- $netboxSecretEnv := include (print $.Template.BasePath "/netbox-secret-env.yaml") . }}
|
||||||
|
{{- $nginxConfig := include (print $.Template.BasePath "/nginx-config.yaml") . }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
annotations:
|
||||||
|
checksum/config: {{ print "%s%s%s" $netboxEnv $netboxSecretEnv $nginxConfig | sha256sum }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | indent 12 }}
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: "{{ include "netbox.fullname" . }}-env"
|
||||||
|
- secretRef:
|
||||||
|
name: "{{ include "netbox.fullname" . }}-env"
|
||||||
|
{{- if or (or .Values.postgresql.enabled .Values.redis.enabled) .Values.redis.existingSecret }}
|
||||||
|
env:
|
||||||
|
{{- if .Values.postgresql.enabled }}
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: "{{ include "postgresql.fullname" $postgresql }}"
|
||||||
|
key: "postgresql-password"
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.redis.enabled .Values.redis.existingSecret }}
|
||||||
|
- name: REDIS_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if .Values.redis.existingSecret }}
|
||||||
|
name: {{ .Values.redis.existingSecret | quote}}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ include "redis.child.fullname" . | trim | quote }}
|
||||||
|
{{- end }}
|
||||||
|
key: 'redis-password'
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: netbox-static-files
|
||||||
|
mountPath: /opt/netbox/netbox/static/
|
||||||
|
- name: netbox-media-files
|
||||||
|
mountPath: /etc/netbox/media
|
||||||
|
{{- if .Values.initializers }}
|
||||||
|
- name: netbox-initializers
|
||||||
|
mountPath: /opt/netbox/initializers/
|
||||||
|
{{- end }}
|
||||||
|
{{- range $mount := .Values.extraVolumeMounts }}
|
||||||
|
- {{ $mount | toYaml | indent 10 | trim }}
|
||||||
|
{{- end }}
|
||||||
|
- name: nginx
|
||||||
|
image: "{{ .Values.nginxImage.repository }}:{{ .Values.nginxImage.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.nginxImage.pullPolicy }}
|
||||||
|
command: ["nginx"]
|
||||||
|
args: ["-c", "/etc/netbox-nginx/nginx.conf", "-g", "daemon off;"]
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 80
|
||||||
|
protocol: TCP
|
||||||
|
{{- with .Values.livenessProbe }}
|
||||||
|
livenessProbe:
|
||||||
|
{{ . | toYaml | indent 10 | trim }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.readinessProbe }}
|
||||||
|
readinessProbe:
|
||||||
|
{{ . | toYaml | indent 10 | trim }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: nginx-config
|
||||||
|
mountPath: /etc/netbox-nginx/
|
||||||
|
- name: netbox-static-files
|
||||||
|
mountPath: /opt/netbox/netbox/static
|
||||||
|
{{- range $container := .Values.extraContainers }}
|
||||||
|
- {{ $container | toYaml | indent 8 | trim }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraInitContainers }}
|
||||||
|
initContainers:
|
||||||
|
{{ toYaml .Values.extraInitContainers | nindent 4}}
|
||||||
|
{{- end }}
|
||||||
|
restartPolicy: {{ .Values.restartPolicy }}
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
{{- range $volume := .Values.extraVolumes }}
|
||||||
|
- {{ $volume | toYaml | indent 6 | trim }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.initializers }}
|
||||||
|
- name: netbox-initializers
|
||||||
|
configMap:
|
||||||
|
name: {{ include "netbox.fullname" . }}-initializers
|
||||||
|
{{- end }}
|
||||||
|
- name: nginx-config
|
||||||
|
configMap:
|
||||||
|
name: {{ include "netbox.fullname" . }}-nginx
|
||||||
|
- name: netbox-config-file
|
||||||
|
configMap:
|
||||||
|
name: {{ include "netbox.fullname" . }}-nginx
|
||||||
|
- name: netbox-static-files
|
||||||
|
emptyDir: {}
|
||||||
|
{{- if not .Values.persistence.enabled }}
|
||||||
|
- name: netbox-media-files
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
20
helm/templates/deployment.yaml
Normal file
20
helm/templates/deployment.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{{- if eq .Values.kind "Deployment" }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- with .Values.extraLabels }}
|
||||||
|
{{ . | toYaml | trim | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.deployment.replicaCount }}
|
||||||
|
{{ include "netbox.common" . | indent 2 }}
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
{{ required "With Deployment, .Values.persistence.customClaim is required for persistence" .Values.persistence.customClaim | toYaml | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
45
helm/templates/ingress.yaml
Normal file
45
helm/templates/ingress.yaml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{{- if .Values.ingress.enabled -}}
|
||||||
|
{{- $fullName := include "netbox.fullname" . -}}
|
||||||
|
{{- $ingressPaths := .Values.ingress.paths -}}
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $fullName }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- if or .Values.ingress.annotations (and .Values.ingress.isNginx .Values.nginx.proxyBodySize) }}
|
||||||
|
annotations:
|
||||||
|
{{- if and .Values.ingress.isNginx .Values.nginx.proxyBodySize }}
|
||||||
|
nginx.ingress.kubernetes.io/proxy-body-size: '{{ .Values.nginx.proxyBodySize }}'
|
||||||
|
{{ end }}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
- host: {{ . | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range $ingressPaths }}
|
||||||
|
- path: {{ . }}
|
||||||
|
backend:
|
||||||
|
serviceName: {{ $fullName }}
|
||||||
|
servicePort: http
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
31
helm/templates/netbox-env.yaml
Normal file
31
helm/templates/netbox-env.yaml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}-env
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
data:
|
||||||
|
{{- if .Values.postgresql.host }}
|
||||||
|
DB_HOST: '{{ .Values.postgresql.host }}'
|
||||||
|
{{- else }}
|
||||||
|
DB_HOST: '{{ .Release.Name }}-postgresql'
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.host }}
|
||||||
|
REDIS_HOST: '{{ .Values.redis.host }}'
|
||||||
|
{{- else }}
|
||||||
|
REDIS_HOST: '{{ include "redis.child.fullname" . | trim }}-master'
|
||||||
|
{{- end }}
|
||||||
|
DB_NAME: '{{ .Values.postgresql.postgresqlDatabase }}'
|
||||||
|
ALLOWED_HOSTS: '{{ .Values.allowedHosts }}'
|
||||||
|
EMAIL_FROM: '{{ .Values.emailFrom }}'
|
||||||
|
EMAIL_PORT: '{{ .Values.emailPort }}'
|
||||||
|
EMAIL_SERVER: '{{ .Values.emailServer }}'
|
||||||
|
EMAIL_TIMEOUT: '{{ .Values.emailTimeout }}'
|
||||||
|
SUPERUSER_NAME: '{{ .Values.superuser.name }}'
|
||||||
|
SUPERUSER_EMAIL: '{{ .Values.superuser.email }}'
|
||||||
|
{{- range $key, $value := .Values.extraEnvs }}
|
||||||
|
{{ $key }}: '{{ $value }}'
|
||||||
|
{{- end }}
|
16
helm/templates/netbox-initializers.yaml
Normal file
16
helm/templates/netbox-initializers.yaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{{- if .Values.initializers }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}-initializers
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
data:
|
||||||
|
{{- range $key, $value := .Values.initializers }}
|
||||||
|
{{ $key }}: |
|
||||||
|
{{ $value | indent 4 | trim }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
41
helm/templates/netbox-secret-env.yaml
Normal file
41
helm/templates/netbox-secret-env.yaml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}-env
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
data:
|
||||||
|
DB_USER: {{ .Values.postgresql.postgresqlUsername | b64enc | quote }}
|
||||||
|
{{- if not .Values.postgresql.enabled }}
|
||||||
|
DB_PASSWORD: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.password }}
|
||||||
|
REDIS_PASSWORD: {{ .Values.redis.password |b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.secretKey }}
|
||||||
|
SECRET_KEY: {{ .Values.secretKey | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
SECRET_KEY: {{ randAscii 50 | trimall "'" | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.emailUsername }}
|
||||||
|
EMAIL_USERNAME: {{ . | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.emailPassword }}
|
||||||
|
EMAIL_PASSWORD: {{ . | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.superuser.password }}
|
||||||
|
SUPERUSER_PASSWORD: {{ .Values.superuser.password | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
SUPERUSER_PASSWORD: {{ randAscii 10 | trimall "'" | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.superuser.token }}
|
||||||
|
SUPERUSER_TOKEN: {{ .Values.superuser.token | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
SUPERUSER_TOKEN: {{ randAscii 40 | trimall "'" | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.extraSecretEnvs }}
|
||||||
|
{{ $key }}: {{ $value | b64enc | quote }}
|
||||||
|
{{- end }}
|
15
helm/templates/netbox-secret.yaml
Normal file
15
helm/templates/netbox-secret.yaml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{{- if .Values.extraSecrets }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}-secret
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
data:
|
||||||
|
{{- range $key, $value := .Values.extraSecrets }}
|
||||||
|
{{ $key }}: {{ $value | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
45
helm/templates/nginx-config.yaml
Normal file
45
helm/templates/nginx-config.yaml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}-nginx
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
data:
|
||||||
|
nginx.conf: |
|
||||||
|
{{- if .Values.nginx.customConfig }}
|
||||||
|
{{ .Values.nginx.customConfig | indent 4 }}
|
||||||
|
{{- else }}
|
||||||
|
worker_processes 1;
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
gzip on;
|
||||||
|
server_tokens off;
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
access_log off;
|
||||||
|
location /static/ {
|
||||||
|
alias /opt/netbox/netbox/static/;
|
||||||
|
}
|
||||||
|
location / {
|
||||||
|
proxy_pass {{ .Values.nginx.proxyPass }};
|
||||||
|
{{- with .Values.nginx.proxyBodySize }}
|
||||||
|
client_max_body_size {{.}};
|
||||||
|
{{- end }}
|
||||||
|
proxy_set_header X-Forwarded-Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{- end }}
|
19
helm/templates/service.yaml
Normal file
19
helm/templates/service.yaml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.service.port }}
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
51
helm/templates/statefulset.yaml
Normal file
51
helm/templates/statefulset.yaml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{{- if eq .Values.kind "StatefulSet" }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ include "netbox.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- with .Values.extraLabels }}
|
||||||
|
{{ . | toYaml | trim | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.statefulSet.replicaCount }}
|
||||||
|
{{- with .Values.statefulSet.updateStrategy }}
|
||||||
|
updateStrategy:
|
||||||
|
{{ . | toYaml | trim |indent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceName: 'netbox'
|
||||||
|
{{ include "netbox.common" . | indent 2 }}
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
{{- if .Values.persistence.customClaim }}
|
||||||
|
{{ .Values.persistence.customClaim | toYaml | nindent 4 }}
|
||||||
|
{{- else }}
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- spec:
|
||||||
|
accessModes:
|
||||||
|
{{- range .Values.persistence.accessModes }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: "{{.Values.persistence.size }}"
|
||||||
|
{{- if .Values.persistence.storageClass }}
|
||||||
|
{{- if (eq "-" .Values.server.persistence.storageClass) }}
|
||||||
|
storageClassName: ""
|
||||||
|
{{- else }}
|
||||||
|
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
metadata:
|
||||||
|
name: netbox-media-files
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
18
helm/templates/tests/test-connection.yaml
Normal file
18
helm/templates/tests/test-connection.yaml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: "{{ include "netbox.fullname" . }}-test-connection"
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "netbox.name" . }}
|
||||||
|
helm.sh/chart: {{ include "netbox.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": test-success
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wget
|
||||||
|
image: busybox
|
||||||
|
command: ['wget']
|
||||||
|
args: ['{{ include "netbox.fullname" . }}:{{ .Values.service.port }}']
|
||||||
|
restartPolicy: Never
|
124
helm/values.yaml
Normal file
124
helm/values.yaml
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
---
|
||||||
|
# Default values for netbox.
|
||||||
|
#
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
|
||||||
|
kind: StatefulSet
|
||||||
|
|
||||||
|
statefulSet:
|
||||||
|
## Warning if you change replicaCount on statefulset
|
||||||
|
# You need
|
||||||
|
replicaCount: 1
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
accessModes:
|
||||||
|
- 'ReadWriteOnce'
|
||||||
|
size: "5G"
|
||||||
|
storageClassName:
|
||||||
|
|
||||||
|
deployment:
|
||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
extraLabels: {}
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: netboxcommunity/netbox
|
||||||
|
tag: v2.6.2
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
nginxImage:
|
||||||
|
repository: nginx
|
||||||
|
tag: 1.17.3-alpine
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
restartPolicy: Always
|
||||||
|
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
initializers: {}
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
isNginx: true
|
||||||
|
annotations: {}
|
||||||
|
paths:
|
||||||
|
- /
|
||||||
|
hosts:
|
||||||
|
- netbox.local
|
||||||
|
tls: []
|
||||||
|
# - secretName: netbox
|
||||||
|
# hosts:
|
||||||
|
# - netbox.local
|
||||||
|
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
proxyBodySize:
|
||||||
|
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /api/
|
||||||
|
port: http
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /api/
|
||||||
|
port: http
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
||||||
|
|
||||||
|
allowedHosts: "*"
|
||||||
|
emailFrom:
|
||||||
|
emailServer:
|
||||||
|
emailPort: 25
|
||||||
|
emailTimeout: 10
|
||||||
|
emailUsername: ""
|
||||||
|
emailPassword: ""
|
||||||
|
|
||||||
|
secretKey:
|
||||||
|
|
||||||
|
superuser:
|
||||||
|
email: admin@example.com
|
||||||
|
name: admin
|
||||||
|
password:
|
||||||
|
token:
|
||||||
|
|
||||||
|
extraEnvs: {}
|
||||||
|
extraSecretEnvs: {}
|
||||||
|
extraSecrets: {}
|
||||||
|
extraVolumes: []
|
||||||
|
extraVolumeMounts: []
|
||||||
|
extraContainers: []
|
||||||
|
extraInitContainers: []
|
||||||
|
extraStartupScripts: []
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
proxyBodySize:
|
||||||
|
customConfig:
|
||||||
|
proxyPass: http://localhost:8001
|
||||||
|
|
||||||
|
postgresql:
|
||||||
|
enabled: true
|
||||||
|
host:
|
||||||
|
postgresqlUsername: netbox
|
||||||
|
postgresqlDatabase: netbox
|
||||||
|
|
||||||
|
redis:
|
||||||
|
cluster:
|
||||||
|
enabled: false
|
||||||
|
enabled: true
|
||||||
|
host:
|
Loading…
Add table
Add a link
Reference in a new issue