You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/07/20 17:49:28 UTC
[airflow] branch main updated: Add revisionHistoryLimit to all deployments (#25059)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 48eb18e031 Add revisionHistoryLimit to all deployments (#25059)
48eb18e031 is described below
commit 48eb18e031d3baef363c3567b6ae23a206fc6cc3
Author: Carlos Sánchez Páez <ka...@gmail.com>
AuthorDate: Wed Jul 20 19:49:08 2022 +0200
Add revisionHistoryLimit to all deployments (#25059)
---
.../dag-processor/dag-processor-deployment.yaml | 4 ++
chart/templates/flower/flower-deployment.yaml | 4 ++
.../templates/pgbouncer/pgbouncer-deployment.yaml | 4 ++
.../templates/scheduler/scheduler-deployment.yaml | 4 ++
chart/templates/statsd/statsd-deployment.yaml | 4 ++
.../templates/triggerer/triggerer-deployment.yaml | 4 ++
.../templates/webserver/webserver-deployment.yaml | 4 ++
chart/templates/workers/worker-deployment.yaml | 4 ++
chart/values.schema.json | 81 ++++++++++++++++++++++
chart/values.yaml | 19 +++++
tests/charts/test_dag_processor.py | 18 +++++
tests/charts/test_flower.py | 19 +++++
tests/charts/test_pgbouncer.py | 18 +++++
tests/charts/test_scheduler.py | 14 ++++
tests/charts/test_statsd.py | 15 ++++
tests/charts/test_triggerer.py | 18 +++++
tests/charts/test_webserver.py | 14 ++++
tests/charts/test_worker.py | 14 ++++
18 files changed, 262 insertions(+)
diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml b/chart/templates/dag-processor/dag-processor-deployment.yaml
index 7ed7802c45..485859456a 100644
--- a/chart/templates/dag-processor/dag-processor-deployment.yaml
+++ b/chart/templates/dag-processor/dag-processor-deployment.yaml
@@ -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
@@ -40,6 +41,9 @@ metadata:
{{- end }}
spec:
replicas: {{ .Values.dagProcessor.replicas }}
+ {{- if $revisionHistoryLimit }}
+ revisionHistoryLimit: {{ $revisionHistoryLimit }}
+ {{- end }}
selector:
matchLabels:
tier: airflow
diff --git a/chart/templates/flower/flower-deployment.yaml b/chart/templates/flower/flower-deployment.yaml
index 18ca45ed5e..08c879d216 100644
--- a/chart/templates/flower/flower-deployment.yaml
+++ b/chart/templates/flower/flower-deployment.yaml
@@ -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
@@ -40,6 +41,9 @@ metadata:
{{- end }}
spec:
replicas: 1
+ {{- if $revisionHistoryLimit }}
+ revisionHistoryLimit: {{ $revisionHistoryLimit }}
+ {{- end }}
selector:
matchLabels:
tier: airflow
diff --git a/chart/templates/pgbouncer/pgbouncer-deployment.yaml b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
index fffbb99e77..fb8c784842 100644
--- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
@@ -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:
@@ -38,6 +39,9 @@ metadata:
{{- end }}
spec:
replicas: 1
+ {{- if $revisionHistoryLimit }}
+ revisionHistoryLimit: {{ $revisionHistoryLimit }}
+ {{- end }}
strategy:
rollingUpdate:
maxSurge: 1
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml
index 1b47af5fec..8aaa24e203 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -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 }}
@@ -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 }}
diff --git a/chart/templates/statsd/statsd-deployment.yaml b/chart/templates/statsd/statsd-deployment.yaml
index 9c2036b721..7d83099feb 100644
--- a/chart/templates/statsd/statsd-deployment.yaml
+++ b/chart/templates/statsd/statsd-deployment.yaml
@@ -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
@@ -39,6 +40,9 @@ metadata:
{{- end }}
spec:
replicas: 1
+ {{- if $revisionHistoryLimit }}
+ revisionHistoryLimit: {{ $revisionHistoryLimit }}
+ {{- end }}
selector:
matchLabels:
tier: airflow
diff --git a/chart/templates/triggerer/triggerer-deployment.yaml b/chart/templates/triggerer/triggerer-deployment.yaml
index b6ad5dca1d..7842e76de8 100644
--- a/chart/templates/triggerer/triggerer-deployment.yaml
+++ b/chart/templates/triggerer/triggerer-deployment.yaml
@@ -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
@@ -40,6 +41,9 @@ metadata:
{{- end }}
spec:
replicas: {{ .Values.triggerer.replicas }}
+ {{- if $revisionHistoryLimit }}
+ revisionHistoryLimit: {{ $revisionHistoryLimit }}
+ {{- end }}
selector:
matchLabels:
tier: airflow
diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml
index c8d8e6ad15..9487df1a40 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -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
@@ -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 }}
diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index a1f51de0f5..501ca380e7 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -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
@@ -43,6 +44,9 @@ spec:
serviceName: {{ .Release.Name }}-worker
{{- end }}
replicas: {{ .Values.workers.replicas }}
+ {{- if $revisionHistoryLimit }}
+ revisionHistoryLimit: {{ $revisionHistoryLimit }}
+ {{- end }}
selector:
matchLabels:
tier: airflow
diff --git a/chart/values.schema.json b/chart/values.schema.json
index ffc008e67b..b24e8fcf0c 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -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",
@@ -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": [
@@ -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": [
@@ -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": [
@@ -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": [
@@ -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": [
@@ -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": [
@@ -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",
@@ -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": [
diff --git a/chart/values.yaml b/chart/values.yaml
index 934448cd4c..f795e0f02a 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -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
@@ -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: ~
@@ -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: ~
@@ -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: ~
@@ -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: ~
@@ -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: ~
@@ -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: ~
@@ -1257,6 +1272,8 @@ flower:
# StatsD settings
statsd:
enabled: true
+ # Max number of old replicasets to retain
+ revisionHistoryLimit: ~
# Create ServiceAccount
serviceAccount:
@@ -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).
diff --git a/tests/charts/test_dag_processor.py b/tests/charts/test_dag_processor.py
index fa0c83d9e3..11367aa6e0 100644
--- a/tests/charts/test_dag_processor.py
+++ b/tests/charts/test_dag_processor.py
@@ -372,6 +372,24 @@ class DagProcessorTest(unittest.TestCase):
"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),
diff --git a/tests/charts/test_flower.py b/tests/charts/test_flower.py
index 434a32cdaa..52f99f1121 100644
--- a/tests/charts/test_flower.py
+++ b/tests/charts/test_flower.py
@@ -17,6 +17,7 @@
import jmespath
import pytest
+from parameterized import parameterized
from tests.charts.helm_template_generator import render_chart
@@ -44,6 +45,24 @@ class TestFlowerDeployment:
assert "RELEASE-NAME-flower" == jmespath.search("metadata.name", docs[0])
assert "flower" == jmespath.search("spec.template.spec.containers[0].name", 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 = {
+ "flower": {
+ "enabled": True,
+ }
+ }
+ if revision_history_limit:
+ values['flower']['revisionHistoryLimit'] = revision_history_limit
+ if global_revision_history_limit:
+ values['revisionHistoryLimit'] = global_revision_history_limit
+ docs = render_chart(
+ values=values,
+ show_only=["templates/flower/flower-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
+
@pytest.mark.parametrize(
"airflow_version, expected_arg",
[
diff --git a/tests/charts/test_pgbouncer.py b/tests/charts/test_pgbouncer.py
index c0dee4ea59..8783b509b0 100644
--- a/tests/charts/test_pgbouncer.py
+++ b/tests/charts/test_pgbouncer.py
@@ -96,6 +96,24 @@ class PgbouncerTest(unittest.TestCase):
"foo": "bar",
} == jmespath.search("metadata.annotations", 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 = {
+ "pgbouncer": {
+ "enabled": True,
+ }
+ }
+ if revision_history_limit:
+ values['pgbouncer']['revisionHistoryLimit'] = revision_history_limit
+ if global_revision_history_limit:
+ values['revisionHistoryLimit'] = global_revision_history_limit
+ docs = render_chart(
+ values=values,
+ show_only=["templates/pgbouncer/pgbouncer-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
+
def test_should_create_valid_affinity_tolerations_and_node_selector(self):
docs = render_chart(
values={
diff --git a/tests/charts/test_scheduler.py b/tests/charts/test_scheduler.py
index b163bea3e3..c6cc17381f 100644
--- a/tests/charts/test_scheduler.py
+++ b/tests/charts/test_scheduler.py
@@ -115,6 +115,20 @@ class SchedulerTest(unittest.TestCase):
"spec.template.spec.containers[0].volumeMounts[*].name", 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 = {"scheduler": {}}
+ if revision_history_limit:
+ values['scheduler']['revisionHistoryLimit'] = revision_history_limit
+ if global_revision_history_limit:
+ values['revisionHistoryLimit'] = global_revision_history_limit
+ docs = render_chart(
+ values=values,
+ show_only=["templates/scheduler/scheduler-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
+
def test_should_create_valid_affinity_tolerations_and_node_selector(self):
docs = render_chart(
values={
diff --git a/tests/charts/test_statsd.py b/tests/charts/test_statsd.py
index d6c9efb7dc..725340a3cf 100644
--- a/tests/charts/test_statsd.py
+++ b/tests/charts/test_statsd.py
@@ -18,6 +18,7 @@
import unittest
import jmespath
+from parameterized import parameterized
from tests.charts.helm_template_generator import render_chart
@@ -51,6 +52,20 @@ class StatsdTest(unittest.TestCase):
"subPath": "mappings.yml",
} in jmespath.search("spec.template.spec.containers[0].volumeMounts", 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 = {"statsd": {"enabled": True}}
+ if revision_history_limit:
+ values['statsd']['revisionHistoryLimit'] = revision_history_limit
+ if global_revision_history_limit:
+ values['revisionHistoryLimit'] = global_revision_history_limit
+ docs = render_chart(
+ values=values,
+ show_only=["templates/statsd/statsd-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
+
def test_should_create_valid_affinity_tolerations_and_node_selector(self):
docs = render_chart(
values={
diff --git a/tests/charts/test_triggerer.py b/tests/charts/test_triggerer.py
index 0cc18c7687..0436a861e2 100644
--- a/tests/charts/test_triggerer.py
+++ b/tests/charts/test_triggerer.py
@@ -51,6 +51,24 @@ class TriggererTest(unittest.TestCase):
assert 0 == len(docs)
+ @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 = {
+ "triggerer": {
+ "enabled": True,
+ }
+ }
+ if revision_history_limit:
+ values['triggerer']['revisionHistoryLimit'] = revision_history_limit
+ if global_revision_history_limit:
+ values['revisionHistoryLimit'] = global_revision_history_limit
+ docs = render_chart(
+ values=values,
+ show_only=["templates/triggerer/triggerer-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
+
def test_disable_wait_for_migration(self):
docs = render_chart(
values={
diff --git a/tests/charts/test_webserver.py b/tests/charts/test_webserver.py
index b15a50d181..0664fa2e43 100644
--- a/tests/charts/test_webserver.py
+++ b/tests/charts/test_webserver.py
@@ -60,6 +60,20 @@ class WebserverDeploymentTest(unittest.TestCase):
== "/mypath/path/health"
)
+ @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 = {"webserver": {}}
+ if revision_history_limit:
+ values['webserver']['revisionHistoryLimit'] = revision_history_limit
+ if global_revision_history_limit:
+ values['revisionHistoryLimit'] = global_revision_history_limit
+ docs = render_chart(
+ values=values,
+ show_only=["templates/webserver/webserver-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(
[
({"config": {"webserver": {"base_url": ""}}},),
diff --git a/tests/charts/test_worker.py b/tests/charts/test_worker.py
index 017429bfed..3f3a2572e2 100644
--- a/tests/charts/test_worker.py
+++ b/tests/charts/test_worker.py
@@ -46,6 +46,20 @@ class WorkerTest(unittest.TestCase):
assert kind == jmespath.search("kind", 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 = {"workers": {}}
+ if revision_history_limit:
+ values['workers']['revisionHistoryLimit'] = revision_history_limit
+ if global_revision_history_limit:
+ values['revisionHistoryLimit'] = global_revision_history_limit
+ docs = render_chart(
+ values=values,
+ show_only=["templates/workers/worker-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
+
def test_should_add_extra_containers(self):
docs = render_chart(
values={