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/08/19 23:00:14 UTC

[GitHub] [airflow] kaxil opened a new pull request #17743: Add Triggerer to Helm Chart

kaxil opened a new pull request #17743:
URL: https://github.com/apache/airflow/pull/17743


   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/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/main/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.

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

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



[GitHub] [airflow] potiuk commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/templates/triggerer/triggerer-deployment.yaml
##########
@@ -0,0 +1,212 @@
+# 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 Triggerer Deployment
+#################################
+{{- $persistence := .Values.triggerers.persistence.enabled }}
+{{- if semverCompare ">=2.2.0" .Values.airflowVersion }}
+{{- $nodeSelector := or .Values.nodeSelector .Values.triggerers.nodeSelector }}
+{{- $affinity := or .Values.affinity .Values.triggerers.affinity }}
+{{- $tolerations := or .Values.tolerations .Values.triggerers.tolerations }}
+kind: {{ if $persistence }}StatefulSet{{ else }}Deployment{{ end }}
+apiVersion: apps/v1
+metadata:
+  name: {{ .Release.Name }}-triggerer
+  labels:
+    tier: airflow
+    component: triggerer
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+spec:
+{{- if $persistence }}
+  serviceName: {{ .Release.Name }}-triggerer
+{{- end }}
+  replicas: {{ .Values.triggerers.replicas }}
+  selector:
+    matchLabels:
+      tier: airflow
+      component: triggerer
+      release: {{ .Release.Name }}
+  {{- if and $persistence .Values.triggerers.updateStrategy }}
+  updateStrategy:
+    {{- toYaml .Values.triggerers.updateStrategy | nindent 4 }}
+  {{- end }}
+  {{- if and (not $persistence) (.Values.triggerers.strategy) }}
+  strategy:
+    {{- toYaml .Values.triggerers.strategy | nindent 4 }}
+  {{- end }}
+  template:
+    metadata:
+      labels:
+        tier: airflow
+        component: triggerer
+        release: {{ .Release.Name }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 8 }}
+{{- end }}
+      annotations:
+        checksum/metadata-secret: {{ include (print $.Template.BasePath "/secrets/metadata-connection-secret.yaml") . | sha256sum }}
+        checksum/result-backend-secret: {{ include (print $.Template.BasePath "/secrets/result-backend-connection-secret.yaml") . | sha256sum }}
+        checksum/pgbouncer-config-secret: {{ include (print $.Template.BasePath "/secrets/pgbouncer-config-secret.yaml") . | sha256sum }}
+        checksum/airflow-config: {{ include (print $.Template.BasePath "/configmaps/configmap.yaml") . | sha256sum }}
+        checksum/extra-configmaps: {{ include (print $.Template.BasePath "/configmaps/extra-configmaps.yaml") . | sha256sum }}
+        checksum/extra-secrets: {{ include (print $.Template.BasePath "/secrets/extra-secrets.yaml") . | sha256sum }}
+        {{- if .Values.triggerers.safeToEvict }}
+        cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
+        {{- end }}
+        {{- if .Values.airflowPodAnnotations }}
+        {{- toYaml .Values.airflowPodAnnotations | nindent 8 }}
+        {{- end }}
+    spec:
+      nodeSelector:
+{{ toYaml $nodeSelector | indent 8 }}
+      affinity:
+{{ toYaml $affinity | indent 8 }}
+      tolerations:
+{{ toYaml $tolerations | indent 8 }}
+{{- if .Values.triggerers.hostAliases }}
+      hostAliases:
+{{ toYaml .Values.triggerers.hostAliases | indent 8 }}
+{{- end }}
+      terminationGracePeriodSeconds: {{ .Values.triggerers.terminationGracePeriodSeconds }}
+      restartPolicy: Always
+      serviceAccountName: {{ include "triggerer.serviceAccountName" . }}
+      securityContext:
+        runAsUser: {{ .Values.uid }}
+        fsGroup: {{ .Values.gid }}
+      {{- if or .Values.registry.secretName .Values.registry.connection }}
+      imagePullSecrets:
+        - name: {{ template "registry_secret" . }}
+      {{- end }}
+      initContainers:
+      {{- if and $persistence .Values.triggerers.persistence.fixPermissions }}
+        - name: volume-permissions
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          command:
+            - chown
+            - -R
+            - "{{ .Values.uid }}:{{ .Values.gid }}"
+            - {{ template "airflow_logs" . }}
+          securityContext:
+            runAsUser: 0
+          volumeMounts:
+            - name: logs
+              mountPath: {{ template "airflow_logs" . }}
+      {{- end }}
+        - name: wait-for-airflow-migrations
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          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.triggerers.extraInitContainers }}
+        {{- toYaml .Values.triggerers.extraInitContainers | nindent 8 }}
+        {{- end }}
+      containers:
+        - name: triggerer
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          {{- if .Values.triggerers.command }}
+          command: {{ tpl (toYaml .Values.triggerers.command) . | nindent 12 }}
+          {{- end }}
+          {{- if .Values.triggerers.args }}
+          args: {{ tpl (toYaml .Values.triggerers.args) . | nindent 12 }}
+          {{- end }}
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          volumeMounts:
+{{- if .Values.triggerers.extraVolumeMounts }}
+{{ toYaml .Values.triggerers.extraVolumeMounts | indent 12 }}
+{{- end }}
+            - name: logs
+              mountPath: {{ template "airflow_logs" . }}
+            - name: config
+              mountPath: {{ template "airflow_config_path" . }}
+              subPath: airflow.cfg
+              readOnly: true
+            {{- if .Values.airflowLocalSettings }}
+            - name: config
+              mountPath: {{ template "airflow_local_setting_path" . }}
+              subPath: airflow_local_settings.py
+              readOnly: true
+            {{- end }}
+          envFrom:
+          {{- include "custom_airflow_environment_from" . | default "\n  []" | indent 10 }}
+          env:
+          {{- include "custom_airflow_environment" . | indent 10 }}
+          {{- include "standard_airflow_environment" . | indent 10 }}
+{{- if $persistence }}
+        - name: triggerer-log-groomer

