Update netbox chart

This commit is contained in:
Alexander Olofsson 2019-05-21 17:47:36 +02:00
parent 62645909da
commit 7705a2c2a8
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
13 changed files with 262 additions and 101 deletions

View file

@ -28,7 +28,7 @@ spec:
- host: {{ .Values.ingress.host | quote }} - host: {{ .Values.ingress.host | quote }}
http: http:
paths: paths:
- path: - path: /
backend: backend:
serviceName: {{ $fullName }}-front serviceName: {{ $fullName }}-front
servicePort: http servicePort: http

View file

@ -0,0 +1,6 @@
dependencies:
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com/
version: 7.1.1
digest: sha256:5a2449433325c0e819134bdcd7bd7ab463975b9b529c8516a9ff030547140bf6
generated: 2019-05-21T09:47:18.817171504+02:00

View file

@ -0,0 +1,4 @@
dependencies:
- name: redis
version: 7.1.1
repository: https://kubernetes-charts.storage.googleapis.com/

View file

@ -6,6 +6,10 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{- define "netbox.redisHost" -}}
{{ template "netbox.fullname" . }}-redis-master
{{- end -}}
{{/* {{/*
Create a default fully qualified app name. 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). We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).

View file

@ -8,6 +8,18 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
data: data:
{{- range $key, $value := .Values.env.configuration }} DB_NAME: {{ .Values.database.database }}
DB_USER: {{ .Values.database.user }}
DB_HOST: {{ .Values.database.host }}
DB_PORT: {{ .Values.database.port | quote }}
REDIS_HOST: {{ include "netbox.redisHost" . }}
REDIS_PORT: {{ .Values.redis.redisPort | quote }}
REDIS_SSL: "false"
SUPERUSER_NAME: {{ .Values.superuser.name }}
SUPERUSER_EMAIL: {{ .Values.superuser.email }}
{{- range $key, $value := .Values.extraEnv }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}

View file

@ -0,0 +1,103 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "netbox.fullname" . }}-front
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 }}
com.digitalocean.netbox/component: front
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "netbox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
com.digitalocean.netbox/component: front
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "netbox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
com.digitalocean.netbox/component: front
spec:
initContainers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- sh
- -c
- |
cp /etc/netbox-nginx/* /tmp/netbox-nginx
sed -e 's!http://netbox:8001!http://{{ include "netbox.fullname" . }}-api:8001!' -i /tmp/netbox-nginx/nginx.conf
cp -r /opt/netbox/netbox/project-static/* \
/usr/local/lib/python3.6/site-packages/django/contrib/admin/static/* \
/usr/local/lib/python3.6/site-packages/debug_toolbar/static/* \
/usr/local/lib/python3.6/site-packages/django_tables2/static/* \
/usr/local/lib/python3.6/site-packages/drf_yasg/static/* \
/usr/local/lib/python3.6/site-packages/mptt/static/* \
/usr/local/lib/python3.6/site-packages/rest_framework/static/* \
/tmp/netbox-static
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: netbox-nginx-config
mountPath: /tmp/netbox-nginx
- name: netbox-static-files
mountPath: /tmp/netbox-static
# - name: netbox-configuration
# path: /etc/netbox/config
# readOnly: true
# - name: netbox-initializers
# path: /opt/netbox/initializers
# readOnly: true
# - name: netbox-startup-scripts
# path: /opt/netbox/startup_scripts
# readOnly: true
# - name: netbox-reports
# path: /opt/netbox/reports
# readOnly: true
containers:
- name: nginx
image: "nginx:alpine"
imagePullPolicy: Always
command:
- nginx
- -c
- /etc/netbox-nginx/nginx.conf
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
tcpSocket:
port: http
readinessProbe:
tcpSocket:
port: http
volumeMounts:
- name: netbox-nginx-config
mountPath: /etc/netbox-nginx
readOnly: true
- name: netbox-static-files
mountPath: /opt/netbox/netbox/static
readOnly: true
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: netbox-nginx-config
emptyDir: {}
- name: netbox-static-files
emptyDir: {}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View file

@ -7,17 +7,23 @@ metadata:
helm.sh/chart: {{ include "netbox.chart" . }} helm.sh/chart: {{ include "netbox.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
com.digitalocean.netbox/component: api
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: {{ include "netbox.name" . }} app.kubernetes.io/name: {{ include "netbox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
com.digitalocean.netbox/component: api
template: template:
metadata: metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configuration.yaml") . | sha256sum }}
checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
labels: labels:
app.kubernetes.io/name: {{ include "netbox.name" . }} app.kubernetes.io/name: {{ include "netbox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
com.digitalocean.netbox/component: api
spec: spec:
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
@ -28,20 +34,22 @@ spec:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
- secretRef: - secretRef:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
livenessProbe: # livenessProbe:
httpGet: # httpGet:
path: / # path: /
port: 8001 # port: api
# initialDelaySeconds: 50
# failureThreshold: 5
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: 8001 port: api
ports:
- name: api
containerPort: 8001
protocol: TCP
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
volumeMounts: volumeMounts: []
- name: netbox-nginx-config
mountPath: /etc/netbox-nginx
- name: netbox-static-files
mountPath: /opt/netbox/netbox/static
# - name: netbox-configuration # - name: netbox-configuration
# path: /etc/netbox/config # path: /etc/netbox/config
# readOnly: true # readOnly: true
@ -54,27 +62,6 @@ spec:
# - name: netbox-reports # - name: netbox-reports
# path: /opt/netbox/reports # path: /opt/netbox/reports
# readOnly: true # readOnly: true
- name: nginx
image: "nginx:alpine"
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
tcpSocket:
port: http
volumeMounts:
- name: netbox-nginx-config
mountPath: /etc/netbox-nginx
readOnly: true
- name: netbox-static-files
mountPath: /opt/netbox/netbox/static
readOnly: true
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
@ -92,10 +79,6 @@ spec:
# - name: netbox-startup-scripts # - name: netbox-startup-scripts
# configMap: # configMap:
# name: {{ .Chart.Name }}-startup-scripts # name: {{ .Chart.Name }}-startup-scripts
- name: netbox-nginx-config
emptyDir: {}
- name: netbox-static-files
emptyDir: {}
- name: netbox-media-files - name: netbox-media-files
emptyDir: {} emptyDir: {}
{{- with .Values.affinity }} {{- with .Values.affinity }}

View file

@ -25,15 +25,11 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range .Values.ingress.hosts }} - host: {{ .Values.ingress.host | quote }}
- host: {{ .host | quote }}
http: http:
paths: paths:
{{- range .paths }} - path: /
- path: {{ . }}
backend: backend:
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: http servicePort: http
{{- end }}
{{- end }}
{{- end }} {{- end }}

View file

@ -8,6 +8,13 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
data: data:
{{- range $key, $value := .Values.env.secrets }} DB_PASSWORD: {{ .Values.database.password | b64enc }}
REDIS_PASSWORD: {{ .Values.redis.password | b64enc }}
SECRET_KEY: {{ .Values.djangoSecret | b64enc }}
SUPERUSER_API_TOKEN: {{ .Values.superuser.apiToken | b64enc }}
SUPERUSER_PASSWORD: {{ .Values.superuser.password | b64enc }}
{{- range $key, $value := .Values.extraSecrets }}
{{ $key }}: {{ $value | b64enc | quote }} {{ $key }}: {{ $value | b64enc | quote }}
{{- end }} {{- end }}

View file

@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "netbox.fullname" . }}-api
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 }}
com.digitalocean.netbox/component: api
spec:
type: ClusterIP
ports:
- port: 8001
targetPort: api
protocol: TCP
name: api
selector:
app.kubernetes.io/name: {{ include "netbox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
com.digitalocean.netbox/component: api

View file

@ -7,6 +7,7 @@ metadata:
helm.sh/chart: {{ include "netbox.chart" . }} helm.sh/chart: {{ include "netbox.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
com.digitalocean.netbox/component: front
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
@ -17,3 +18,4 @@ spec:
selector: selector:
app.kubernetes.io/name: {{ include "netbox.name" . }} app.kubernetes.io/name: {{ include "netbox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
com.digitalocean.netbox/component: front

View file

@ -36,36 +36,36 @@ spec:
name: {{ include "netbox.fullname" . }} name: {{ include "netbox.fullname" . }}
resources: resources:
{{- toYaml .Values.worker.resources | nindent 12 }} {{- toYaml .Values.worker.resources | nindent 12 }}
volumeMounts: volumeMounts: []
- name: netbox-configuration # - name: netbox-configuration
path: /etc/netbox/config # path: /etc/netbox/config
readOnly: true # readOnly: true
- name: netbox-initializers # - name: netbox-initializers
path: /opt/netbox/initializers # path: /opt/netbox/initializers
readOnly: true # readOnly: true
- name: netbox-startup-scripts # - name: netbox-startup-scripts
path: /opt/netbox/startup_scripts # path: /opt/netbox/startup_scripts
readOnly: true # readOnly: true
- name: netbox-reports # - name: netbox-reports
path: /opt/netbox/reports # path: /opt/netbox/reports
readOnly: true # readOnly: true
{{- with .Values.worker.nodeSelector }} {{- with .Values.worker.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes: []
- name: netbox-configuration # - name: netbox-configuration
configMap: # configMap:
name: {{ .Chart.Name }}-configuration # name: {{ .Chart.Name }}-configuration
- name: netbox-initializers # - name: netbox-initializers
configMap: # configMap:
name: {{ .Chart.Name }}-initializers # name: {{ .Chart.Name }}-initializers
- name: netbox-reports # - name: netbox-reports
configMap: # configMap:
name: {{ .Chart.Name }}-reports # name: {{ .Chart.Name }}-reports
- name: netbox-startup-scripts # - name: netbox-startup-scripts
configMap: # configMap:
name: {{ .Chart.Name }}-startup-scripts # name: {{ .Chart.Name }}-startup-scripts
{{- with .Values.worker.affinity }} {{- with .Values.worker.affinity }}
affinity: affinity:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View file

@ -6,37 +6,9 @@ replicaCount: 1
image: image:
repository: netboxcommunity/netbox repository: netboxcommunity/netbox
tag: v2.5 tag: develop-2.6-ldap
pullPolicy: Always pullPolicy: Always
env:
configuration:
DB_NAME: netbox
DB_USER: netbox
DB_HOST: localhost
EMAIL_SERVER: localhost
EMAIL_PORT: 25
EMAIL_USERNAME: netbox
EMAIL_TIMEOUT: 5
EMAIL_FROM: netbox@example.com
MEDIA_ROOT: /opt/netbox/netbox/media
NAPALM_USERNAME: ''
NAPALM_PASSWORD: ''
NAPALM_TIMEOUT: 10
MAX_PAGE_SIZE: 1000
REDIS_HOST: redis
SUPERUSER_NAME: admin
SUPERUSER_EMAIL: admin@example.com
WEBHOOKS_ENABLED: true
secrets:
DB_PASSWORD: netbox
EMAIL_PASSWORD: netbox
REDIS_PASSWORD: redis
SECRET_KEY: 0123456789abcdef0123456789abcdef01234567
SUPERUSER_PASSWORD: admin
SUPERUSER_API_TOKEN: 0123456789abcdef0123456789abcdef01234567
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
@ -58,6 +30,57 @@ ingress:
# hosts: # hosts:
# - chart-example.local # - chart-example.local
database:
## Database host
host: localhost
## Database port
port: 5432
## Database user
user: netbox
## Database password
password: netbox
## Database name
database: netbox
redis:
cluster:
enabled: false
master:
persistence:
enabled: false
slave:
persistence:
enabled: false
password: netbox
redisPort: 6379
djangoSecret: ''
extraEnv: {}
# EMAIL_SERVER: localhost
# EMAIL_PORT: 25
# 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: ''
superuser:
name: ''
email: ''
apiToken: ''
password: ''
resources: {} resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little # choice for the user. This also increases chances charts run on environments with little