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
4 changes: 4 additions & 0 deletions chart/templates/dag-processor/dag-processor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{{- $affinity := or .Values.dagProcessor.affinity .Values.affinity }}
{{- $tolerations := or .Values.dagProcessor.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.dagProcessor.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.dagProcessor.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowSecurityContext" (list . .Values.dagProcessor) }}
kind: Deployment
apiVersion: apps/v1
Expand All @@ -40,6 +41,9 @@ metadata:
{{- end }}
spec:
replicas: {{ .Values.dagProcessor.replicas }}
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
tier: airflow
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/flower/flower-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{{- $affinity := or .Values.flower.affinity .Values.affinity }}
{{- $tolerations := or .Values.flower.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.flower.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.flower.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowSecurityContext" (list . .Values.flower) }}
kind: Deployment
apiVersion: apps/v1
Expand All @@ -40,6 +41,9 @@ metadata:
{{- end }}
spec:
replicas: 1
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
tier: airflow
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/pgbouncer/pgbouncer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{{- $affinity := or .Values.pgbouncer.affinity .Values.affinity }}
{{- $tolerations := or .Values.pgbouncer.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.pgbouncer.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.pgbouncer.revisionHistoryLimit .Values.revisionHistoryLimit }}
kind: Deployment
apiVersion: apps/v1
metadata:
Expand All @@ -38,6 +39,9 @@ metadata:
{{- end }}
spec:
replicas: 1
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
strategy:
rollingUpdate:
maxSurge: 1
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/scheduler/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
{{- $affinity := or .Values.scheduler.affinity .Values.affinity }}
{{- $tolerations := or .Values.scheduler.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.scheduler.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.scheduler.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowSecurityContext" (list . .Values.scheduler) }}

kind: {{ if $stateful }}StatefulSet{{ else }}Deployment{{ end }}
Expand All @@ -54,6 +55,9 @@ spec:
serviceName: {{ .Release.Name }}-scheduler
{{- end }}
replicas: {{ .Values.scheduler.replicas }}
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
{{- if and $stateful .Values.scheduler.updateStrategy }}
updateStrategy:
{{- toYaml .Values.scheduler.updateStrategy | nindent 4 }}
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/statsd/statsd-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{{- $affinity := or .Values.statsd.affinity .Values.affinity }}
{{- $tolerations := or .Values.statsd.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.statsd.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.statsd.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "localSecurityContext" .Values.statsd }}
kind: Deployment
apiVersion: apps/v1
Expand All @@ -39,6 +40,9 @@ metadata:
{{- end }}
spec:
replicas: 1
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
tier: airflow
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/triggerer/triggerer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{{- $affinity := or .Values.triggerer.affinity .Values.affinity }}
{{- $tolerations := or .Values.triggerer.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.triggerer.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.triggerer.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowSecurityContext" (list . .Values.triggerer) }}
kind: Deployment
apiVersion: apps/v1
Expand All @@ -40,6 +41,9 @@ metadata:
{{- end }}
spec:
replicas: {{ .Values.triggerer.replicas }}
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
tier: airflow
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/webserver/webserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{{- $affinity := or .Values.webserver.affinity .Values.affinity }}
{{- $tolerations := or .Values.webserver.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.webserver.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.webserver.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowSecurityContext" (list . .Values.webserver) }}
kind: Deployment
apiVersion: apps/v1
Expand All @@ -38,6 +39,9 @@ metadata:
{{- end }}
spec:
replicas: {{ .Values.webserver.replicas }}
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
strategy:
{{- if .Values.webserver.strategy }}
{{- toYaml .Values.webserver.strategy | nindent 4 }}
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/workers/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{{- $affinity := or .Values.workers.affinity .Values.affinity }}
{{- $tolerations := or .Values.workers.tolerations .Values.tolerations }}
{{- $topologySpreadConstraints := or .Values.workers.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $revisionHistoryLimit := or .Values.workers.revisionHistoryLimit .Values.revisionHistoryLimit }}
{{- $securityContext := include "airflowSecurityContext" (list . .Values.workers) }}
kind: {{ if $persistence }}StatefulSet{{ else }}Deployment{{ end }}
apiVersion: apps/v1
Expand All @@ -43,6 +44,9 @@ spec:
serviceName: {{ .Release.Name }}-worker
{{- end }}
replicas: {{ .Values.workers.replicas }}
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
tier: airflow
Expand Down
81 changes: 81 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
"default": "",
"x-docsSection": null
},
"revisionHistoryLimit": {
"description": "Global number of old replicasets to retain. Can be overridden by each deployment's revisionHistoryLimit",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"nameOverride": {
"description": "Override the name of the chart",
"type": "string",
Expand Down Expand Up @@ -1139,6 +1148,15 @@
"type": "integer",
"default": 1
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"command": {
"description": "Command to use when running Airflow workers (templated).",
"type": [
Expand Down Expand Up @@ -1593,6 +1611,15 @@
"type": "integer",
"default": 1
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"command": {
"description": "Command to use when running the Airflow scheduler (templated).",
"type": [
Expand Down Expand Up @@ -1934,6 +1961,15 @@
"type": "integer",
"default": 1
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"command": {
"description": "Command to use when running the Airflow triggerer (templated).",
"type": [
Expand Down Expand Up @@ -2192,6 +2228,15 @@
"type": "integer",
"default": 1
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"command": {
"description": "Command to use when running the Airflow dag processor (templated).",
"type": [
Expand Down Expand Up @@ -2831,6 +2876,15 @@
"type": "integer",
"default": 1
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"command": {
"description": "Command to use when running the Airflow webserver (templated).",
"type": [
Expand Down Expand Up @@ -3244,6 +3298,15 @@
"type": "boolean",
"default": false
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"command": {
"description": "Command to use when running flower (templated).",
"type": [
Expand Down Expand Up @@ -3565,6 +3628,15 @@
"type": "boolean",
"default": true
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"extraNetworkPolicies": {
"description": "Additional NetworkPolicies as needed.",
"type": "array",
Expand Down Expand Up @@ -3711,6 +3783,15 @@
"x-docsSection": "Common",
"default": false
},
"revisionHistoryLimit": {
"description": "Number of old replicasets to retain.",
"type": [
"integer",
"null"
],
"default": null,
"x-docsSection": null
},
"command": {
"description": "Command to use for PgBouncer (templated).",
"type": [
Expand Down
19 changes: 19 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ nameOverride: ""
# Provide a Kubernetes version (used for API Version selection) to override the auto-detected version
kubeVersionOverride: ""

# Max number of old replicasets to retain. Can be overridden by each deployment's revisionHistoryLimit
revisionHistoryLimit: ~

# User and group of airflow user
uid: 50000
gid: 0
Expand Down Expand Up @@ -431,6 +434,8 @@ kerberos:
workers:
# Number of airflow celery workers in StatefulSet
replicas: 1
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Command to use when running Airflow workers (templated).
command: ~
Expand Down Expand Up @@ -605,6 +610,8 @@ scheduler:
# Airflow 2.0 allows users to run multiple schedulers,
# However this feature is only recommended for MySQL 8+ and Postgres
replicas: 1
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Command to use when running the Airflow scheduler (templated).
command: ~
Expand Down Expand Up @@ -853,6 +860,8 @@ webserver:

# Number of webservers
replicas: 1
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Command to use when running the Airflow webserver (templated).
command: ~
Expand Down Expand Up @@ -986,6 +995,8 @@ triggerer:
enabled: true
# Number of airflow triggerers in the deployment
replicas: 1
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Command to use when running Airflow triggerers (templated).
command: ~
Expand Down Expand Up @@ -1076,6 +1087,8 @@ dagProcessor:
enabled: false
# Number of airflow dag processors in the deployment
replicas: 1
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Command to use when running Airflow dag processors (templated).
command: ~
Expand Down Expand Up @@ -1166,6 +1179,8 @@ flower:
# Enable flower.
# If True, and using CeleryExecutor/CeleryKubernetesExecutor, will deploy flower app.
enabled: false
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Command to use when running flower (templated).
command: ~
Expand Down Expand Up @@ -1257,6 +1272,8 @@ flower:
# StatsD settings
statsd:
enabled: true
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Create ServiceAccount
serviceAccount:
Expand Down Expand Up @@ -1304,6 +1321,8 @@ statsd:
pgbouncer:
# Enable PgBouncer
enabled: false
# Max number of old replicasets to retain
revisionHistoryLimit: ~
# Command to use for PgBouncer(templated).
command: ["pgbouncer", "-u", "nobody", "/etc/pgbouncer/pgbouncer.ini"]
# Args to use for PgBouncer(templated).
Expand Down
18 changes: 18 additions & 0 deletions tests/charts/test_dag_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,24 @@ def test_default_command_and_args(self):
"spec.template.spec.containers[0].args", docs[0]
)

@parameterized.expand([(8, 10), (10, 8), (8, None), (None, 10), (None, None)])
def test_revision_history_limit(self, revision_history_limit, global_revision_history_limit):
values = {
"dagProcessor": {
"enabled": True,
}
}
if revision_history_limit:
values['dagProcessor']['revisionHistoryLimit'] = revision_history_limit
if global_revision_history_limit:
values['revisionHistoryLimit'] = global_revision_history_limit
docs = render_chart(
values=values,
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
)
expected_result = revision_history_limit if revision_history_limit else global_revision_history_limit
assert jmespath.search("spec.revisionHistoryLimit", docs[0]) == expected_result

@parameterized.expand(
[
(None, None),
Expand Down
Loading