Review comment:
       Good point - should we surface the logs of triggerer in the UI somehow? are there any useful logs for DAG writers and ones that can be connected to particular task runs?




-- 
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] github-actions[bot] commented on pull request #17743: Add Triggerer to Helm Chart

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


   The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.


-- 
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] jedcunningham commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/values.yaml
##########
@@ -715,6 +715,113 @@ webserver:
             topologyKey: "kubernetes.io/hostname"
   tolerations: []
 
+# Airflow Triggerer Config
+triggerers:
+  # Number of airflow triggerers in StatefulSet
+  replicas: 1
+
+  # Command to use when running Airflow triggerers (templated).
+  command: ~
+  # Args to use when running Airflow triggerers (templated).
+  args:
+    - "bash"
+    - "-c"
+    # The format below is necessary to get `helm lint` happy
+    - |-
+      exec \
+      airflow triggerer
+
+  # Update Strategy when triggerers are deployed as a StatefulSet
+  updateStrategy: ~
+  # Update Strategy when triggerers are deployed as a Deployment
+  strategy:
+    rollingUpdate:
+      maxSurge: "100%"
+      maxUnavailable: "50%"
+
+  # Create ServiceAccount
+  serviceAccount:
+    # Specifies whether a ServiceAccount should be created
+    create: true
+    # The name of the ServiceAccount to use.
+    # If not set and create is true, a name is generated using the release name
+    name: ~
+
+    # Annotations to add to triggerer kubernetes service account.
+    annotations: {}
+
+  persistence:
+    # Enable persistent volumes
+    enabled: false

Review comment:
       Should this default to True like workers?

