Remove one-by-one functionality, nothing uses it anymore

This commit is contained in:
Ben Banfield-Zanin committed 2026-01-13 16:47:30 +00:00
1 parent 49895d7e4a
commit f984b5fa65
3 files changed
+6 -17

No files matched your search

@@ -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 }}
-1
View File
@@ -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]
+3 -8
View File
@@ -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)