---
# Example ConfigMap containing custom Python configuration for NetBox
# This demonstrates the customPythonConfigRef feature
apiVersion: v1
kind: ConfigMap
metadata:
  name: netbox-python-config
  namespace: default
data:
  extra.py: |
    # Custom Python configuration loaded from external ConfigMap
    # Initialize PLUGINS_CONFIG if it doesn't exist
    if 'PLUGINS_CONFIG' not in globals():
      PLUGINS_CONFIG = {}

    # Modify enterprise plugin config
    if 'netbox_enterprise_plugin' not in PLUGINS_CONFIG:
      PLUGINS_CONFIG['netbox_enterprise_plugin'] = {}
    PLUGINS_CONFIG['netbox_enterprise_plugin']['max_custom_object_types'] = 200

    # Add custom diode config
    if 'netbox_diode_plugin' in PLUGINS_CONFIG:
      PLUGINS_CONFIG['netbox_diode_plugin']['custom_test_value'] = 'from-configmap'

    # Custom banner
    BANNER_LOGIN = "Config loaded from external ConfigMap!"

    # Custom setting for testing
    EXTERNAL_CONFIG_LOADED = True

---
# NetBoxEnterprise using customPythonConfigRef to reference external ConfigMap
# Apply netbox-python-config.yaml first, then apply this file
apiVersion: netboxlabs.com/v1alpha1
kind: NetBoxEnterprise
metadata:
  name: netbox-managed
  namespace: default
spec:
  imagePullPolicy: IfNotPresent
  netbox:
    replicas: 1
    image:
      pullPolicy: IfNotPresent
    worker:
      replicas: 1
    # Reference external ConfigMap for custom Python configuration
    config:
      customPythonConfigRef:
        name: netbox-python-config
        key: extra.py
  diode:
    reconciler:
      replicas: 1
    ingester:
      replicas: 1
    auth:
      replicas: 1
    hydra:
      replicas: 1
  postgresql:
    external: false
  redis:
    external: false