##########
File path: chart/templates/triggerer/triggerer-deployment.yaml
##########
@@ -0,0 +1,212 @@
+# 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 Triggerer Deployment
+#################################
+{{- $persistence := .Values.triggerers.persistence.enabled }}
+{{- if semverCompare ">=2.2.0" .Values.airflowVersion }}
+{{- $nodeSelector := or .Values.nodeSelector .Values.triggerers.nodeSelector }}
+{{- $affinity := or .Values.affinity .Values.triggerers.affinity }}
+{{- $tolerations := or .Values.tolerations .Values.triggerers.tolerations }}
+kind: {{ if $persistence }}StatefulSet{{ else }}Deployment{{ end }}
+apiVersion: apps/v1
+metadata:
+  name: {{ .Release.Name }}-triggerer
+  labels:
+    tier: airflow
+    component: triggerer
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+spec:
+{{- if $persistence }}
+  serviceName: {{ .Release.Name }}-triggerer
+{{- end }}
+  replicas: {{ .Values.triggerers.replicas }}
+  selector:
+    matchLabels:
+      tier: airflow
+      component: triggerer
+      release: {{ .Release.Name }}
+  {{- if and $persistence .Values.triggerers.updateStrategy }}
+  updateStrategy:
+    {{- toYaml .Values.triggerers.updateStrategy | nindent 4 }}
+  {{- end }}
+  {{- if and (not $persistence) (.Values.triggerers.strategy) }}
+  strategy:
+    {{- toYaml .Values.triggerers.strategy | nindent 4 }}
+  {{- end }}
+  template:
+    metadata:
+      labels:
+        tier: airflow
+        component: triggerer
+        release: {{ .Release.Name }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 8 }}
+{{- end }}
+      annotations:
+        checksum/metadata-secret: {{ include (print $.Template.BasePath "/secrets/metadata-connection-secret.yaml") . | sha256sum }}
+        checksum/result-backend-secret: {{ include (print $.Template.BasePath "/secrets/result-backend-connection-secret.yaml") . | sha256sum }}
+        checksum/pgbouncer-config-secret: {{ include (print $.Template.BasePath "/secrets/pgbouncer-config-secret.yaml") . | sha256sum }}
+        checksum/airflow-config: {{ include (print $.Template.BasePath "/configmaps/configmap.yaml") . | sha256sum }}
+        checksum/extra-configmaps: {{ include (print $.Template.BasePath "/configmaps/extra-configmaps.yaml") . | sha256sum }}
+        checksum/extra-secrets: {{ include (print $.Template.BasePath "/secrets/extra-secrets.yaml") . | sha256sum }}
+        {{- if .Values.triggerers.safeToEvict }}
+        cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
+        {{- end }}
+        {{- if .Values.airflowPodAnnotations }}
+        {{- toYaml .Values.airflowPodAnnotations | nindent 8 }}
+        {{- end }}
+    spec:
+      nodeSelector:
+{{ toYaml $nodeSelector | indent 8 }}
+      affinity:
+{{ toYaml $affinity | indent 8 }}
+      tolerations:
+{{ toYaml $tolerations | indent 8 }}
+{{- if .Values.triggerers.hostAliases }}
+      hostAliases:
+{{ toYaml .Values.triggerers.hostAliases | indent 8 }}
+{{- end }}
+      terminationGracePeriodSeconds: {{ .Values.triggerers.terminationGracePeriodSeconds }}
+      restartPolicy: Always
+      serviceAccountName: {{ include "triggerer.serviceAccountName" . }}
+      securityContext:
+        runAsUser: {{ .Values.uid }}
+        fsGroup: {{ .Values.gid }}
+      {{- if or .Values.registry.secretName .Values.registry.connection }}
+      imagePullSecrets:
+        - name: {{ template "registry_secret" . }}
+      {{- end }}
+      initContainers:
+      {{- if and $persistence .Values.triggerers.persistence.fixPermissions }}
+        - name: volume-permissions
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          command:
+            - chown
+            - -R
+            - "{{ .Values.uid }}:{{ .Values.gid }}"
+            - {{ template "airflow_logs" . }}
+          securityContext:
+            runAsUser: 0
+          volumeMounts:
+            - name: logs
+              mountPath: {{ template "airflow_logs" . }}
+      {{- end }}
+        - name: wait-for-airflow-migrations
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          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.triggerers.extraInitContainers }}
+        {{- toYaml .Values.triggerers.extraInitContainers | nindent 8 }}
+        {{- end }}
+      containers:
+        - name: triggerer
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          {{- if .Values.triggerers.command }}
+          command: {{ tpl (toYaml .Values.triggerers.command) . | nindent 12 }}
+          {{- end }}
+          {{- if .Values.triggerers.args }}
+          args: {{ tpl (toYaml .Values.triggerers.args) . | nindent 12 }}
+          {{- end }}
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          volumeMounts:
+{{- if .Values.triggerers.extraVolumeMounts }}
+{{ toYaml .Values.triggerers.extraVolumeMounts | indent 12 }}
+{{- end }}
+            - name: logs
+              mountPath: {{ template "airflow_logs" . }}
+            - name: config
+              mountPath: {{ template "airflow_config_path" . }}
+              subPath: airflow.cfg
+              readOnly: true
+            {{- if .Values.airflowLocalSettings }}
+            - name: config
+              mountPath: {{ template "airflow_local_setting_path" . }}
+              subPath: airflow_local_settings.py
+              readOnly: true
+            {{- end }}
+          envFrom:
+          {{- include "custom_airflow_environment_from" . | default "\n  []" | indent 10 }}
+          env:
+          {{- include "custom_airflow_environment" . | indent 10 }}
+          {{- include "standard_airflow_environment" . | indent 10 }}
+{{- if $persistence }}
+        - name: triggerer-log-groomer

