netbox plugions kaniko ?
This commit is contained in:
35
kaniko/build-netbox.yaml
Normal file
35
kaniko/build-netbox.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: kaniko-build-netbox
|
||||
namespace: kaniko
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: kaniko-build-netbox
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: kaniko
|
||||
image: gcr.io/kaniko-project/executor:v1.23.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- --context=git://gitea.apps.undercloud.dev/Undercloud/k8s-apps.git
|
||||
- --dockerfile=netbox/image/Dockerfile
|
||||
- --destination=docker-repo.apps.undercloud.dev/library/netbox-custom:latest
|
||||
- --cleanup
|
||||
- --skip-tls-verify
|
||||
- --skip-tls-verify-pull
|
||||
- --insecure-registry=docker-repo.apps.undercloud.dev
|
||||
volumeMounts:
|
||||
- name: docker-config
|
||||
mountPath: /kaniko/.docker
|
||||
volumes:
|
||||
- name: docker-config
|
||||
secret:
|
||||
secretName: harbor-creds
|
||||
items:
|
||||
- key: .dockerconfigjson
|
||||
path: config.json
|
||||
12
netbox/image/Dockerfile
Normal file
12
netbox/image/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM ghcr.io/netbox-community/netbox:latest
|
||||
|
||||
USER root
|
||||
|
||||
# needed for topology views
|
||||
RUN mkdir -p /opt/netbox/netbox/static/netbox_topology_views/img
|
||||
|
||||
COPY requirements-plugins.txt /tmp/requirements-plugins.txt
|
||||
|
||||
RUN /opt/netbox/venv/bin/pip install --no-cache-dir -r /tmp/requirements-plugins.txt
|
||||
|
||||
USER unit
|
||||
3
netbox/image/requirements-plugins.txt
Normal file
3
netbox/image/requirements-plugins.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
netbox-topology-views
|
||||
netbox-plugin-dns
|
||||
netbox-routing
|
||||
@@ -1,3 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: netbox-plugins
|
||||
namespace: netbox
|
||||
data:
|
||||
plugins.py: |
|
||||
PLUGINS = [
|
||||
"netbox_topology_views",
|
||||
"netbox_dns",
|
||||
"netbox_routing",
|
||||
]
|
||||
|
||||
PLUGINS_CONFIG = {
|
||||
"netbox_topology_views": {},
|
||||
"netbox_dns": {},
|
||||
"netbox_routing": {},
|
||||
}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
@@ -100,6 +118,96 @@ spec:
|
||||
failureThreshold: 30
|
||||
periodSeconds: 10
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: netbox
|
||||
namespace: netbox
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: netbox
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: netbox
|
||||
spec:
|
||||
containers:
|
||||
- name: netbox
|
||||
image: docker-repo.apps.undercloud.dev/library/netbox-custom:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
env:
|
||||
- name: SUPERUSER_NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: netbox-superuser
|
||||
key: username
|
||||
- name: SUPERUSER_EMAIL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: netbox-superuser
|
||||
key: email
|
||||
- name: SUPERUSER_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: netbox-superuser
|
||||
key: password
|
||||
|
||||
- name: DB_NAME
|
||||
value: netbox
|
||||
- name: DB_HOST
|
||||
value: db
|
||||
- name: DB_PORT
|
||||
value: "5432"
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: netbox-db
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: netbox-db
|
||||
key: user.pw
|
||||
- name: DB_WAIT_DEBUG
|
||||
value: "1"
|
||||
|
||||
- name: REDIS_HOST
|
||||
value: redis
|
||||
- name: REDIS_PORT
|
||||
value: "6379"
|
||||
- name: REDIS_CACHE_HOST
|
||||
value: redis
|
||||
- name: REDIS_CACHE_PORT
|
||||
value: "6379"
|
||||
|
||||
- name: SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: netbox-secrets
|
||||
key: SECRET_KEY
|
||||
|
||||
- name: ALLOWED_HOSTS
|
||||
value: "*"
|
||||
|
||||
volumeMounts:
|
||||
- name: netbox-data
|
||||
mountPath: /opt/netbox/netbox/media
|
||||
- name: netbox-plugins-config
|
||||
mountPath: /etc/netbox/config/plugins.py
|
||||
subPath: plugins.py
|
||||
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
failureThreshold: 30
|
||||
periodSeconds: 10
|
||||
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
@@ -118,6 +226,9 @@ spec:
|
||||
- name: netbox-data
|
||||
persistentVolumeClaim:
|
||||
claimName: netbox
|
||||
- name: netbox-plugins-config
|
||||
configMap:
|
||||
name: netbox-plugins
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
|
||||
Reference in New Issue
Block a user