---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vizier-cloud-connector
spec:
  replicas: 1
  selector:
    matchLabels:
      name: vizier-cloud-connector
  template:
    metadata:
      labels:
        name: vizier-cloud-connector
        plane: control
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/os
                operator: Exists
              - key: kubernetes.io/os
                operator: In
                values:
                - linux
            - matchExpressions:
              - key: beta.kubernetes.io/os
                operator: Exists
              - key: beta.kubernetes.io/os
                operator: In
                values:
                - linux
      serviceAccountName: cloud-conn-service-account
      containers:
      - name: app
        image: gcr.io/pixie-oss/pixie-dev/vizier/cloud_connector_server_image:latest
        env:
        - name: PL_JWT_SIGNING_KEY
          valueFrom:
            secretKeyRef:
              key: jwt-signing-key
              name: pl-cluster-secrets
        - name: PL_CLUSTER_ID
          valueFrom:
            secretKeyRef:
              key: cluster-id
              name: pl-cluster-secrets
              optional: true
        - name: PL_DEPLOY_KEY
          valueFrom:
            secretKeyRef:
              key: deploy-key
              name: pl-deploy-secrets
              optional: true
        - name: PL_POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: PL_MAX_EXPECTED_CLOCK_SKEW
          value: "2000"
        - name: PL_RENEW_PERIOD
          value: "7500"
        envFrom:
        - configMapRef:
            name: pl-cloud-config
        - configMapRef:
            name: pl-cloud-connector-tls-config
        - configMapRef:
            name: pl-cluster-config
            optional: true
        ports:
        - containerPort: 50800
        volumeMounts:
        - mountPath: /certs
          name: certs
        livenessProbe:
          httpGet:
            scheme: HTTPS
            path: /healthz
            port: 50800
      volumes:
      - name: certs
        secret:
          secretName: service-tls-certs