Review comment:
       Right now the triggerer doesn't start the log server, should it?
   
   I haven't really dug in here, but if we are storing logs locally, thus needing a groomer, don't we need to be able to get them?




-- 
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] jedcunningham commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/values.yaml
##########
@@ -719,6 +719,78 @@ webserver:
             topologyKey: "kubernetes.io/hostname"
   tolerations: []
 
+# Airflow Triggerer Config
+triggerer:
+  # Number of airflow triggerers in the deployment
+  replicas: 1
+
+  # Command to use when running Airflow triggerers (templated).
+  command: ~
+  # Args to use when running Airflow triggerer (templated).
+  args: ["bash", "-c", "exec airflow triggerer"]
+
+  # Update Strategy when triggerers are deployed as a Deployment

Review comment:
       ```suggestion
     # Update Strategy for triggerers
   ```




-- 
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] kaxil commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/values.yaml
##########
@@ -715,6 +715,113 @@ webserver:
             topologyKey: "kubernetes.io/hostname"
   tolerations: []
 
+# Airflow Triggerer Config
+triggerers:
+  # Number of airflow triggerers in StatefulSet
+  replicas: 1
+
+  # Command to use when running Airflow triggerers (templated).
+  command: ~
+  # Args to use when running Airflow triggerers (templated).
+  args:
+    - "bash"
+    - "-c"
+    # The format below is necessary to get `helm lint` happy
+    - |-
+      exec \
+      airflow triggerer
+
+  # Update Strategy when triggerers are deployed as a StatefulSet
+  updateStrategy: ~
+  # Update Strategy when triggerers are deployed as a Deployment
+  strategy:
+    rollingUpdate:
+      maxSurge: "100%"
+      maxUnavailable: "50%"
+
+  # Create ServiceAccount
+  serviceAccount:
+    # Specifies whether a ServiceAccount should be created
+    create: true
+    # The name of the ServiceAccount to use.
+    # If not set and create is true, a name is generated using the release name
+    name: ~
+
+    # Annotations to add to triggerer kubernetes service account.
+    annotations: {}
+
+  persistence:
+    # Enable persistent volumes
+    enabled: false

Review comment:
       I made it a deployment -- there isn't any state on Triggers




-- 
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] potiuk commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/templates/triggerer/triggerer-deployment.yaml
##########
@@ -0,0 +1,212 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       Oh yeah. Shame on me :(




-- 
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] potiuk commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/templates/triggerer/triggerer-deployment.yaml
##########
@@ -0,0 +1,212 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       Same as in docker compose, I believe this won't work for Airflow pre 2.2. But people will use Helm Chart for 2.1 and 2.0 versions of airflow for quite a while. Should we make some ifs here?




-- 
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] kaxil merged pull request #17743: Add Triggerer to Helm Chart

Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #17743:
URL: https://github.com/apache/airflow/pull/17743


   


-- 
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] jedcunningham commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/templates/triggerer/triggerer-deployment.yaml
##########
@@ -0,0 +1,212 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       The check is there, line 22 (currently).
   
   Swapping $persistence and the version check would probably be a good idea though.




