You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/30 16:53:11 UTC

[GitHub] [airflow] FloChehab opened a new pull request #15093: Add support to create airflow pools from chart values

FloChehab opened a new pull request #15093:
URL: https://github.com/apache/airflow/pull/15093


   Hello @mik-laj, 
   
   I finally had time to look into #11707 ; _for this issue I have introduced 4 of my soon-to-be ex-collaborators to this chart so maybe you will have new contributors (you should expect a bit less contributions from myself in the coming months)._
   
   ## Changes
   
   * Pools can now be added through the airflowPools value
   * Docs also updated in that regard
   
   Done in collaboration with @abrasseu @Jattakuy @JonathanCiglia @manzkel .
   
   Closes #11707
   
   ## Todos
   
   I have left a couple of TODOs mostly in docs as I was having issues cross-referencing docs locally.
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


-- 
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:
users@infra.apache.org



[GitHub] [airflow] FloChehab commented on pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
FloChehab commented on pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#issuecomment-855438374


   Hello there !
   I just wanted to tell you that I am busy and my interest has shifted a bit outside of airflow.
   If anyone wants to move this PR forward, feel free to go ahead (from a new one?).
   
   Best of luck !


-- 
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:
users@infra.apache.org



[GitHub] [airflow] dnskr commented on pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
dnskr commented on pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#issuecomment-842231453


   Any progress on this feature? Looking forward to have it merged :)


-- 
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:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r604500534



##########
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:
       it would be helpful to add an example for lazy people showing how to set up an environment variable that uses a secret.




-- 
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:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r604503868



##########
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:
       What do you think to add support for Airflow 1.10.13? This version uses `airflow pool --import` command. 
   ```bash
   if airflow pools import --help; then
       exec airflow pools import ....
   else:
      exec  airflow pool --import ...
   fi
   ```

##########
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:
       What do you think to add support for Airflow 1.10.13? This version uses `airflow pool --import` command. 
   ```bash
   if airflow pools import --help; then
       exec airflow pools import ....
   else:
       exec airflow pool --import ...
   fi
   ```




-- 
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:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r604500534



##########
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:
       Here is a helpful example for lazy people showing how to set up an environment variable that uses a secret.




-- 
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:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r604437402



##########
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:
       Should probably do this then, shouldn't we :)




-- 
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:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] closed pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #15093:
URL: https://github.com/apache/airflow/pull/15093


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r604436793



##########
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:
       ```suggestion
             args:
               - "airflow"
               - "pools"
               - "import"
               - {{ template "airflow_pools_path" . }}
   ```
   
   I think




-- 
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:
users@infra.apache.org



[GitHub] [airflow] dnskr commented on pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
dnskr commented on pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#issuecomment-842231453


   Any progress on this feature? Looking forward to have it merged :)


-- 
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:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r604503868



##########
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:
       What do you think to add support for Airflow 1.10.13? This version uses `airflow pool --import` command. 
   ```bash
   if airflow pools import --help; then
       airflow pools import ....
   else:
       airflow pool --import ...
   fi
   ```




-- 
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:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r604501897



##########
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:
       I'm afraid that won't work with some Docker images. It's a similar problem to: https://github.com/apache/airflow/pull/11129




-- 
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:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#discussion_r623500301



##########
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:
       The Chart, for now, will continue supporting 1.10.x too




-- 
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:
users@infra.apache.org



[GitHub] [airflow] FloChehab commented on a change in pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #15093: Add support to create airflow pools from chart values

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #15093:
URL: https://github.com/apache/airflow/pull/15093#issuecomment-890612572


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org