daemonset.yml 4.6 KB

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