-- 
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] kaxil commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/templates/triggerer/triggerer-deployment.yaml
##########
@@ -0,0 +1,181 @@
+# 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 Triggerer Deployment
+#################################
+{{- if semverCompare ">=2.2.0" .Values.airflowVersion }}
+{{- $nodeSelector := or .Values.nodeSelector .Values.triggerer.nodeSelector }}
+{{- $affinity := or .Values.affinity .Values.triggerer.affinity }}
+{{- $tolerations := or .Values.tolerations .Values.triggerer.tolerations }}
+kind: Deployment
+apiVersion: apps/v1
+metadata:
+  name: {{ .Release.Name }}-triggerer
+  labels:
+    tier: airflow
+    component: triggerer
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+    {{- with .Values.labels }}
+    {{- toYaml . | indent 4 }}
+    {{- end }}
+spec:
+  replicas: {{ .Values.triggerer.replicas }}
+  selector:
+    matchLabels:
+      tier: airflow
+      component: triggerer
+      release: {{ .Release.Name }}
+  {{- if .Values.triggerer.strategy }}
+  strategy:
+    {{- toYaml .Values.triggerer.strategy | nindent 4 }}
+  {{- end }}
+  template:
+    metadata:
+      labels:
+        tier: airflow
+        component: triggerer
+        release: {{ .Release.Name }}
+        {{- with .Values.labels }}
+        {{- toYaml . | nindent 8 }}
+        {{- end }}
+      annotations:
+        checksum/metadata-secret: {{ include (print $.Template.BasePath "/secrets/metadata-connection-secret.yaml") . | sha256sum }}
+        checksum/result-backend-secret: {{ include (print $.Template.BasePath "/secrets/result-backend-connection-secret.yaml") . | sha256sum }}
+        checksum/pgbouncer-config-secret: {{ include (print $.Template.BasePath "/secrets/pgbouncer-config-secret.yaml") . | sha256sum }}
+        checksum/airflow-config: {{ include (print $.Template.BasePath "/configmaps/configmap.yaml") . | sha256sum }}
+        checksum/extra-configmaps: {{ include (print $.Template.BasePath "/configmaps/extra-configmaps.yaml") . | sha256sum }}
+        checksum/extra-secrets: {{ include (print $.Template.BasePath "/secrets/extra-secrets.yaml") . | sha256sum }}
+        {{- if .Values.triggerer.safeToEvict }}
+        cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
+        {{- end }}
+        {{- if .Values.airflowPodAnnotations }}
+        {{- toYaml .Values.airflowPodAnnotations | nindent 8 }}
+        {{- end }}
+    spec:
+      nodeSelector:
+        {{- toYaml $nodeSelector | nindent 8 }}
+      affinity:
+        {{- toYaml $affinity | nindent 8 }}
+      tolerations:
+        {{- toYaml $tolerations | nindent 8 }}
+      terminationGracePeriodSeconds: {{ .Values.triggerer.terminationGracePeriodSeconds }}
+      restartPolicy: Always
+      serviceAccountName: {{ include "triggerer.serviceAccountName" . }}
+      securityContext:
+        runAsUser: {{ .Values.uid }}
+        fsGroup: {{ .Values.gid }}
+      {{- if or .Values.registry.secretName .Values.registry.connection }}
+      imagePullSecrets:
+        - name: {{ template "registry_secret" . }}
+      {{- end }}
+      initContainers:
+        - name: wait-for-airflow-migrations
+          resources:
+            {{- toYaml .Values.triggerer.resources | nindent 12 }}
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          args:
+          {{- include "wait-for-migrations-command" . | nindent 10 }}
+          envFrom:
+          {{- include "custom_airflow_environment_from" . | default "\n  []" | nindent 10 }}
+          env:
+          {{- include "custom_airflow_environment" . | nindent 10 }}
+          {{- include "standard_airflow_environment" . | nindent 10 }}
+        {{- if .Values.triggerer.extraInitContainers }}
+        {{- toYaml .Values.triggerer.extraInitContainers | nindent 8 }}
+        {{- end }}
+      containers:
+        - name: triggerer
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          {{- if .Values.triggerer.command }}
+          command: {{ tpl (toYaml .Values.triggerer.command) . | nindent 12 }}
+          {{- end }}
+          {{- if .Values.triggerer.args }}
+          args: {{ tpl (toYaml .Values.triggerer.args) . | nindent 12 }}
+          {{- end }}
+          resources:
+            {{ toYaml .Values.triggerer.resources | nindent 12 }}
+          volumeMounts:
+            {{- if .Values.triggerer.extraVolumeMounts }}
+            {{ toYaml .Values.triggerer.extraVolumeMounts | nindent 12 }}
+            {{- end }}
+            - name: logs
+              mountPath: {{ template "airflow_logs" . }}
+            - name: config
+              mountPath: {{ template "airflow_config_path" . }}
+              subPath: airflow.cfg
+              readOnly: true
+            {{- if .Values.airflowLocalSettings }}
+            - name: config
+              mountPath: {{ template "airflow_local_setting_path" . }}
+              subPath: airflow_local_settings.py
+              readOnly: true
+            {{- end }}
+          envFrom:
+          {{- include "custom_airflow_environment_from" . | default "\n  []" | nindent 10 }}
+          env:
+          {{- include "custom_airflow_environment" . | nindent 10 }}
+          {{- include "standard_airflow_environment" . | nindent 10 }}
+          livenessProbe:
+            initialDelaySeconds: {{ .Values.triggerer.livenessProbe.initialDelaySeconds }}
+            timeoutSeconds: {{ .Values.triggerer.livenessProbe.timeoutSeconds }}
+            failureThreshold: {{ .Values.triggerer.livenessProbe.failureThreshold }}
+            periodSeconds: {{ .Values.triggerer.livenessProbe.periodSeconds }}
+            exec:
+              command:
+              - /entrypoint
+              - python
+              - -Wignore
+              - -c
+              - |
+                import os
+                os.environ['AIRFLOW__CORE__LOGGING_LEVEL'] = 'ERROR'
+                os.environ['AIRFLOW__LOGGING__LOGGING_LEVEL'] = 'ERROR'
+
+                from airflow.jobs.triggerer_job. import TriggererJob
+                from airflow.utils.db import create_session
+                from airflow.utils.net import get_hostname
+                import sys
+
+                with create_session() as session:
+                    job = session.query(TriggererJob).filter_by(hostname=get_hostname()).order_by(
+                        SchedulerJob.latest_heartbeat.desc()).limit(1).first()

