---
# Example: Custom Plugins from PVC Wheelhouse
#
# This example demonstrates how to install custom Python plugins from a wheelhouse
# tarball stored in a PersistentVolumeClaim (PVC).
#
# The operator automatically creates the PVC when `create: true` is specified.
#
# ## Workflow
#
# 1. Deploy with maintenanceMode: true (PVC is auto-created)
# 2. Copy your wheelhouse.tar.gz to the maintenance pod
# 3. Disable maintenanceMode to start normal deployment
#
# ## Step 1: Deploy with maintenance mode (PVC is auto-created)
#
#   kubectl apply -f netbox-managed-with-custom-python-from-pvc.yaml
#
# ## Step 2: Wait for the maintenance pod
#
#   kubectl wait --for=condition=available deployment/netbox-with-pvc-plugins-netbox-maintenance-mode
#
# ## Step 3: Copy your wheelhouse tarball to the PVC
#
#   POD=$(kubectl get pod -l maintenance-mode=true -o jsonpath='{.items[0].metadata.name}')
#   kubectl cp ./wheelhouse.tar.gz $POD:/wheelhouse/wheelhouse.tar.gz
#
# ## Step 4: Verify the file was copied
#
#   kubectl exec -it $POD -- ls -la /wheelhouse/
#
# ## Step 5: Disable maintenance mode to start normal deployment
#
#   kubectl patch netboxenterprise netbox-with-pvc-plugins --type merge \
#     -p '{"spec":{"maintenanceMode":false}}'
#
# ## Step 6: Watch the normal deployment start
#
#   kubectl get pods -w
#
# ---
# NetBoxEnterprise with custom plugins from PVC wheelhouse
#
# The operator creates the wheelhouse PVC automatically when create: true.
# Start with maintenanceMode: true to upload the wheelhouse tarball,
# then set maintenanceMode: false after uploading files.
apiVersion: netboxlabs.com/v1alpha1
kind: NetBoxEnterprise
metadata:
  name: netbox-with-pvc-plugins
  namespace: default
spec:
  # Enable maintenance mode for initial wheelhouse upload
  # Set to false after copying wheelhouse.tar.gz to the PVC
  maintenanceMode: true
  imagePullPolicy: IfNotPresent
  netbox:
    replicas: 1
    image:
      pullPolicy: IfNotPresent
    worker:
      replicas: 1
    # Configuration for custom plugins
    config:
      # Custom plugins configuration for installing Python packages from wheelhouse
      plugins:
        wheelhouse:
          # PVC source for wheelhouse tarball
          pvc:
            claimName: netbox-wheelhouse
            path: wheelhouse.tar.gz
            # Operator creates and manages the PVC
            create: true
            size: 1Gi
            # storageClassName: standard  # Optional: specify storage class
      # Custom Python configuration to enable and configure the installed plugins
      customPythonConfig: |
        # Enable your custom plugins
        PLUGINS = [
            'ipfabric_netbox',
            'netpicker-netbox-plugin',
        ]
  diode:
    enabled: false
  postgresql:
    external: false
  redis:
    external: false
