-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR builds off of and supersedes @jaydesl's work on his [PR](apache/airflow#11769) to move forward with properly following [helm's rbac best practices](https://helm.sh/docs/chart_best_practices/rbac/). This PR updates every potential pod that can be deployed to include the option to either create or use an existing service account. This is the first step towards supporting environments where users have the [PodSecurityPolicy](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#podsecuritypolicy) admission controller enabled without forcing such users to provide any additional permissions to the default service account in the namespace this is deployed to. closes: apache/airflow#11755 related: apache/airflow#13643 Co-authored-by: jaydesl <jay.deslauriers@gmail.com> Co-authored-by: Ian Stanton <ian@astronomer.io> Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com> GitOrigin-RevId: 8655d66cea977102862379d9894810b1e836f7a8
- Loading branch information
1 parent
8b04e1d
commit 4fef8ba
Showing
38 changed files
with
1,295 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
###################################### | ||
## Airflow Flower ServiceAccount | ||
###################################### | ||
{{- if and (or (eq .Values.executor "CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor")) .Values.flower.serviceAccount.create }} | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "flower.serviceAccountName" . }} | ||
labels: | ||
tier: airflow | ||
release: {{ .Release.Name }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
heritage: {{ .Release.Service }} | ||
{{- with .Values.labels }} | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.flower.serviceAccount.annotations }} | ||
annotations: | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
########################################### | ||
## Airflow Create User Job ServiceAccount | ||
########################################### | ||
{{- if and .Values.createUserJob.serviceAccount.create .Values.webserver.defaultUser.enabled }} | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "createUserJob.serviceAccountName" . }} | ||
labels: | ||
tier: airflow | ||
release: {{ .Release.Name }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
heritage: {{ .Release.Service }} | ||
{{- with .Values.labels }} | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.createUserJob.serviceAccount.annotations }} | ||
annotations: | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
chart/templates/jobs/migrate-database-job-serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
############################################# | ||
## Airflow Migrate Database Job ServiceAccount | ||
############################################## | ||
{{- if .Values.migrateDatabaseJob.serviceAccount.create }} | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "migrateDatabaseJob.serviceAccountName" . }} | ||
labels: | ||
tier: airflow | ||
release: {{ .Release.Name }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
heritage: {{ .Release.Service }} | ||
{{- with .Values.labels }} | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.migrateDatabaseJob.serviceAccount.annotations }} | ||
annotations: | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
###################################### | ||
## Airflow Pgbouncer ServiceAccount | ||
###################################### | ||
{{- if and .Values.pgbouncer.serviceAccount.create .Values.pgbouncer.enabled }} | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "pgbouncer.serviceAccountName" . }} | ||
labels: | ||
tier: airflow | ||
release: {{ .Release.Name }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
heritage: {{ .Release.Service }} | ||
{{- with .Values.labels }} | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.pgbouncer.serviceAccount.annotations }} | ||
annotations: | ||
{{ toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.