Skip to content

Commit

Permalink
Rename apiServer to _apiServer to preserve it in beta until v3 release (
Browse files Browse the repository at this point in the history
apache#46480)

Closes apache#46477

The chart version 1.16.0 would be released before airflow v3, so it's better to keep api server in beta so it's easier to make changes.

Signed-off-by: Andrii Korotkov <[email protected]>
  • Loading branch information
andrii-korotkov-verkada authored Feb 6, 2025
1 parent 9951cf1 commit 0585b29
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 135 deletions.
4 changes: 2 additions & 2 deletions chart/templates/_helpers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,8 @@ server_tls_key_file = /etc/pgbouncer/server.key


{{/* Create the name of the API server service account to use */}}
{{- define "apiServer.serviceAccountName" -}}
{{- include "_serviceAccountName" (merge (dict "key" "apiServer" "nameSuffix" "api-server" ) .) -}}
{{- define "_apiServer.serviceAccountName" -}}
{{- include "_serviceAccountName" (merge (dict "key" "_apiServer" "nameSuffix" "api-server" ) .) -}}
{{- end }}

{{/* Create the name of the redis service account to use */}}
Expand Down
122 changes: 61 additions & 61 deletions chart/templates/api-server/api-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
## Airflow API Server Deployment
#################################
{{- if semverCompare ">=3.0.0" .Values.airflowVersion }}
{{- $nodeSelector := or .Values.apiServer.nodeSelector .Values.nodeSelector }}
{{- $affinity := or .Values.apiServer.affinity .Values.affinity }}
{{- $tolerations := or .Values.apiServer.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.apiServer.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.apiServer.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowPodSecurityContext" (list . .Values.apiServer) }}
{{- $containerSecurityContext := include "containerSecurityContext" (list . .Values.apiServer) }}
{{- $containerSecurityContextWaitForMigrations := include "containerSecurityContext" (list . .Values.apiServer.waitForMigrations) }}
{{- $containerLifecycleHooks := or .Values.apiServer.containerLifecycleHooks .Values.containerLifecycleHooks }}
{{- $nodeSelector := or .Values._apiServer.nodeSelector .Values.nodeSelector }}
{{- $affinity := or .Values._apiServer.affinity .Values.affinity }}
{{- $tolerations := or .Values._apiServer.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values._apiServer.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values._apiServer.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowPodSecurityContext" (list . .Values._apiServer) }}
{{- $containerSecurityContext := include "containerSecurityContext" (list . .Values._apiServer) }}
{{- $containerSecurityContextWaitForMigrations := include "containerSecurityContext" (list . .Values._apiServer.waitForMigrations) }}
{{- $containerLifecycleHooks := or .Values._apiServer.containerLifecycleHooks .Values.containerLifecycleHooks }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -43,17 +43,17 @@ metadata:
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.apiServer.annotations }}
annotations: {{- toYaml .Values.apiServer.annotations | nindent 4 }}
{{- if .Values._apiServer.annotations }}
annotations: {{- toYaml .Values._apiServer.annotations | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.apiServer.replicas }}
replicas: {{ .Values._apiServer.replicas }}
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
strategy:
{{- if .Values.apiServer.strategy }}
{{- toYaml .Values.apiServer.strategy | nindent 4 }}
{{- if .Values._apiServer.strategy }}
{{- toYaml .Values._apiServer.strategy | nindent 4 }}
{{- else }}
# Here we define the rolling update strategy
# - maxSurge define how many pod we can add at a time
Expand All @@ -78,8 +78,8 @@ spec:
tier: airflow
component: api-server
release: {{ .Release.Name }}
{{- if or (.Values.labels) (.Values.apiServer.labels) }}
{{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 8 }}
{{- if or (.Values.labels) (.Values._apiServer.labels) }}
{{- mustMerge .Values._apiServer.labels .Values.labels | toYaml | nindent 8 }}
{{- end }}
annotations:
checksum/metadata-secret: {{ include (print $.Template.BasePath "/secrets/metadata-connection-secret.yaml") . | sha256sum }}
Expand All @@ -90,16 +90,16 @@ spec:
{{- if .Values.airflowPodAnnotations }}
{{- toYaml .Values.airflowPodAnnotations | nindent 8 }}
{{- end }}
{{- if .Values.apiServer.podAnnotations }}
{{- toYaml .Values.apiServer.podAnnotations | nindent 8 }}
{{- if .Values._apiServer.podAnnotations }}
{{- toYaml .Values._apiServer.podAnnotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.apiServer.hostAliases }}
hostAliases: {{- toYaml .Values.apiServer.hostAliases | nindent 8 }}
{{- if .Values._apiServer.hostAliases }}
hostAliases: {{- toYaml .Values._apiServer.hostAliases | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "apiServer.serviceAccountName" . }}
{{- if .Values.apiServer.priorityClassName }}
priorityClassName: {{ .Values.apiServer.priorityClassName }}
serviceAccountName: {{ include "_apiServer.serviceAccountName" . }}
{{- if .Values._apiServer.priorityClassName }}
priorityClassName: {{ .Values._apiServer.priorityClassName }}
{{- end }}
{{- if .Values.schedulerName }}
schedulerName: {{ .Values.schedulerName }}
Expand Down Expand Up @@ -127,9 +127,9 @@ spec:
- name: {{ template "registry_secret" . }}
{{- end }}
initContainers:
{{- if .Values.apiServer.waitForMigrations.enabled }}
{{- if .Values._apiServer.waitForMigrations.enabled }}
- name: wait-for-airflow-migrations
resources: {{- toYaml .Values.apiServer.resources | nindent 12 }}
resources: {{- toYaml .Values._apiServer.resources | nindent 12 }}
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
securityContext: {{ $containerSecurityContextWaitForMigrations | nindent 12 }}
Expand All @@ -138,20 +138,20 @@ spec:
{{- if .Values.volumeMounts }}
{{- toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.apiServer.extraVolumeMounts }}
{{- tpl (toYaml .Values.apiServer.extraVolumeMounts) . | nindent 12 }}
{{- if .Values._apiServer.extraVolumeMounts }}
{{- tpl (toYaml .Values._apiServer.extraVolumeMounts) . | nindent 12 }}
{{- end }}
args: {{- include "wait-for-migrations-command" . | indent 10 }}
envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }}
env:
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" . | indent 10 }}
{{- if .Values.apiServer.waitForMigrations.env }}
{{- tpl (toYaml .Values.apiServer.waitForMigrations.env) $ | nindent 12 }}
{{- if .Values._apiServer.waitForMigrations.env }}
{{- tpl (toYaml .Values._apiServer.waitForMigrations.env) $ | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.apiServer.extraInitContainers }}
{{- toYaml .Values.apiServer.extraInitContainers | nindent 8 }}
{{- if .Values._apiServer.extraInitContainers }}
{{- toYaml .Values._apiServer.extraInitContainers | nindent 8 }}
{{- end }}
containers:
- name: api-server
Expand All @@ -161,13 +161,13 @@ spec:
{{- if $containerLifecycleHooks }}
lifecycle: {{- tpl (toYaml $containerLifecycleHooks) . | nindent 12 }}
{{- end }}
{{- if .Values.apiServer.command }}
command: {{ tpl (toYaml .Values.apiServer.command) . | nindent 12 }}
{{- if .Values._apiServer.command }}
command: {{ tpl (toYaml .Values._apiServer.command) . | nindent 12 }}
{{- end }}
{{- if .Values.apiServer.args }}
args: {{- tpl (toYaml .Values.apiServer.args) . | nindent 12 }}
{{- if .Values._apiServer.args }}
args: {{- tpl (toYaml .Values._apiServer.args) . | nindent 12 }}
{{- end }}
resources: {{- toYaml .Values.apiServer.resources | nindent 12 }}
resources: {{- toYaml .Values._apiServer.resources | nindent 12 }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.logs.persistence.enabled }}
Expand All @@ -177,48 +177,48 @@ spec:
{{- if .Values.volumeMounts }}
{{- toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.apiServer.extraVolumeMounts }}
{{- tpl (toYaml .Values.apiServer.extraVolumeMounts) . | nindent 12 }}
{{- if .Values._apiServer.extraVolumeMounts }}
{{- tpl (toYaml .Values._apiServer.extraVolumeMounts) . | nindent 12 }}
{{- end }}
ports:
- name: api-server
containerPort: {{ .Values.ports.apiServer }}
containerPort: {{ .Values.ports._apiServer }}
livenessProbe:
httpGet:
path: /public/version
port: {{ .Values.ports.apiServer }}
scheme: {{ .Values.apiServer.livenessProbe.scheme | default "http" }}
initialDelaySeconds: {{ .Values.apiServer.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.apiServer.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.apiServer.livenessProbe.failureThreshold }}
periodSeconds: {{ .Values.apiServer.livenessProbe.periodSeconds }}
port: {{ .Values.ports._apiServer }}
scheme: {{ .Values._apiServer.livenessProbe.scheme | default "http" }}
initialDelaySeconds: {{ .Values._apiServer.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values._apiServer.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values._apiServer.livenessProbe.failureThreshold }}
periodSeconds: {{ .Values._apiServer.livenessProbe.periodSeconds }}
readinessProbe:
httpGet:
path: /public/version
port: {{ .Values.ports.apiServer }}
scheme: {{ .Values.apiServer.readinessProbe.scheme | default "http" }}
initialDelaySeconds: {{ .Values.apiServer.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.apiServer.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.apiServer.readinessProbe.failureThreshold }}
periodSeconds: {{ .Values.apiServer.readinessProbe.periodSeconds }}
port: {{ .Values.ports._apiServer }}
scheme: {{ .Values._apiServer.readinessProbe.scheme | default "http" }}
initialDelaySeconds: {{ .Values._apiServer.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values._apiServer.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values._apiServer.readinessProbe.failureThreshold }}
periodSeconds: {{ .Values._apiServer.readinessProbe.periodSeconds }}
startupProbe:
httpGet:
path: /public/version
port: {{ .Values.ports.apiServer }}
scheme: {{ .Values.apiServer.startupProbe.scheme | default "http" }}
timeoutSeconds: {{ .Values.apiServer.startupProbe.timeoutSeconds }}
failureThreshold: {{ .Values.apiServer.startupProbe.failureThreshold }}
periodSeconds: {{ .Values.apiServer.startupProbe.periodSeconds }}
port: {{ .Values.ports._apiServer }}
scheme: {{ .Values._apiServer.startupProbe.scheme | default "http" }}
timeoutSeconds: {{ .Values._apiServer.startupProbe.timeoutSeconds }}
failureThreshold: {{ .Values._apiServer.startupProbe.failureThreshold }}
periodSeconds: {{ .Values._apiServer.startupProbe.periodSeconds }}
envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }}
env:
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" . | indent 10 }}
{{- include "container_extra_envs" (list . .Values.apiServer.env) | indent 10 }}
{{- include "container_extra_envs" (list . .Values._apiServer.env) | indent 10 }}
{{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) (semverCompare "<2.0.0" .Values.airflowVersion) }}
{{- include "git_sync_container" . | nindent 8 }}
{{- end }}
{{- if .Values.apiServer.extraContainers }}
{{- tpl (toYaml .Values.apiServer.extraContainers) . | nindent 8 }}
{{- if .Values._apiServer.extraContainers }}
{{- tpl (toYaml .Values._apiServer.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand All @@ -234,7 +234,7 @@ spec:
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.apiServer.extraVolumes }}
{{- tpl (toYaml .Values.apiServer.extraVolumes) . | nindent 8 }}
{{- if .Values._apiServer.extraVolumes }}
{{- tpl (toYaml .Values._apiServer.extraVolumes) . | nindent 8 }}
{{- end }}
{{- end }}
10 changes: 5 additions & 5 deletions chart/templates/api-server/api-server-networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- if or (.Values.labels) (.Values.apiServer.labels) }}
{{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- if or (.Values.labels) (.Values._apiServer.labels) }}
{{- mustMerge .Values._apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
spec:
podSelector:
Expand All @@ -43,11 +43,11 @@ spec:
release: {{ .Release.Name }}
policyTypes:
- Ingress
{{- if .Values.apiServer.networkPolicy.ingress.from }}
{{- if .Values._apiServer.networkPolicy.ingress.from }}
ingress:
- from: {{- toYaml .Values.apiServer.networkPolicy.ingress.from | nindent 6 }}
- from: {{- toYaml .Values._apiServer.networkPolicy.ingress.from | nindent 6 }}
ports:
{{ range .Values.apiServer.networkPolicy.ingress.ports }}
{{ range .Values._apiServer.networkPolicy.ingress.ports }}
-
{{- range $key, $val := . }}
{{ $key }}: {{ tpl (toString $val) $ }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
## Airflow api-server PodDisruptionBudget
#################################
{{- if semverCompare ">=3.0.0" .Values.airflowVersion }}
{{- if .Values.apiServer.podDisruptionBudget.enabled }}
{{- if .Values._apiServer.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Expand All @@ -32,15 +32,15 @@ metadata:
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}
heritage: {{ .Release.Service }}
{{- if or (.Values.labels) (.Values.apiServer.labels) }}
{{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- if or (.Values.labels) (.Values._apiServer.labels) }}
{{- mustMerge .Values._apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
tier: airflow
component: api-server
release: {{ .Release.Name }}
{{- toYaml .Values.apiServer.podDisruptionBudget.config | nindent 2 }}
{{- toYaml .Values._apiServer.podDisruptionBudget.config | nindent 2 }}
{{- end }}
{{- end }}
18 changes: 9 additions & 9 deletions chart/templates/api-server/api-server-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- if or (.Values.labels) (.Values.apiServer.labels) }}
{{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- if or (.Values.labels) (.Values._apiServer.labels) }}
{{- mustMerge .Values._apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.apiServer.service.annotations }}
{{- with .Values._apiServer.service.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.apiServer.service.type }}
type: {{ .Values._apiServer.service.type }}
selector:
tier: airflow
component: api-server
release: {{ .Release.Name }}
ports:
{{ range .Values.apiServer.service.ports }}
{{ range .Values._apiServer.service.ports }}
-
{{- range $key, $val := . }}
{{ $key }}: {{ tpl (toString $val) $ }}
{{- end }}
{{- end }}
{{- if .Values.apiServer.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.apiServer.service.loadBalancerIP }}
{{- if .Values._apiServer.service.loadBalancerIP }}
loadBalancerIP: {{ .Values._apiServer.service.loadBalancerIP }}
{{- end }}
{{- if .Values.apiServer.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml .Values.apiServer.service.loadBalancerSourceRanges | nindent 4 }}
{{- if .Values._apiServer.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml .Values._apiServer.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- end }}
12 changes: 6 additions & 6 deletions chart/templates/api-server/api-server-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
######################################
## Airflow api-server ServiceAccount
######################################
{{- if and .Values.apiServer.serviceAccount.create (semverCompare ">=3.0.0" .Values.airflowVersion) }}
{{- if and .Values._apiServer.serviceAccount.create (semverCompare ">=3.0.0" .Values.airflowVersion) }}
apiVersion: v1
kind: ServiceAccount
automountServiceAccountToken: {{ .Values.apiServer.serviceAccount.automountServiceAccountToken }}
automountServiceAccountToken: {{ .Values._apiServer.serviceAccount.automountServiceAccountToken }}
metadata:
name: {{ include "apiServer.serviceAccountName" . }}
name: {{ include "_apiServer.serviceAccountName" . }}
labels:
tier: airflow
component: api-server
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- if or (.Values.labels) (.Values.apiServer.labels) }}
{{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- if or (.Values.labels) (.Values._apiServer.labels) }}
{{- mustMerge .Values._apiServer.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.apiServer.serviceAccount.annotations }}
{{- with .Values._apiServer.serviceAccount.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion chart/templates/configmaps/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data:
{{- if semverCompare ">=3.0.0" .Values.airflowVersion -}}
{{- $config := merge .Values.config ( dict "workers" dict )}}
{{- if not (hasKey $config.workers "execution_api_server_url") -}}
{{- $_ := set $config.workers "execution_api_server_url" (printf "http://%s-api-server:%d/execution/" (include "airflow.fullname" .) (int .Values.ports.apiServer)) -}}
{{- $_ := set $config.workers "execution_api_server_url" (printf "http://%s-api-server:%d/execution/" (include "airflow.fullname" .) (int .Values.ports._apiServer)) -}}
{{- end -}}
{{- end -}}
# These are system-specified config overrides.
Expand Down
Loading

0 comments on commit 0585b29

Please sign in to comment.