###
# Public API
###

kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    cluster: management
    component: public-api
  name: public-api
  namespace: __NPH_NAMESPACE
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      cluster: management
      component: public-api
  template:
    metadata:
      labels:
        cluster: management
        component: public-api
    spec:
      volumes:
      - name: authx-config
        configMap:
          name: public-api-authx-config
      containers:
      - name: public-api
        image: __NPH_REGISTRY_NAMESPACE/public-api:__NPH_VERSION
        imagePullPolicy: Always
        env:
          - name: AUTH_SECRET
            valueFrom:
              secretKeyRef:
                name: authx-secret
                key: secret
        volumeMounts:
          - name: authx-config
            mountPath: "/nalej/config"
            readOnly: true
        args:
        - "run"
        - "--systemModelAddress=system-model.__NPH_NAMESPACE:8800"
        - "--infrastructureManagerAddress=infrastructure-manager.__NPH_NAMESPACE:8081"
        - "--applicationsManagerAddress=application-manager.__NPH_NAMESPACE:8910"
        - "--userManagerAddress=user-manager.__NPH_NAMESPACE:8920"
        - "--deviceManagerAddress=device-manager.__NPH_NAMESPACE:6010"
        - "--monitoringManagerAddress=monitoring-manager.__NPH_NAMESPACE:8423"
        - "--inventoryManagerAddress=inventory-manager.__NPH_NAMESPACE:5510"
        - "--provisionerManagerAddress=provisioner.__NPH_NAMESPACE:8930"
        - "--logDownloadManagerAddress=log-download-manager.__NPH_NAMESPACE:8940"
        - "--organizationManagerAddress=organization-manager.__NPH_NAMESPACE:8950"
        - "--authHeader=authorization"
        - "--authSecret=$(AUTH_SECRET)"
        - "--authConfigPath=/nalej/config/authx-config.json"
        securityContext:
          runAsUser: 2000
