security-context-constraint-rolebinding.yaml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. ################################
  18. ## Airflow SCC Role Binding
  19. #################################
  20. {{- if and .Values.rbac.create .Values.rbac.createSCCRoleBinding }}
  21. {{- $hasWorkers := has .Values.executor (list "CeleryExecutor" "LocalKubernetesExecutor" "KubernetesExecutor" "CeleryKubernetesExecutor") }}
  22. {{- if .Values.multiNamespaceMode }}
  23. kind: ClusterRoleBinding
  24. {{- else }}
  25. kind: RoleBinding
  26. {{- end }}
  27. apiVersion: rbac.authorization.k8s.io/v1
  28. metadata:
  29. {{- if not .Values.multiNamespaceMode }}
  30. namespace: "{{ .Release.Namespace }}"
  31. {{- end }}
  32. name: {{ .Release.Name }}-scc-rolebinding
  33. labels:
  34. tier: airflow
  35. release: {{ .Release.Name }}
  36. chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
  37. heritage: {{ .Release.Service }}
  38. {{- with .Values.labels }}
  39. {{ toYaml . | indent 4 }}
  40. {{- end }}
  41. roleRef:
  42. apiGroup: rbac.authorization.k8s.io
  43. kind: ClusterRole
  44. name: system:openshift:scc:anyuid
  45. subjects:
  46. - kind: ServiceAccount
  47. name: {{ include "webserver.serviceAccountName" . }}
  48. namespace: "{{ .Release.Namespace }}"
  49. {{- if $hasWorkers }}
  50. - kind: ServiceAccount
  51. name: {{ include "worker.serviceAccountName" . }}
  52. namespace: "{{ .Release.Namespace }}"
  53. {{- end }}
  54. - kind: ServiceAccount
  55. name: {{ include "scheduler.serviceAccountName" . }}
  56. namespace: "{{ .Release.Namespace }}"
  57. {{- if and .Values.statsd.enabled }}
  58. - kind: ServiceAccount
  59. name: {{ include "statsd.serviceAccountName" . }}
  60. namespace: "{{ .Release.Namespace }}"
  61. {{- end }}
  62. {{- if and .Values.flower.enabled (or (eq .Values.executor "CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor")) }}
  63. - kind: ServiceAccount
  64. name: {{ include "flower.serviceAccountName" . }}
  65. namespace: "{{ .Release.Namespace }}"
  66. {{- end}}
  67. {{- if and (semverCompare ">=2.2.0" .Values.airflowVersion) }}
  68. - kind: ServiceAccount
  69. name: {{ include "triggerer.serviceAccountName" . }}
  70. namespace: "{{ .Release.Namespace }}"
  71. {{- end }}
  72. - kind: ServiceAccount
  73. name: {{ include "migrateDatabaseJob.serviceAccountName" . }}
  74. namespace: "{{ .Release.Namespace }}"
  75. {{- if .Values.webserver.defaultUser.enabled }}
  76. - kind: ServiceAccount
  77. name: {{ include "createUserJob.serviceAccountName" . }}
  78. namespace: "{{ .Release.Namespace }}"
  79. {{- end }}
  80. {{- if and .Values.cleanup.enabled }}
  81. - kind: ServiceAccount
  82. name: {{ include "cleanup.serviceAccountName" . }}
  83. namespace: "{{ .Release.Namespace }}"
  84. {{- end }}
  85. {{- end }}