daemonset.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. apiVersion: apps/v1
  2. kind: DaemonSet
  3. metadata:
  4. name: metrics
  5. namespace: exporter
  6. labels:
  7. app: metrics
  8. annotations:
  9. image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"collector-sysstat:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"collector-sysstat\")].image"},{"from":{"kind":"ImageStreamTag","name":"collector-psacct:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"collector-psacct\")].image"},{"from":{"kind":"ImageStreamTag","name":"metrics-exporter:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"metrics-exporter\")].image"}]'
  10. spec:
  11. minReadySeconds: 15
  12. selector:
  13. app: metrics
  14. type: daemonset
  15. project: exporter
  16. updateStrategy:
  17. type: RollingUpdate
  18. rollingUpdate:
  19. maxSurge: 25%
  20. maxUnavailable: 25%
  21. template:
  22. metadata:
  23. labels:
  24. app: metrics
  25. type: daemonset
  26. project: exporter
  27. spec:
  28. containers:
  29. - name: collector-sysstat
  30. image: " "
  31. env:
  32. - key: PERIOD
  33. value: 15
  34. - key: STARTUP_SCRATCH
  35. value: 1
  36. - key: STARTUP_ROTATE
  37. value: 0
  38. livenessProbe: {}
  39. # something like /var/log/sa/sysstat-dump.json not being older than ${PERIOD}
  40. readinessProbe: {}
  41. # /var/log/sa/sysstat-dump.json exists
  42. resources: {}
  43. # TBD
  44. securityContext:
  45. allowPrivilegeEscalation: true
  46. capabilities: {}
  47. # none
  48. privileged: true
  49. runAsGroup: 0
  50. runAsNonRoot: false
  51. runAsUser: 0
  52. volumeMounts:
  53. - name: metrics-shared-volume
  54. mountPath: /var/log/sa
  55. readOnly: false
  56. - name: collector-psacct
  57. image: " "
  58. env:
  59. - key: PERIOD
  60. value: 15
  61. - key: CUMULATIVE
  62. value: 0
  63. - key: STARTUP_SCRATCH
  64. value: 1
  65. livenessProbe: {}
  66. # something like /var/account/psacct-dump-raw not being older than ${PERIOD}
  67. readinessProbe: {}
  68. # /var/account/psacct-dump-raw exists
  69. resources: {}
  70. # TBD
  71. securityContext:
  72. allowPrivilegeEscalation: true
  73. capabilities:
  74. add:
  75. - CAP_SYS_PACCT
  76. privileged: true
  77. runAsGroup: 0
  78. runAsNonRoot: false
  79. runAsUser: 0
  80. volumeMounts:
  81. - name: metrics-shared-volume
  82. mountPath: /var/account
  83. readOnly: false
  84. - name: metrics-exporter
  85. image: " "
  86. env:
  87. - key: HOSTNAME_FROM_API
  88. value: true
  89. ports:
  90. - name: http
  91. protocol: TCP
  92. containerPort: 8080
  93. livenessProbe: {}
  94. # /q/metrics returning 200?
  95. readinessProbe: {}
  96. # /metrics/version returning 200?
  97. resources: {}
  98. # TBD
  99. # No special privileges for this one.
  100. securityContext:
  101. allowPrivilegeEscalation: false
  102. capabilities: {}
  103. privileged: false
  104. runAsNonRoot: true
  105. #runAsUser: namespace-assigned
  106. volumeMounts:
  107. - name: metrics-shared-volume
  108. mountPath: /metrics
  109. readOnly: false
  110. # Must cover all the nodes.
  111. affinity:
  112. nodeAffinity:
  113. requiredDuringSchedulingIgnoredDuringExecution:
  114. nodeSelectorTerms:
  115. - matchExpressions:
  116. - key: node-role.kubernetes.io/master
  117. operator: Exists
  118. - matchExpressions:
  119. - key: node-role.kubernetes.io/worker
  120. operator: Exists
  121. # VERY important, these three!
  122. hostIPC: true
  123. hostNetwork: true
  124. hostPID: true
  125. # Gives us the best possible chance of not being evicted.
  126. priorityClassName: system-node-critical
  127. # VERY important, these two!
  128. securityContext:
  129. # Sets a default that can be overridden by container.
  130. runAsNonRoot: false
  131. # Need to make sure even unprivileged exporter can write.
  132. supplementalGroups:
  133. - 0
  134. serviceAccountName: exporter
  135. # Make that somewhere around $PERIOD, but larger.
  136. terminationGracePeriodSeconds: 15
  137. # Need to adjust this whenever there are dedicated control plane or
  138. # other tainted nodes.
  139. tolerations: {}
  140. volumes:
  141. - name: metrics-shared-volume
  142. emptyDir: {}