rack-awareness-rbac.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {{- /*
  2. Copyright 2020 Crown Copyright
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */ -}}
  13. {{- if and .Values.config.rackAwareness .Values.config.rackAwareness.nodeTopologyLabel -}}
  14. apiVersion: rbac.authorization.k8s.io/v1
  15. kind: ClusterRole
  16. metadata:
  17. name: {{ template "hdfs.fullname" . }}-namenode
  18. labels:
  19. {{- include "hdfs.labels" . | nindent 4 }}
  20. app.kubernetes.io/component: namenode
  21. rules:
  22. - apiGroups: [""]
  23. resources: ["nodes"]
  24. verbs: ["get"]
  25. ---
  26. apiVersion: rbac.authorization.k8s.io/v1
  27. kind: Role
  28. metadata:
  29. name: {{ template "hdfs.fullname" . }}-namenode
  30. labels:
  31. {{- include "hdfs.labels" . | nindent 4 }}
  32. app.kubernetes.io/component: namenode
  33. rules:
  34. - apiGroups: [""]
  35. resources: ["pods"]
  36. verbs: ["list"]
  37. ---
  38. apiVersion: rbac.authorization.k8s.io/v1
  39. kind: ClusterRoleBinding
  40. metadata:
  41. name: {{ template "hdfs.fullname" . }}-namenode
  42. labels:
  43. {{- include "hdfs.labels" . | nindent 4 }}
  44. app.kubernetes.io/component: namenode
  45. roleRef:
  46. apiGroup: rbac.authorization.k8s.io
  47. kind: ClusterRole
  48. name: {{ template "hdfs.fullname" . }}-namenode
  49. subjects:
  50. - kind: ServiceAccount
  51. name: {{ template "hdfs.namenodeServiceAccountName" . }}
  52. namespace: {{ .Release.Namespace }}
  53. ---
  54. apiVersion: rbac.authorization.k8s.io/v1
  55. kind: RoleBinding
  56. metadata:
  57. name: {{ template "hdfs.fullname" . }}-namenode
  58. labels:
  59. {{- include "hdfs.labels" . | nindent 4 }}
  60. app.kubernetes.io/component: namenode
  61. roleRef:
  62. apiGroup: rbac.authorization.k8s.io
  63. kind: Role
  64. name: {{ template "hdfs.fullname" . }}-namenode
  65. subjects:
  66. - kind: ServiceAccount
  67. name: {{ template "hdfs.namenodeServiceAccountName" . }}
  68. namespace: {{ .Release.Namespace }}
  69. {{- end -}}