You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

221 lines
4.6 KiB

  1. apiVersion: v1
  2. kind: Namespace
  3. metadata:
  4. name: metallb-system
  5. labels:
  6. app: metallb
  7. ---
  8. apiVersion: v1
  9. kind: ServiceAccount
  10. metadata:
  11. namespace: metallb-system
  12. name: controller
  13. labels:
  14. app: metallb
  15. ---
  16. apiVersion: v1
  17. kind: ServiceAccount
  18. metadata:
  19. namespace: metallb-system
  20. name: speaker
  21. labels:
  22. app: metallb
  23. ---
  24. apiVersion: rbac.authorization.k8s.io/v1
  25. kind: ClusterRole
  26. metadata:
  27. name: metallb-system:controller
  28. labels:
  29. app: metallb
  30. rules:
  31. - apiGroups: [""]
  32. resources: ["services"]
  33. verbs: ["get", "list", "watch", "update"]
  34. - apiGroups: [""]
  35. resources: ["services/status"]
  36. verbs: ["update"]
  37. - apiGroups: [""]
  38. resources: ["events"]
  39. verbs: ["create", "patch"]
  40. ---
  41. apiVersion: rbac.authorization.k8s.io/v1
  42. kind: ClusterRole
  43. metadata:
  44. name: metallb-system:speaker
  45. labels:
  46. app: metallb
  47. rules:
  48. - apiGroups: [""]
  49. resources: ["services", "endpoints", "nodes"]
  50. verbs: ["get", "list", "watch"]
  51. ---
  52. apiVersion: rbac.authorization.k8s.io/v1
  53. kind: Role
  54. metadata:
  55. namespace: metallb-system
  56. name: config-watcher
  57. labels:
  58. app: metallb
  59. rules:
  60. - apiGroups: [""]
  61. resources: ["configmaps"]
  62. verbs: ["get", "list", "watch"]
  63. - apiGroups: [""]
  64. resources: ["events"]
  65. verbs: ["create"]
  66. ---
  67. ## Role bindings
  68. apiVersion: rbac.authorization.k8s.io/v1
  69. kind: ClusterRoleBinding
  70. metadata:
  71. name: metallb-system:controller
  72. labels:
  73. app: metallb
  74. subjects:
  75. - kind: ServiceAccount
  76. name: controller
  77. namespace: metallb-system
  78. roleRef:
  79. apiGroup: rbac.authorization.k8s.io
  80. kind: ClusterRole
  81. name: metallb-system:controller
  82. ---
  83. apiVersion: rbac.authorization.k8s.io/v1
  84. kind: ClusterRoleBinding
  85. metadata:
  86. name: metallb-system:speaker
  87. labels:
  88. app: metallb
  89. subjects:
  90. - kind: ServiceAccount
  91. name: speaker
  92. namespace: metallb-system
  93. roleRef:
  94. apiGroup: rbac.authorization.k8s.io
  95. kind: ClusterRole
  96. name: metallb-system:speaker
  97. ---
  98. apiVersion: rbac.authorization.k8s.io/v1
  99. kind: RoleBinding
  100. metadata:
  101. namespace: metallb-system
  102. name: config-watcher
  103. labels:
  104. app: metallb
  105. subjects:
  106. - kind: ServiceAccount
  107. name: controller
  108. - kind: ServiceAccount
  109. name: speaker
  110. roleRef:
  111. apiGroup: rbac.authorization.k8s.io
  112. kind: Role
  113. name: config-watcher
  114. ---
  115. apiVersion: apps/v1beta2
  116. kind: DaemonSet
  117. metadata:
  118. namespace: metallb-system
  119. name: speaker
  120. labels:
  121. app: metallb
  122. component: speaker
  123. spec:
  124. selector:
  125. matchLabels:
  126. app: metallb
  127. component: speaker
  128. template:
  129. metadata:
  130. labels:
  131. app: metallb
  132. component: speaker
  133. annotations:
  134. prometheus.io/scrape: "true"
  135. prometheus.io/port: "{{ metallb.port }}"
  136. spec:
  137. serviceAccountName: speaker
  138. terminationGracePeriodSeconds: 0
  139. hostNetwork: true
  140. containers:
  141. - name: speaker
  142. image: metallb/speaker:{{ metallb.version }}
  143. imagePullPolicy: IfNotPresent
  144. args:
  145. - --port={{ metallb.port }}
  146. - --config=config
  147. env:
  148. - name: METALLB_NODE_NAME
  149. valueFrom:
  150. fieldRef:
  151. fieldPath: spec.nodeName
  152. ports:
  153. - name: monitoring
  154. containerPort: {{ metallb.port }}
  155. resources:
  156. limits:
  157. cpu: {{ metallb.limits.cpu }}
  158. memory: {{ metallb.limits.memory }}
  159. securityContext:
  160. allowPrivilegeEscalation: false
  161. readOnlyRootFilesystem: true
  162. capabilities:
  163. drop:
  164. - all
  165. add:
  166. - net_raw
  167. ---
  168. apiVersion: apps/v1beta2
  169. kind: Deployment
  170. metadata:
  171. namespace: metallb-system
  172. name: controller
  173. labels:
  174. app: metallb
  175. component: controller
  176. spec:
  177. revisionHistoryLimit: 3
  178. selector:
  179. matchLabels:
  180. app: metallb
  181. component: controller
  182. template:
  183. metadata:
  184. labels:
  185. app: metallb
  186. component: controller
  187. annotations:
  188. prometheus.io/scrape: "true"
  189. prometheus.io/port: "{{ metallb.port }}"
  190. spec:
  191. serviceAccountName: controller
  192. terminationGracePeriodSeconds: 0
  193. securityContext:
  194. runAsNonRoot: true
  195. runAsUser: 65534 # nobody
  196. containers:
  197. - name: controller
  198. image: metallb/controller:{{ metallb.version }}
  199. imagePullPolicy: IfNotPresent
  200. args:
  201. - --port={{ metallb.port }}
  202. - --config=config
  203. ports:
  204. - name: monitoring
  205. containerPort: {{ metallb.port }}
  206. resources:
  207. limits:
  208. cpu: {{ metallb.limits.cpu }}
  209. memory: {{ metallb.limits.memory }}
  210. securityContext:
  211. allowPrivilegeEscalation: false
  212. capabilities:
  213. drop:
  214. - all
  215. readOnlyRootFilesystem: true
  216. ---