apiVersion: apps/v1
kind: Deployment
metadata:
  name: manager
  labels:
    control-plane: manager
spec:
  selector:
    matchLabels:
      control-plane: manager
  replicas: 1
  template:
    metadata:
      labels:
        control-plane: manager
    spec:
      securityContext:
        runAsNonRoot: true
      containers:
      - command:
        - /manager
        args:
        - --infra-kubeconfig=/infra/kubeconfig
        - --enable-leader-election
        - --addon-config-map-namespace=$(NAMESPACE)
        - --addon-config-map-name=shared-provider-addon-template
        - --remote-write-url=http://thanos-receive-external-url.monitoring/api/v1/receive
        image: controller:latest
        imagePullPolicy: IfNotPresent
        name: manager
        env:
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        securityContext:
          allowPrivilegeEscalation: false
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
          initialDelaySeconds: 15
          periodSeconds: 20
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8081
          initialDelaySeconds: 5
          periodSeconds: 10
        resources:
          limits:
            cpu: 100m
            memory: 300Mi
          requests:
            cpu: 100m
            memory: 20Mi
        volumeMounts:
        - name: infra-api-kubeconfig
          mountPath: /infra
      serviceAccountName: manager
      terminationGracePeriodSeconds: 10
      volumes:
      - name: infra-api-kubeconfig
        secret:
          secretName: infra-api-kubeconfig
