netbox plugions kaniko ?

This commit is contained in:
2026-03-27 21:18:05 +00:00
parent f36b09def3
commit 49c47e57aa
5 changed files with 161 additions and 0 deletions

35
kaniko/build-netbox.yaml Normal file
View 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
View 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

View File

@@ -0,0 +1,3 @@
netbox-topology-views
netbox-plugin-dns
netbox-routing

View File

@@ -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