dockergc-ds.yaml.j2 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. apiVersion: v1
  2. kind: List
  3. items:
  4. - apiVersion: v1
  5. kind: ServiceAccount
  6. metadata:
  7. name: dockergc
  8. # You must grant privileged via: oc adm policy add-scc-to-user -z dockergc privileged
  9. # in order for the dockergc to access the docker socket and root directory
  10. - apiVersion: extensions/v1beta1
  11. kind: DaemonSet
  12. metadata:
  13. name: dockergc
  14. labels:
  15. app: dockergc
  16. spec:
  17. template:
  18. metadata:
  19. labels:
  20. app: dockergc
  21. name: dockergc
  22. spec:
  23. {# Only set nodeSelector if the dict is not empty #}
  24. {% if r_docker_gc_node_selectors %}
  25. nodeSelector:
  26. {% for k,v in r_docker_gc_node_selectors.items() %}
  27. {{ k }}: {{ v }}{% endfor %}{% endif %}
  28. serviceAccountName: dockergc
  29. containers:
  30. - image: {{ openshift_docker_gc_image }}
  31. command:
  32. - "/usr/bin/oc"
  33. args:
  34. - "ex"
  35. - "dockergc"
  36. - "--image-gc-low-threshold=60"
  37. - "--image-gc-high-threshold=80"
  38. - "--minimum-ttl-duration=1h0m0s"
  39. securityContext:
  40. privileged: true
  41. name: dockergc
  42. resources:
  43. requests:
  44. memory: 30Mi
  45. cpu: 50m
  46. volumeMounts:
  47. - name: docker-root
  48. readOnly: true
  49. mountPath: /var/lib/containers/docker
  50. - name: docker-socket
  51. readOnly: false
  52. mountPath: /var/run/docker.sock
  53. volumes:
  54. - name: docker-root
  55. hostPath:
  56. path: /var/lib/containers/docker
  57. - name: docker-socket
  58. hostPath:
  59. path: /var/run/docker.sock