Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
chart: PodDisruptionBudgets for the control plane and router
Anpoo Sivanadi9bd3294472c9
diff --git a/charts/agentmesh/README.md b/charts/agentmesh/README.mdindex 67a6011c..dd345162 100644--- a/charts/agentmesh/README.md+++ b/charts/agentmesh/README.md@@ -130,6 +130,16 @@ There is no bundled Dex. Point `controlPlane.oidcIssuer` at your identityprovider and register `https://<control-plane-hostname><consolePath>/auth/callback` asa 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.+## Metrics (`monitoring.*`)The control plane serves Prometheus metrics on its `http` port and the routerdiff --git a/charts/agentmesh/templates/control-plane-pdb.yaml b/charts/agentmesh/templates/control-plane-pdb.yamlnew file mode 100644index 00000000..cf8a5312--- /dev/null+++ b/charts/agentmesh/templates/control-plane-pdb.yaml@@ -0,0 +1,18 @@+{{- $pdb := .Values.controlPlane.podDisruptionBudget -}}+{{- if and $pdb.enabled (gt (int .Values.controlPlane.replicaCount) 1) -}}+apiVersion: policy/v1+kind: PodDisruptionBudget+metadata:+ name: {{ include "agentmesh.fullname" . }}-control-plane+ 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" . }}-control-plane+{{- end }}diff --git a/charts/agentmesh/templates/router-pdb.yaml b/charts/agentmesh/templates/router-pdb.yamlnew file mode 100644index 00000000..d1ffb943--- /dev/null+++ b/charts/agentmesh/templates/router-pdb.yaml@@ -0,0 +1,18 @@+{{- $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.yamlnew file mode 100644index 00000000..b407132d--- /dev/null+++ b/charts/agentmesh/tests/pdb_test.yaml@@ -0,0 +1,80 @@+suite: pod disruption budgets+templates:+ - templates/control-plane-pdb.yaml+ - templates/router-pdb.yaml+release:+ # collapses fullname to "agentmesh" (see _helpers.tpl)+ name: agentmesh+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+ - isKind:+ of: PodDisruptionBudget+ - equal:+ path: spec.maxUnavailable+ value: 1+ - notExists:+ path: spec.minAvailable+ - 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+ 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: 0diff --git a/charts/agentmesh/values.yaml b/charts/agentmesh/values.yamlindex 7e158efc..e60fba15 100644--- a/charts/agentmesh/values.yaml+++ b/charts/agentmesh/values.yaml@@ -71,6 +71,13 @@ controlPlane:service:type: ClusterIPport: 8080+ # 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: nullnodePort: nulldatabase:@@ -164,6 +171,13 @@ router:service:type: ClusterIPport: 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: nullconsole:enabled: true