FloChehab commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r622813836



##########
File path: docs/helm-chart/airflow-configuration.rst
##########
@@ -68,3 +71,23 @@ configuration prior to installing and deploying the service.
   The recommended way to load example DAGs using the official Docker image and 
chart is to configure the ``AIRFLOW__CORE__LOAD_EXAMPLES`` environment variable
   in ``extraEnv`` (see :doc:`Parameters reference <parameters-ref>`). Because 
the official Docker image has ``AIRFLOW__CORE__LOAD_EXAMPLES=False``
   set within the image, so you need to override it when deploying the chart.
+
+..
+   Uncomment before merge

Review comment:
       Yes! As mentionned in the PR description, I am having issues 
cross-referencing documentation and would need help here.

##########
File path: docs/helm-chart/airflow-configuration.rst
##########
@@ -68,3 +71,23 @@ configuration prior to installing and deploying the service.
   The recommended way to load example DAGs using the official Docker image and 
chart is to configure the ``AIRFLOW__CORE__LOAD_EXAMPLES`` environment variable
   in ``extraEnv`` (see :doc:`Parameters reference <parameters-ref>`). Because 
the official Docker image has ``AIRFLOW__CORE__LOAD_EXAMPLES=False``
   set within the image, so you need to override it when deploying the chart.
+
+..
+   Uncomment before merge
+
+   Airflow Variables, Connections and Pools
+   ----------------------------------------
+
+   Airflow variables and connections may be set directly with environment 
variables (see :ref:`apache-airflow:cli-and-env-variables-ref:_env_variables`). 
You can set them by using the chart values ``extraEnv``, or a combination of 
``extraConfigMaps``/``extraSecrets`` and ``extraEnvFrom`` (see :doc:`Parameters 
reference <parameters-ref>`). You may also use a secret backend (**TODO, before 
merge. Need clarification: I am not familiar with this.**)

Review comment:
       Will do.

##########
File path: chart/templates/create-pools-job.yaml
##########
@@ -0,0 +1,90 @@
+# 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 Pool Job
+#################################
+{{- if .Values.airflowPools }}
+{{- $nodeSelector := .Values.nodeSelector }}
+{{- $affinity := .Values.affinity }}
+{{- $tolerations := .Values.tolerations }}
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: {{ .Release.Name }}-create-pools
+  labels:
+    tier: airflow
+    component: create-pool-job
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+  annotations:
+    "helm.sh/hook": post-install,post-upgrade
+    "helm.sh/hook-weight": "2"
+    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
+spec:
+  template:
+    metadata:
+      labels:
+        tier: airflow
+        component: create-pool-job
+        release: {{ .Release.Name }}
+    spec:
+      securityContext:
+          runAsUser: {{ .Values.uid }}
+      restartPolicy: OnFailure
+      nodeSelector:
+{{ toYaml $nodeSelector | indent 8 }}
+      affinity:
+{{ toYaml $affinity | indent 8 }}
+      tolerations:
+{{ toYaml $tolerations | indent 8 }}
+      {{- if or .Values.registry.secretName .Values.registry.connection }}
+      imagePullSecrets:
+        - name: {{ template "registry_secret" . }}
+      {{- end }}
+      containers:
+        - name: create-pools
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          args:
+            - "bash"
+            - "-c"
+            - 'airflow pools import {{ template "airflow_pools_path" . }}'

Review comment:
       @mik-laj are we good as is ? (there are several location in the charts 
where airflow is called through bash -c)

##########
File path: chart/templates/create-pools-job.yaml
##########
@@ -0,0 +1,90 @@
+# 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 Pool Job
+#################################
+{{- if .Values.airflowPools }}
+{{- $nodeSelector := .Values.nodeSelector }}
+{{- $affinity := .Values.affinity }}
+{{- $tolerations := .Values.tolerations }}
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: {{ .Release.Name }}-create-pools
+  labels:
+    tier: airflow
+    component: create-pool-job
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+  annotations:
+    "helm.sh/hook": post-install,post-upgrade
+    "helm.sh/hook-weight": "2"
+    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
+spec:
+  template:
+    metadata:
+      labels:
+        tier: airflow
+        component: create-pool-job
+        release: {{ .Release.Name }}
+    spec:
+      securityContext:
+          runAsUser: {{ .Values.uid }}
+      restartPolicy: OnFailure
+      nodeSelector:
+{{ toYaml $nodeSelector | indent 8 }}
+      affinity:
+{{ toYaml $affinity | indent 8 }}
+      tolerations:
+{{ toYaml $tolerations | indent 8 }}
+      {{- if or .Values.registry.secretName .Values.registry.connection }}
+      imagePullSecrets:
+        - name: {{ template "registry_secret" . }}
+      {{- end }}
+      containers:
+        - name: create-pools
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          args:
+            - "bash"
+            - "-c"
+            - 'airflow pools import {{ template "airflow_pools_path" . }}'

Review comment:
       This should be doable, I haven't followed much the latest discussions 
arround the chart but out of curiosity when will the support for 1.10.x be 
dropped ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to