dockergc-ds.yaml.j2 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/origin:latest
  31. args:
  32. - "ex"
  33. - "dockergc"
  34. - "--image-gc-low-threshold=60"
  35. - "--image-gc-high-threshold=80"
  36. - "--minimum-ttl-duration=1h0m0s"
  37. securityContext:
  38. privileged: true
  39. name: dockergc
  40. resources:
  41. requests:
  42. memory: 30Mi
  43. cpu: 50m
  44. volumeMounts:
  45. - name: docker-root
  46. readOnly: true
  47. mountPath: /var/lib/docker
  48. - name: docker-socket
  49. readOnly: false
  50. mountPath: /var/run/docker.sock
  51. volumes:
  52. - name: docker-root
  53. hostPath:
  54. path: /var/lib/docker
  55. - name: docker-socket
  56. hostPath:
  57. path: /var/run/docker.sock