daemonset.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. containerPort: 8080
  95. #livenessProbe: {}
  96. # /q/metrics returning 200?
  97. #readinessProbe: {}
  98. # /metrics/version returning 200?
  99. resources: {}
  100. # TBD
  101. # No special privileges for this one.
  102. securityContext:
  103. allowPrivilegeEscalation: false
  104. capabilities: {}
  105. privileged: false
  106. runAsNonRoot: true
  107. #runAsUser: namespace-assigned
  108. volumeMounts:
  109. - name: metrics-shared-volume
  110. mountPath: /metrics
  111. readOnly: false
  112. # Must cover all the nodes.
  113. affinity:
  114. nodeAffinity:
  115. requiredDuringSchedulingIgnoredDuringExecution:
  116. nodeSelectorTerms:
  117. - matchExpressions:
  118. - key: node-role.kubernetes.io/master
  119. operator: Exists
  120. - matchExpressions:
  121. - key: node-role.kubernetes.io/worker
  122. operator: Exists
  123. # VERY important, these three!
  124. hostIPC: true
  125. hostNetwork: true
  126. hostPID: true
  127. # Gives us the best possible chance of not being evicted.
  128. priorityClassName: system-node-critical
  129. # VERY important, these two!
  130. securityContext:
  131. # Sets a default that can be overridden by container.
  132. runAsNonRoot: false
  133. # Need to make sure even unprivileged exporter can write.
  134. supplementalGroups:
  135. - 0
  136. serviceAccountName: exporter
  137. # Make that somewhere around $PERIOD, but larger.
  138. terminationGracePeriodSeconds: 15
  139. # Need to adjust this whenever there are dedicated control plane or
  140. # other tainted nodes.
  141. tolerations: []
  142. volumes:
  143. - name: metrics-shared-volume
  144. emptyDir: {}