Skip to content

Agent Mesh

chart: keep only the control plane PDB, with no new values

Anpoo Sivanadiaf1180e1cbc9
diff --git a/charts/agentmesh/README.md b/charts/agentmesh/README.md
index dd345162..3fd0e346 100644
--- a/charts/agentmesh/README.md
+++ b/charts/agentmesh/README.md
@@ -130,15 +130,21 @@ There is no bundled Dex. Point `controlPlane.oidcIssuer` at your identity
provider and register `https://<control-plane-hostname><consolePath>/auth/callback` as
a redirect URI for the OIDC client the control plane reports.
-## Disruption budgets (`*.podDisruptionBudget`)
-
-The control plane and the router each get a `PodDisruptionBudget` with
-`maxUnavailable: 1`, so a node drain or autoscaler scale-down evicts one pod
-at a time instead of all of them. A budget renders only when its component
-runs more than one replica: the default install covers the control plane
-(2 replicas) and leaves a single router as it is. Set
-`podDisruptionBudget.minAvailable` to use that form instead, or
-`podDisruptionBudget.enabled: false` to render none.
+## Disruption budget
+
+When `controlPlane.replicaCount` is greater than 1 (the default is 2), the
+chart renders a `PodDisruptionBudget` with `maxUnavailable: 1` for the control
+plane, so a node drain or autoscaler scale-down evicts one control plane pod at
+a time instead of all of them. There is nothing to configure. On Kubernetes
+1.27 and later it also sets `unhealthyPodEvictionPolicy: AlwaysAllow`, so an
+unhealthy pod never blocks draining its node when the budget is spent.
+
+The bundled PostgreSQL StatefulSet runs a single replica and has no budget, so
+a drain can still take the database down. For full drain protection, use an
+external database.
+
+Routers get no budget. The mesh protocol handles their availability: a router
+that shuts down withdraws its lease and sends members to another router.
## Metrics (`monitoring.*`)
diff --git a/charts/agentmesh/templates/control-plane-pdb.yaml b/charts/agentmesh/templates/control-plane-pdb.yaml
index cf8a5312..673ed946 100644
--- a/charts/agentmesh/templates/control-plane-pdb.yaml
+++ b/charts/agentmesh/templates/control-plane-pdb.yaml
@@ -1,5 +1,7 @@
-{{- $pdb := .Values.controlPlane.podDisruptionBudget -}}
-{{- if and $pdb.enabled (gt (int .Values.controlPlane.replicaCount) 1) -}}
+{{- /*
+One replica gets no budget: maxUnavailable 1 would allow evicting it anyway.
+*/ -}}
+{{- if gt (int .Values.controlPlane.replicaCount) 1 -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
@@ -7,10 +9,10 @@ metadata:
labels:
{{- include "agentmesh.labels" . | nindent 4 }}
spec:
- {{- if not (kindIs "invalid" $pdb.minAvailable) }}
- minAvailable: {{ $pdb.minAvailable }}
- {{- else }}
- maxUnavailable: {{ $pdb.maxUnavailable }}
+ maxUnavailable: 1
+ {{- if semverCompare ">=1.27-0" .Capabilities.KubeVersion.Version }}
+ # An unhealthy pod never blocks draining its node, even with the budget spent.
+ unhealthyPodEvictionPolicy: AlwaysAllow
{{- end }}
selector:
matchLabels:
diff --git a/charts/agentmesh/templates/router-pdb.yaml b/charts/agentmesh/templates/router-pdb.yaml
deleted file mode 100644
index d1ffb943..00000000
--- a/charts/agentmesh/templates/router-pdb.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-{{- $pdb := .Values.router.podDisruptionBudget -}}
-{{- if and .Values.router.enabled $pdb.enabled (gt (int .Values.router.replicaCount) 1) -}}
-apiVersion: policy/v1
-kind: PodDisruptionBudget
-metadata:
- name: {{ include "agentmesh.fullname" . }}-router
- labels:
- {{- include "agentmesh.labels" . | nindent 4 }}
-spec:
- {{- if not (kindIs "invalid" $pdb.minAvailable) }}
- minAvailable: {{ $pdb.minAvailable }}
- {{- else }}
- maxUnavailable: {{ $pdb.maxUnavailable }}
- {{- end }}
- selector:
- matchLabels:
- app: {{ include "agentmesh.fullname" . }}-router
-{{- end }}
diff --git a/charts/agentmesh/tests/pdb_test.yaml b/charts/agentmesh/tests/pdb_test.yaml
index b407132d..95471d93 100644
--- a/charts/agentmesh/tests/pdb_test.yaml
+++ b/charts/agentmesh/tests/pdb_test.yaml
@@ -1,13 +1,14 @@
-suite: pod disruption budgets
+suite: control plane pod disruption budget
templates:
- templates/control-plane-pdb.yaml
- - templates/router-pdb.yaml
release:
# collapses fullname to "agentmesh" (see _helpers.tpl)
name: agentmesh
+capabilities:
+ majorVersion: 1
+ minorVersion: 30
tests:
- it: default values give the control plane a maxUnavailable 1 PDB on its pods
- template: templates/control-plane-pdb.yaml
asserts:
- hasDocuments:
count: 1
@@ -18,63 +19,26 @@ tests:
value: 1
- notExists:
path: spec.minAvailable
+ - equal:
+ path: spec.unhealthyPodEvictionPolicy
+ value: AlwaysAllow
- equal:
path: spec.selector.matchLabels.app
value: agentmesh-control-plane
- it: a single control plane replica gets no PDB
- template: templates/control-plane-pdb.yaml
set:
controlPlane.replicaCount: 1
asserts:
- hasDocuments:
count: 0
- - it: controlPlane.podDisruptionBudget.enabled false drops the PDB
- template: templates/control-plane-pdb.yaml
- set:
- controlPlane.podDisruptionBudget.enabled: false
- asserts:
- - hasDocuments:
- count: 0
-
- - it: minAvailable replaces maxUnavailable when set
- template: templates/control-plane-pdb.yaml
- set:
- controlPlane.replicaCount: 3
- controlPlane.podDisruptionBudget.minAvailable: 2
- asserts:
- - equal:
- path: spec.minAvailable
- value: 2
- - notExists:
- path: spec.maxUnavailable
-
- - it: the default single router gets no PDB
- template: templates/router-pdb.yaml
- asserts:
- - hasDocuments:
- count: 0
-
- - it: more than one router gets a maxUnavailable 1 PDB on its pods
- template: templates/router-pdb.yaml
- set:
- router.replicaCount: 3
+ - it: Kubernetes before 1.27 gets no unhealthyPodEvictionPolicy
+ capabilities:
+ majorVersion: 1
+ minorVersion: 26
asserts:
- hasDocuments:
count: 1
- - equal:
- path: spec.maxUnavailable
- value: 1
- - equal:
- path: spec.selector.matchLabels.app
- value: agentmesh-router
-
- - it: a disabled router gets no PDB
- template: templates/router-pdb.yaml
- set:
- router.enabled: false
- router.replicaCount: 3
- asserts:
- - hasDocuments:
- count: 0
+ - notExists:
+ path: spec.unhealthyPodEvictionPolicy
diff --git a/charts/agentmesh/values.yaml b/charts/agentmesh/values.yaml
index 47f31508..7e158efc 100644
--- a/charts/agentmesh/values.yaml
+++ b/charts/agentmesh/values.yaml
@@ -72,13 +72,6 @@ controlPlane:
type: ClusterIP
port: 8080
nodePort: null
- # Rendered only when replicaCount > 1: on one replica a PDB either does
- # nothing or blocks every drain. Set minAvailable to use that form instead
- # of maxUnavailable; a PDB takes one or the other, not both.
- podDisruptionBudget:
- enabled: true
- maxUnavailable: 1
- minAvailable: null
database:
type: postgres
@@ -171,13 +164,6 @@ router:
service:
type: ClusterIP
port: 4501
- # Rendered only when replicaCount > 1: on one replica a PDB either does
- # nothing or blocks every drain. Set minAvailable to use that form instead
- # of maxUnavailable; a PDB takes one or the other, not both.
- podDisruptionBudget:
- enabled: true
- maxUnavailable: 1
- minAvailable: null
console:
enabled: true