apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller
  namespace: system
  labels:
    control-plane: controller
    app: vpc-resource-controller
spec:
  selector:
    matchLabels:
      control-plane: controller
  replicas: 2
  template:
    metadata:
      labels:
        control-plane: controller
        app: vpc-resource-controller
    spec:
      volumes:
      - name: aws-iam-token
        projected:
          defaultMode: 420
          sources:
          - serviceAccountToken:
              audience: sts.amazonaws.com
              expirationSeconds: 86400
              path: token
      serviceAccountName: vpc-resource-controller
      containers:
      - args:
          - --cluster-name=CLUSTER_NAME
          - --role-arn=USER_ROLE_ARN
          - --leader-elect
          - --metrics-bind-address=:8443
          - --introspect-bind-addr=:22775
          - --vpc-id=VPC_ID
        image: controller:latest
        name: controller
        resources:
          limits:
            cpu: 0.5
            memory: 1Gi
          requests:
            cpu: 0.3
            memory: 400Mi
        livenessProbe:
          failureThreshold: 5
          httpGet:
            path: /healthz
            port: 61779
            scheme: HTTP
          initialDelaySeconds: 30
          timeoutSeconds: 30
          periodSeconds: 30
        ports:
          - containerPort: 9443
            name: webhook-server
            protocol: TCP
          - containerPort: 8443
            name: metrics
            protocol: TCP
      terminationGracePeriodSeconds: 10
      nodeSelector:
        kubernetes.io/os: linux