apiVersion: apps/v1
kind: Deployment
metadata:
  name: kube-downscaler
  namespace: kube-system
  labels:
    application: kube-downscaler
    version: v0.18
spec:
  replicas: 1
  selector:
    matchLabels:
      application: kube-downscaler
  template:
    metadata:
      labels:
        application: kube-downscaler
        version: v0.18
    spec:
      dnsConfig:
        options:
          - name: ndots
            value: "1"
      serviceAccountName: kube-downscaler
      priorityClassName: system-cluster-critical
      containers:
      - name: downscaler
        # see https://github.com/hjacobs/kube-downscaler/releases
        image: registry.opensource.zalan.do/teapot/kube-downscaler:0.18
        args:
          - --interval=30
          - --exclude-namespaces=kube-system,visibility
          - --exclude-deployments=kube-downscaler,downscaler,postgres-operator
          - "--default-uptime={{ .ConfigItems.downscaler_default_uptime }}"
          - --include-resources=stacks,deployments
        resources:
          limits:
            cpu: 5m
            memory: 150Mi
          requests:
            cpu: 5m
            memory: 150Mi
        securityContext:
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          runAsUser: 1000
