Skip to content

Agent Mesh

charts: derive announced router port from service.port; optional PVC storageClass

Tomas Tormo54618a8fbbd2
diff --git a/charts/sam-mesh/templates/router-statefulset.yaml b/charts/sam-mesh/templates/router-statefulset.yaml
index 3a11b95a..b4c51f39 100644
--- a/charts/sam-mesh/templates/router-statefulset.yaml
+++ b/charts/sam-mesh/templates/router-statefulset.yaml
@@ -124,7 +124,7 @@ spec:
- "--external-addr=/ip4/$(HOST_IP)/tcp/{{ .Values.router.hostPort }}"
- "--external-addr=/ip4/$(HOST_IP)/udp/{{ .Values.router.hostPort }}/quic-v1"
{{- else }}
- - "--external-addr=/dns4/{{ include "sam-mesh.fullname" . }}-router/tcp/4501"
+ - "--external-addr=/dns4/{{ include "sam-mesh.fullname" . }}-router/tcp/{{ .Values.router.service.port }}"
{{- end }}
- "--keys-path=/data/router.key"
{{- if .Values.router.allowLoopback }}
@@ -159,6 +159,9 @@ spec:
name: router-data
spec:
accessModes: [ "ReadWriteOnce" ]
+ {{- if .Values.router.storageClass }}
+ storageClassName: {{ .Values.router.storageClass | quote }}
+ {{- end }}
resources:
requests:
storage: {{ .Values.router.storageSize | quote }}
diff --git a/charts/sam-mesh/tests/router-statefulset_test.yaml b/charts/sam-mesh/tests/router-statefulset_test.yaml
index eb54ee90..a29bc394 100644
--- a/charts/sam-mesh/tests/router-statefulset_test.yaml
+++ b/charts/sam-mesh/tests/router-statefulset_test.yaml
@@ -31,6 +31,17 @@ tests:
- notExists:
path: spec.template.spec.containers[0].ports[0].hostPort
+ - it: announced DNS address follows router.service.port
+ set:
+ router.service.port: 9999
+ documentSelector:
+ path: kind
+ value: StatefulSet
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].args
+ content: --external-addr=/dns4/sam-mesh-router/tcp/9999
+
- it: hostPort binds both protocols and announces the node IP
set:
router.hostPort: 4501
@@ -78,9 +89,22 @@ tests:
- equal:
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
value: 1Gi
+ - notExists:
+ path: spec.volumeClaimTemplates[0].spec.storageClassName
- notExists:
path: spec.template.spec.volumes
+ - it: storageClass sets the PVC storageClassName
+ set:
+ router.storageClass: fast-ssd
+ documentSelector:
+ path: kind
+ value: StatefulSet
+ asserts:
+ - equal:
+ path: spec.volumeClaimTemplates[0].spec.storageClassName
+ value: fast-ssd
+
- it: useOidcToken swaps the bootstrap token for a projected JWT
set:
router.useOidcToken: true
diff --git a/charts/sam-mesh/values.yaml b/charts/sam-mesh/values.yaml
index 75f11b5e..4ae7afc2 100644
--- a/charts/sam-mesh/values.yaml
+++ b/charts/sam-mesh/values.yaml
@@ -127,6 +127,8 @@ router:
allowLoopback: false
# PVC for /data/router.key, so the libp2p peer ID survives rescheduling.
storageSize: 1Gi
+ # PVC StorageClass; cluster default when null.
+ storageClass: null
resources:
requests:
cpu: 100m