Skip to content

Commit

Permalink
updates airflow services with security context (#2168)
Browse files Browse the repository at this point in the history
* updates airflow services with security context

* update test cases

* fix pre-commit

* swap components in tests
  • Loading branch information
pgvishnuram committed Apr 4, 2024
1 parent 2ddeed0 commit e3c9337
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
16 changes: 8 additions & 8 deletions charts/astronomer/templates/houston/houston-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ data:
{{ if .Values.global.openshiftEnabled }}
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
{{ end }}
webserver:
{{ if .Values.configSyncer.enabled }}
Expand All @@ -197,7 +197,7 @@ data:
{{ if .Values.global.openshiftEnabled }}
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
{{ end }}
resources:
limits:
Expand All @@ -222,7 +222,7 @@ data:
{{ if .Values.global.openshiftEnabled }}
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
{{ end }}
resources:
limits:
Expand All @@ -238,7 +238,7 @@ data:
{{ if .Values.global.openshiftEnabled }}
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
{{ end }}
podDisruptionBudget:
Expand Down Expand Up @@ -381,7 +381,7 @@ data:
{{ if .Values.global.openshiftEnabled }}
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
{{ end }}
{{ if .Values.global.openshiftEnabled }}
Expand All @@ -395,13 +395,13 @@ data:
triggerer:
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
# migrateDatabaseJob settings
migrateDatabaseJob:
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
{{ end }}
Expand Down Expand Up @@ -456,7 +456,7 @@ data:
{{ if .Values.global.openshiftEnabled }}
securityContexts:
pod:
runAsNonRoot: true
runAsNonRoot: false
{{ end }}
{{- end }}
Expand Down
13 changes: 11 additions & 2 deletions tests/chart_tests/test_openshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
"scheduler",
"workers",
"redis",
"statsd",
"triggerer",
"migrateDatabaseJob",
"pgbouncer",
"cleanup",
]


non_airflow_components_list = [
"statsd",
"pgbouncer",
]


@pytest.mark.parametrize(
"kube_version",
supported_k8s_versions,
Expand Down Expand Up @@ -93,6 +97,11 @@ def test_openshift_flag_defaults_with_enabled_and_validate_houston_configmap(
airflowConfig = prod["deployments"]["helm"]["airflow"]

for component in airflow_components_list:
assert {"runAsNonRoot": False} == airflowConfig[component][
"securityContexts"
]["pod"]

for component in non_airflow_components_list:
assert {"runAsNonRoot": True} == airflowConfig[component][
"securityContexts"
]["pod"]

0 comments on commit e3c9337

Please sign in to comment.