helm: add tests for admin API svc

This commit is contained in:
maximilien
2026-09-16 23:56:15 +02:00
parent be2ca9cab5
commit d768132286
5 changed files with 69 additions and 3 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
.PHONY: doc all run1 run2 run3
.PHONY: doc all run1 run2 run3 helmtest
all:
clear
@@ -20,3 +20,6 @@ run3:
RUST_LOG=garage=debug ./target/debug/garage -c tmp/config3.toml server
run3rel:
RUST_LOG=garage=debug ./target/release/garage -c tmp/config3.toml server
helmtest:
helm unittest --strict script/helm/garage
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v2
name: garage
description: S3-compatible object store for small self-hosted geo-distributed deployments
type: application
version: 0.10.2
version: 0.10.3
appVersion: "v2.4.1"
home: https://garagehq.deuxfleurs.fr/
icon: https://garagehq.deuxfleurs.fr/images/garage-logo.svg
+5 -1
View File
@@ -177,7 +177,11 @@ service:
port: 3900
web:
port: 3902
# NOTE: the admin API is excluded for now as it is not consistent across nodes
# -- The admin API is excluded by default as it is not consistent across nodes
admin:
enabled: true
annotations:
my-annotation: my-value
ingress:
s3:
@@ -6,6 +6,7 @@ suite: complex-values integration
templates:
- templates/workload.yaml
- templates/service.yaml
- templates/service-admin.yaml
- templates/service-headless.yaml
- templates/ingress.yaml
- templates/servicemonitor.yaml
@@ -54,6 +55,13 @@ tests:
- template: templates/service.yaml
hasDocuments:
count: 2 # main service + metrics service, since monitoring.metrics.enabled is true here
- template: templates/service-admin.yaml
hasDocuments:
count: 1 # service.admin.enabled is true here
- template: templates/service-admin.yaml
equal:
path: metadata.annotations["my-annotation"]
value: my-value
- template: templates/service-headless.yaml
hasDocuments:
count: 1 # StatefulSet still gets a headless service
@@ -0,0 +1,51 @@
suite: admin API service
templates:
- templates/service-admin.yaml
tests:
- it: does not create an admin API service by default
asserts:
- hasDocuments:
count: 0
- it: creates a ClusterIP admin API service when enabled
set:
service.admin.enabled: true
asserts:
- hasDocuments:
count: 1
- isKind:
of: Service
- equal:
path: metadata.name
value: RELEASE-NAME-garage-admin
- equal:
path: spec.type
value: ClusterIP
- equal:
path: spec.ports[0].name
value: admin
- equal:
path: spec.ports[0].port
value: 3903
- equal:
path: spec.ports[0].targetPort
value: 3903
- it: derives the admin API port from a custom apiBindAddr
set:
service.admin.enabled: true
garage.admin.apiBindAddr: "[::]:9999"
asserts:
- equal:
path: spec.ports[0].port
value: 9999
- it: adds custom annotations to the admin API service
set:
service.admin.enabled: true
service.admin.annotations:
my-annotation: my-value
asserts:
- equal:
path: metadata.annotations["my-annotation"]
value: my-value