From f984b5fa65afcf4d76dfd77525237e841d13d352 Mon Sep 17 00:00:00 2001 From: Ben Banfield-Zanin Date: Wed, 7 Jan 2026 15:50:04 +0000 Subject: [PATCH] Remove one-by-one functionality, nothing uses it anymore --- .../matrix-stack/templates/ess-library/_workloads.tpl | 11 +++-------- tests/manifests/__init__.py | 1 - tests/manifests/test_pod_replicas.py | 11 +++-------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/charts/matrix-stack/templates/ess-library/_workloads.tpl b/charts/matrix-stack/templates/ess-library/_workloads.tpl index d47781ec..d0bba746 100644 --- a/charts/matrix-stack/templates/ess-library/_workloads.tpl +++ b/charts/matrix-stack/templates/ess-library/_workloads.tpl @@ -11,7 +11,6 @@ SPDX-License-Identifier: AGPL-3.0-only {{- with required "element-io.ess-library.workloads.commonSpec missing context" .context -}} {{- $nameSuffix := required "element-io.ess-library.workloads.commonSpec missing context.nameSuffix" .nameSuffix -}} {{- $serviceNameSuffix := .serviceNameSuffix | default $nameSuffix -}} -{{- $maxSurge := ternary .maxSurge 2 (hasKey . "maxSurge") -}} {{- $kind := required "element-io.ess-library.workloads.commonSpec missing context.kind" .kind -}} {{- with required "element-io.ess-library.workloads.commonSpec missing context.componentValues" .componentValues -}} replicas: {{ .replicas | default 1 }} @@ -22,15 +21,11 @@ selector: strategy: type: RollingUpdate rollingUpdate: - maxSurge: {{ $maxSurge }} -{{- if gt $maxSurge 0 }} - {{- if hasKey . "replicas" }} + maxSurge: 2 +{{- if hasKey . "replicas" }} maxUnavailable: {{ min (max 0 (sub .replicas 1)) 1 }} - {{- else }} - maxUnavailable: 0 - {{- end }} {{- else }} - maxUnavailable: 1 + maxUnavailable: 0 {{- end }} {{- else }} serviceName: {{ $root.Release.Name }}-{{ $serviceNameSuffix }} diff --git a/tests/manifests/__init__.py b/tests/manifests/__init__.py index 782672a8..685170c9 100644 --- a/tests/manifests/__init__.py +++ b/tests/manifests/__init__.py @@ -105,7 +105,6 @@ class DeployableDetails(abc.ABC): has_automount_service_account_token: bool = field(default=False, hash=False) has_workloads: bool = field(default=True, hash=False) has_replicas: bool = field(default=None, hash=False) # type: ignore[assignment] - requires_one_by_one_rollout: bool = field(default=False, hash=False) has_service_monitor: bool = field(default=None, hash=False) # type: ignore[assignment] has_storage: bool = field(default=False, hash=False) makes_outbound_requests: bool = field(default=None, hash=False) # type: ignore[assignment] diff --git a/tests/manifests/test_pod_replicas.py b/tests/manifests/test_pod_replicas.py index de3c9af8..a355117b 100644 --- a/tests/manifests/test_pod_replicas.py +++ b/tests/manifests/test_pod_replicas.py @@ -1,5 +1,5 @@ # Copyright 2025 New Vector Ltd -# Copyright 2025 Element Creations Ltd +# Copyright 2025-2026 Element Creations Ltd # # SPDX-License-Identifier: AGPL-3.0-only @@ -32,7 +32,7 @@ async def test_deployments_statefulsets_have_replicas_by_default(values, templat if template["kind"] == "Deployment": max_unavailable = template["spec"]["strategy"]["rollingUpdate"]["maxUnavailable"] - if expected_replicas > 1 or deployable_details.requires_one_by_one_rollout: + if expected_replicas > 1: assert max_unavailable == 1, ( f"{template_id(template)} has {max_unavailable=} when it should be 1 with more than 1 replica" ) @@ -41,12 +41,7 @@ async def test_deployments_statefulsets_have_replicas_by_default(values, templat f"{template_id(template)} has {max_unavailable=} when it should be 0 with no replicas" ) max_surge = template["spec"]["strategy"]["rollingUpdate"]["maxSurge"] - if deployable_details.requires_one_by_one_rollout: - assert max_surge == 0, ( - f"{template_id(template)} has {max_surge=} when it should be 0 as it needs a one-by-one rollout" - ) - else: - assert max_surge == 2, f"{template_id(template)} has {max_surge=} when it should be 2" + assert max_surge == 2, f"{template_id(template)} has {max_surge=} when it should be 2" @pytest.mark.parametrize("values_file", values_files_to_test)