daemonset.yml 4.9 KB

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