Review comment:
       ```suggestion
                           TriggererJob.latest_heartbeat.desc()).limit(1).first()
   ```




-- 
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] kaxil commented on a change in pull request #17743: Add Triggerer to Helm Chart

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



##########
File path: chart/templates/triggerer/triggerer-deployment.yaml
##########
@@ -0,0 +1,212 @@
+# 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 Triggerer Deployment
+#################################
+{{- $persistence := .Values.triggerers.persistence.enabled }}
+{{- if semverCompare ">=2.2.0" .Values.airflowVersion }}
+{{- $nodeSelector := or .Values.nodeSelector .Values.triggerers.nodeSelector }}
+{{- $affinity := or .Values.affinity .Values.triggerers.affinity }}
+{{- $tolerations := or .Values.tolerations .Values.triggerers.tolerations }}
+kind: {{ if $persistence }}StatefulSet{{ else }}Deployment{{ end }}
+apiVersion: apps/v1
+metadata:
+  name: {{ .Release.Name }}-triggerer
+  labels:
+    tier: airflow
+    component: triggerer
+    release: {{ .Release.Name }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    heritage: {{ .Release.Service }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+spec:
+{{- if $persistence }}
+  serviceName: {{ .Release.Name }}-triggerer
+{{- end }}
+  replicas: {{ .Values.triggerers.replicas }}
+  selector:
+    matchLabels:
+      tier: airflow
+      component: triggerer
+      release: {{ .Release.Name }}
+  {{- if and $persistence .Values.triggerers.updateStrategy }}
+  updateStrategy:
+    {{- toYaml .Values.triggerers.updateStrategy | nindent 4 }}
+  {{- end }}
+  {{- if and (not $persistence) (.Values.triggerers.strategy) }}
+  strategy:
+    {{- toYaml .Values.triggerers.strategy | nindent 4 }}
+  {{- end }}
+  template:
+    metadata:
+      labels:
+        tier: airflow
+        component: triggerer
+        release: {{ .Release.Name }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 8 }}
+{{- end }}
+      annotations:
+        checksum/metadata-secret: {{ include (print $.Template.BasePath "/secrets/metadata-connection-secret.yaml") . | sha256sum }}
+        checksum/result-backend-secret: {{ include (print $.Template.BasePath "/secrets/result-backend-connection-secret.yaml") . | sha256sum }}
+        checksum/pgbouncer-config-secret: {{ include (print $.Template.BasePath "/secrets/pgbouncer-config-secret.yaml") . | sha256sum }}
+        checksum/airflow-config: {{ include (print $.Template.BasePath "/configmaps/configmap.yaml") . | sha256sum }}
+        checksum/extra-configmaps: {{ include (print $.Template.BasePath "/configmaps/extra-configmaps.yaml") . | sha256sum }}
+        checksum/extra-secrets: {{ include (print $.Template.BasePath "/secrets/extra-secrets.yaml") . | sha256sum }}
+        {{- if .Values.triggerers.safeToEvict }}
+        cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
+        {{- end }}
+        {{- if .Values.airflowPodAnnotations }}
+        {{- toYaml .Values.airflowPodAnnotations | nindent 8 }}
+        {{- end }}
+    spec:
+      nodeSelector:
+{{ toYaml $nodeSelector | indent 8 }}
+      affinity:
+{{ toYaml $affinity | indent 8 }}
+      tolerations:
+{{ toYaml $tolerations | indent 8 }}
+{{- if .Values.triggerers.hostAliases }}
+      hostAliases:
+{{ toYaml .Values.triggerers.hostAliases | indent 8 }}
+{{- end }}
+      terminationGracePeriodSeconds: {{ .Values.triggerers.terminationGracePeriodSeconds }}
+      restartPolicy: Always
+      serviceAccountName: {{ include "triggerer.serviceAccountName" . }}
+      securityContext:
+        runAsUser: {{ .Values.uid }}
+        fsGroup: {{ .Values.gid }}
+      {{- if or .Values.registry.secretName .Values.registry.connection }}
+      imagePullSecrets:
+        - name: {{ template "registry_secret" . }}
+      {{- end }}
+      initContainers:
+      {{- if and $persistence .Values.triggerers.persistence.fixPermissions }}
+        - name: volume-permissions
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          command:
+            - chown
+            - -R
+            - "{{ .Values.uid }}:{{ .Values.gid }}"
+            - {{ template "airflow_logs" . }}
+          securityContext:
+            runAsUser: 0
+          volumeMounts:
+            - name: logs
+              mountPath: {{ template "airflow_logs" . }}
+      {{- end }}
+        - name: wait-for-airflow-migrations
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          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.triggerers.extraInitContainers }}
+        {{- toYaml .Values.triggerers.extraInitContainers | nindent 8 }}
+        {{- end }}
+      containers:
+        - name: triggerer
+          image: {{ template "airflow_image" . }}
+          imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+          {{- if .Values.triggerers.command }}
+          command: {{ tpl (toYaml .Values.triggerers.command) . | nindent 12 }}
+          {{- end }}
+          {{- if .Values.triggerers.args }}
+          args: {{ tpl (toYaml .Values.triggerers.args) . | nindent 12 }}
+          {{- end }}
+          resources:
+{{ toYaml .Values.triggerers.resources | indent 12 }}
+          volumeMounts:
+{{- if .Values.triggerers.extraVolumeMounts }}
+{{ toYaml .Values.triggerers.extraVolumeMounts | indent 12 }}
+{{- end }}
+            - name: logs
+              mountPath: {{ template "airflow_logs" . }}
+            - name: config
+              mountPath: {{ template "airflow_config_path" . }}
+              subPath: airflow.cfg
+              readOnly: true
+            {{- if .Values.airflowLocalSettings }}
+            - name: config
+              mountPath: {{ template "airflow_local_setting_path" . }}
+              subPath: airflow_local_settings.py
+              readOnly: true
+            {{- end }}
+          envFrom:
+          {{- include "custom_airflow_environment_from" . | default "\n  []" | indent 10 }}
+          env:
+          {{- include "custom_airflow_environment" . | indent 10 }}
+          {{- include "standard_airflow_environment" . | indent 10 }}
+{{- if $persistence }}
+        - name: triggerer-log-groomer

Review comment:
       Me and Andrew G had a talk this morning about it -- currently we don't store logs and there isn't much useful data in Triggerer logs but we will add more observability aroud Triggerer -- most likely somehow show it with Task Logs or a something similar, we haven't yet finalized.




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