apiVersion: apps/v1
kind: Deployment
metadata:
  name: opal-server-deployment
  namespace: hm-opa
spec:
  replicas: 3
  selector:
    matchLabels:
      component: opal-server
  template:
    metadata:
      labels:
        component: opal-server
    spec:
      containers:
        - name: opal-server
          image: authorizon/opal-server:0.1.15
          env:
            - name: OPAL_BROADCAST_URI
              valueFrom:
                configMapKeyRef:
                  name: opal-server-configmap
                  key: opal_broadcast_uri
            - name: OPAL_DATA_CONFIG_SOURCES
              valueFrom:
                configMapKeyRef:
                  name: opal-server-configmap
                  key: opal_data_config_sources
            - name: OPAL_POLICY_REPO_POLLING_INTERVAL
              valueFrom:
                configMapKeyRef:
                  name: opal-server-configmap
                  key: opal_policy_repo_polling_interval
            - name: OPAL_POLICY_REPO_URL
              valueFrom:
                configMapKeyRef:
                  name: opal-server-configmap
                  key: opal_policy_repo_url
            - name: OPAL_AUTH_PRIVATE_KEY
              valueFrom:
                secretKeyRef:
                  name: hm-opal-server-secret
                  key: id_rsa
            - name: OPAL_AUTH_PUBLIC_KEY
              valueFrom:
                secretKeyRef:
                  name: hm-opal-server-secret
                  key: id_rsa.pub
            - name: OPAL_AUTH_MASTER_TOKEN
              valueFrom:
                secretKeyRef:
                  name: hm-opal-server-secret
                  key: opal_auth_master_token
            - name: UVICORN_NUM_WORKERS
              valueFrom:
                configMapKeyRef:
                  name: opal-server-configmap
                  key: uvicorn_num_workers
            - name: OPAL_LOG_MODULE_EXCLUDE_LIST
              valueFrom:
                configMapKeyRef:
                  name: opal-server-configmap
                  key: opal_log_module_exclude_list
            - name: OPAL_LOG_COLORIZE
              valueFrom:
                configMapKeyRef:
                  name: opal-server-configmap
                  key: opal_log_colorize
          ports:
            - name: opal-server
              protocol: TCP
              containerPort: 7002
