apiVersion: apps/v1
kind: Deployment
metadata:
  name: packet-cloud-controller-manager
  namespace: kube-system
  labels:
    app: packet-cloud-controller-manager
spec:
  replicas: 1
  selector:
    matchLabels:
      app: packet-cloud-controller-manager
  template:
    metadata:
      labels:
        app: packet-cloud-controller-manager
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      dnsPolicy: Default
      hostNetwork: true
      serviceAccountName: cloud-controller-manager
      tolerations:
        # this taint is set by all kubelets running `--cloud-provider=external`
        # so we should tolerate it to schedule the packet ccm
        - key: "node.cloudprovider.kubernetes.io/uninitialized"
          value: "true"
          effect: "NoSchedule"
        - key: "CriticalAddonsOnly"
          operator: "Exists"
        # cloud controller manager should be able to run on masters
        - key: "node-role.kubernetes.io/master"
          effect: NoSchedule
      containers:
      - image: docker.io/packethost/packet-ccm:v0.0.4
        name: packet-cloud-controller-manager
        command:
          - "./packet-cloud-controller-manager"
          - "--cloud-provider=packet"
          - "--leader-elect=false"
          - "--allow-untagged-cloud=true"
        resources:
          requests:
            cpu: 100m
            memory: 50Mi
        env:
          - name: PACKET_AUTH_TOKEN
            valueFrom:
              secretKeyRef:
                name: packet-cloud-config
                key: apiKey
          - name: PACKET_PROJECT_ID
            valueFrom:
              secretKeyRef:
                name: packet-cloud-config
                key: projectID