wiede zurück

This commit is contained in:
2026-03-24 13:53:44 +00:00
parent 6371f21dd0
commit 82144b6e2c

View File

@@ -11,49 +11,6 @@ spec:
requests:
storage: 64Gi
storageClassName: cephfs-hyper
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: netbox-venv
namespace: netbox
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 4Gi
storageClassName: cephfs-hyper
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: netbox-static
namespace: netbox
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 4Gi
storageClassName: cephfs-hyper
---
apiVersion: v1
kind: ConfigMap
metadata:
name: netbox-plugins
namespace: netbox
data:
plugins.py: |
PLUGINS = [
"netbox_topology_views",
]
PLUGINS_CONFIG = {}
---
apiVersion: apps/v1
kind: Deployment
@@ -70,40 +27,6 @@ spec:
labels:
app: netbox
spec:
initContainers:
- name: install-topology-plugin
image: netboxcommunity/netbox:latest
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- -ec
- |
set -e
echo "Initializing persistent venv..."
if [ ! -x /venv/bin/python ]; then
mkdir -p /venv
cp -a /opt/netbox/venv/. /venv/
fi
echo "Ensuring pip exists..."
/venv/bin/python -m ensurepip --upgrade
# optional but recommended
/venv/bin/python -m pip install --upgrade pip setuptools wheel
echo "Installing plugin..."
/venv/bin/pip install --no-cache-dir netbox-topology-views
mkdir -p /static/netbox_topology_views/img
volumeMounts:
- name: netbox-venv
mountPath: /persistent-venv
- name: netbox-static
mountPath: /static
containers:
- name: netbox
image: netboxcommunity/netbox:latest
@@ -111,11 +34,7 @@ spec:
ports:
- containerPort: 8080
name: http
env:
- name: PATH
value: /venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: SUPERUSER_NAME
valueFrom:
secretKeyRef:
@@ -133,7 +52,6 @@ spec:
secretKeyRef:
name: netbox-superuser
key: password
- name: DB_NAME
value: netbox
- name: DB_HOST
@@ -171,37 +89,9 @@ spec:
- name: ALLOWED_HOSTS
value: "*"
command:
- /bin/bash
- -ec
- |
set -e
export PYTHON=/venv/bin/python
echo "Running migrations..."
$PYTHON /opt/netbox/netbox/manage.py migrate
echo "Collecting static files..."
mkdir -p /opt/netbox/netbox/static
rm -rf /opt/netbox/netbox/static/*
cp -a /static/. /opt/netbox/netbox/static/ 2>/dev/null || true
$PYTHON /opt/netbox/netbox/manage.py collectstatic --no-input
cp -a /opt/netbox/netbox/static/. /static/
echo "Starting NetBox..."
exec /opt/netbox/launch-netbox.sh
volumeMounts:
- name: netbox-data
mountPath: /opt/netbox/netbox/media
- name: netbox-venv
mountPath: /venv
- name: netbox-static
mountPath: /static
- name: netbox-plugins
mountPath: /etc/netbox/config/plugins.py
subPath: plugins.py
startupProbe:
httpGet:
@@ -228,15 +118,6 @@ spec:
- name: netbox-data
persistentVolumeClaim:
claimName: netbox
- name: netbox-venv
persistentVolumeClaim:
claimName: netbox-venv
- name: netbox-static
persistentVolumeClaim:
claimName: netbox-static
- name: netbox-plugins
configMap:
name: netbox-plugins
---
apiVersion: v1