﻿apiVersion: apps/v1
kind: Deployment
metadata:
  name: twin-deployment
  namespace: industrial-iot
  labels:
    app.kubernetes.io/name: twin-service
    app.kubernetes.io/part-of: industrial-iot
    app.kubernetes.io/version: 2.5.1
    app.kubernetes.io/managed-by: Microsoft.Azure.IIoT.Deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: twin-service
      app.kubernetes.io/part-of: industrial-iot
  template:
    metadata:
      labels:
        app.kubernetes.io/name: twin-service
        app.kubernetes.io/part-of: industrial-iot
        app.kubernetes.io/version: 2.5.1
        app.kubernetes.io/managed-by: Microsoft.Azure.IIoT.Deployment
    spec:
      serviceAccountName: industrial-iot-serviceaccount
      containers:
      - name: twin-service-container
        image: mcr.microsoft.com/iot/opc-twin-service:2.5.1
        resources:
          requests:
            memory: "64Mi"
            cpu: "50m"
          limits:
            memory: "512Mi"
            cpu: "250m"
        ports:
        - containerPort: 443
        - containerPort: 9041
        env:
        - name: PCS_KEYVAULT_URL
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_KEYVAULT_URL
        - name: PCS_IOTHUB_CONNSTRING
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_IOTHUB_CONNSTRING
        - name: PCS_TELEMETRY_DOCUMENTDB_CONNSTRING
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_TELEMETRY_DOCUMENTDB_CONNSTRING
        - name: PCS_AUTH_HTTPSREDIRECTPORT
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_AUTH_HTTPSREDIRECTPORT
        - name: PCS_AUTH_REQUIRED
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_AUTH_REQUIRED
        - name: PCS_AUTH_ISSUER
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_AUTH_ISSUER
        - name: PCS_AUTH_AUDIENCE
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_AUTH_AUDIENCE
        - name: PCS_WEBUI_AUTH_AAD_APPID
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_WEBUI_AUTH_AAD_APPID
        - name: PCS_WEBUI_AUTH_AAD_AUTHORITY
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_WEBUI_AUTH_AAD_AUTHORITY
        - name: PCS_WEBUI_AUTH_AAD_TENANT
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_WEBUI_AUTH_AAD_TENANT
        - name: PCS_CORS_WHITELIST
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_CORS_WHITELIST
        - name: PCS_APPINSIGHTS_NAME
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_APPINSIGHTS_NAME
        - name: PCS_APPINSIGHTS_INSTRUMENTATIONKEY
          valueFrom:
            secretKeyRef:
              name: industrial-iot-env
              key: PCS_APPINSIGHTS_INSTRUMENTATIONKEY
