apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: throttler
  labels:
    control-plane: throttler
spec:
  selector:
    matchLabels:
      control-plane: throttler
  template:
    metadata:
      labels:
        control-plane: throttler
    spec:
      volumes:
      - name: runtime-sock
        hostPath:
          path: /var/run/docker.sock
          type: Socket
      - name: netns
        hostPath:
          path: /var/run/docker/netns
      containers:
      - command:
        - /throttler
        args:
        - --node-name=$(NODE_NAME)
        env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        image: shared-provider-throttler
        imagePullPolicy: Always
        name: throttler
        securityContext:
          privileged: true
          runAsUser: 0
        volumeMounts:
        - name: runtime-sock
          mountPath: /var/run/docker.sock
        - name: netns
          mountPath: /var/run/docker/netns
          mountPropagation: Bidirectional
        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: 256Mi
          requests:
            cpu: 100m
            memory: 256Mi
      serviceAccountName: throttler
      terminationGracePeriodSeconds: 10
