Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions chart/docs/customizing-labels.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.. 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.

Customizing Labels for Pods
---------------------------

The Helm chart allows you to customize labels for your Airflow objects. You can set global labels that apply to all objects and pods defined in the chart, as well as component-specific labels for individual Airflow components.

Global Labels
~~~~~~~~~~~~~

Global labels can be set using the ``labels`` parameter in your values file. These labels will be applied to all Airflow objects and pods defined in the chart:

.. code-block:: yaml

labels:
environment: production

Component-Specific Labels
~~~~~~~~~~~~~~~~~~~~~~~~~

You can also set specific labels for individual Airflow components, which will be merged with the global labels. Component-specific labels take precedence over global labels, allowing you to override them as needed.

For example, to add specific labels to different components:

.. code-block:: yaml

# Global labels applied to all pods
labels:
environment: production

# Scheduler specific labels
scheduler:
labels:
role: scheduler

# Worker specific labels
workers:
labels:
role: worker

# Webserver specific labels
webserver:
labels:
role: ui
1 change: 1 addition & 0 deletions chart/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Helm Chart for Apache Airflow
keda
using-additional-containers
customizing-workers
customizing-labels
Installing from sources<installing-helm-chart-from-sources>
Extending the Chart<extending-the-chart>

Expand Down
4 changes: 2 additions & 2 deletions chart/templates/dag-processor/dag-processor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ spec:
tier: airflow
component: dag-processor
release: {{ .Release.Name }}
{{- with .Values.labels }}
{{- toYaml . | nindent 8 }}
{{- if or .Values.labels .Values.dagProcessor.labels }}
{{- mustMerge .Values.dagProcessor.labels .Values.labels | toYaml | nindent 8 }}
{{- end }}
annotations:
checksum/metadata-secret: {{ include (print $.Template.BasePath "/secrets/metadata-connection-secret.yaml") . | sha256sum }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.dagProcessor.labels }}
{{- mustMerge .Values.dagProcessor.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.dagProcessor.serviceAccount.annotations}}
annotations: {{- toYaml . | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/redis/redis-networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.redis.labels }}
{{- mustMerge .Values.redis.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
spec:
podSelector:
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/redis/redis-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.redis.labels }}
{{- mustMerge .Values.redis.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
spec:
{{- if eq .Values.redis.service.type "ClusterIP" }}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/redis/redis-serviceaccount.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 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.redis.labels }}
{{- mustMerge .Values.redis.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.redis.serviceAccount.annotations }}
annotations: {{- toYaml . | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/redis/redis-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ spec:
tier: airflow
component: redis
release: {{ .Release.Name }}
{{- with .Values.labels }}
{{- toYaml . | nindent 8 }}
{{- if or .Values.labels .Values.redis.labels }}
{{- mustMerge .Values.redis.labels .Values.labels | toYaml | nindent 8 }}
{{- end }}
{{- if or .Values.redis.safeToEvict .Values.redis.podAnnotations }}
annotations:
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/statsd/statsd-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ spec:
tier: airflow
component: statsd
release: {{ .Release.Name }}
{{- with .Values.labels }}
{{- toYaml . | nindent 8 }}
{{- if or .Values.labels .Values.statsd.labels }}
{{- mustMerge .Values.statsd.labels .Values.labels | toYaml | nindent 8 }}
{{- end }}
{{- if or .Values.statsd.extraMappings .Values.statsd.podAnnotations }}
annotations:
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/statsd/statsd-ingress.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 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.statsd.labels }}
{{- mustMerge .Values.statsd.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.ingress.statsd.annotations }}
annotations: {{- toYaml . | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/statsd/statsd-networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.statsd.labels }}
{{- mustMerge .Values.statsd.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
spec:
podSelector:
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/statsd/statsd-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.statsd.labels }}
{{- mustMerge .Values.statsd.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
annotations:
prometheus.io/scrape: "true"
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/statsd/statsd-serviceaccount.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 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- if or .Values.labels .Values.statsd.labels }}
{{- mustMerge .Values.statsd.labels .Values.labels | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.statsd.serviceAccount.annotations }}
annotations: {{- toYaml . | nindent 4 }}
Expand Down
24 changes: 24 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4192,6 +4192,14 @@
}
}
},
"labels": {
"description": "Labels specific to dag processor objects and pods",
"type": "object",
"default": {},
"additionalProperties": {
"type": "string"
}
},
"env": {
"description": "Add additional env vars to dag processor.",
"type": "array",
Expand Down Expand Up @@ -7317,6 +7325,14 @@
"--statsd.mapping-config=/etc/statsd-exporter/mappings.yml"
]
},
"labels": {
"description": "Labels specific to statsd objects and pods",
"type": "object",
"default": {},
"additionalProperties": {
"type": "string"
}
},
"env": {
"description": "Add additional env vars to statsd container.",
"type": "array",
Expand Down Expand Up @@ -8306,6 +8322,14 @@
}
}
},
"labels": {
"description": "Labels to add to the redis objects and pods.",
"type": "object",
"default": {},
"additionalProperties": {
"type": "string"
}
},
"uid": {
"description": "Redis run as user parameter.",
"type": "integer",
Expand Down
11 changes: 11 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,10 @@ dagProcessor:
securityContexts:
container: {}

# Labels specific to dag processor objects
labels: {}

# Environment variables to add to dag processor container
env: []

# Flower settings
Expand Down Expand Up @@ -2404,6 +2408,10 @@ statsd:
overrideMappings: []

podAnnotations: {}

# Labels specific to statsd objects and pods
labels: {}
# Environment variables to add to statsd container
env: []

# PgBouncer settings
Expand Down Expand Up @@ -2717,6 +2725,9 @@ redis:
# container level lifecycle hooks
containerLifecycleHooks: {}

# Labels specific to redis objects and pods
labels: {}

podAnnotations: {}
# Auth secret for a private registry
# This is used if pulling airflow images from a private registry
Expand Down
4 changes: 2 additions & 2 deletions dev/breeze/doc/images/output-commands.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading