test(httproute): add comprehensive unit tests and deployment notes
Add helm-unittest test suite for HTTPRoute (Gateway API) covering: - Not created by default (enabled: false) - Created when enabled with required configuration - Annotations support - parentRefs configuration (name, namespace, sectionName) - Hostnames support (single and multiple) - Path matching rules (PathPrefix, Exact) - Multiple rules and multiple matches per rule - Backend references to Jellyfin service - Custom service port handling Add NOTES.txt with HTTPRoute-specific deployment information: - Gateway references and configuration status - Configured hostnames - Number of routes - Backend service details - Access URLs when hostnames configured - Warnings for missing parentRefs Tests ensure HTTPRoute works correctly across all Gateway API scenarios. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
1 parent
f1ae87fba9
commit
77241b18b5
2 files changed
+246
No files matched your search
@@ -0,0 +1,53 @@
|
|||||||
|
Thank you for installing {{ .Chart.Name }}.
|
||||||
|
|
||||||
|
Your release is named {{ .Release.Name }}.
|
||||||
|
|
||||||
|
To learn more about the release, try:
|
||||||
|
|
||||||
|
$ helm status {{ .Release.Name }}
|
||||||
|
$ helm get all {{ .Release.Name }}
|
||||||
|
|
||||||
|
{{- if .Values.httpRoute.enabled }}
|
||||||
|
|
||||||
|
HTTPRoute (Gateway API) is ENABLED:
|
||||||
|
{{- if .Values.httpRoute.parentRefs }}
|
||||||
|
Gateway References:
|
||||||
|
{{- range .Values.httpRoute.parentRefs }}
|
||||||
|
- {{ .name }}{{ if .namespace }} (namespace: {{ .namespace }}){{ end }}{{ if .sectionName }} [{{ .sectionName }}]{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
⚠ WARNING: No parentRefs defined - HTTPRoute will not attach to any Gateway!
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.httpRoute.hostnames }}
|
||||||
|
Hostnames:
|
||||||
|
{{- range .Values.httpRoute.hostnames }}
|
||||||
|
- {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
Rules: {{ len .Values.httpRoute.rules }} route(s) configured
|
||||||
|
Backend: {{ include "jellyfin.fullname" . }}:{{ .Values.service.port }}
|
||||||
|
|
||||||
|
Access Jellyfin via Gateway API at:
|
||||||
|
{{- if .Values.httpRoute.hostnames }}
|
||||||
|
{{- range .Values.httpRoute.hostnames }}
|
||||||
|
https://{{ . }}{{ (index $.Values.httpRoute.rules 0).matches 0 .path.value }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
(Configure httpRoute.hostnames for external access)
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
Note: Ensure your Gateway API CRDs are installed and Gateway is configured.
|
||||||
|
{{- else if .Values.ingress.enabled }}
|
||||||
|
|
||||||
|
Jellyfin is available via Ingress at:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .host }}{{ (index .paths 0).path }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
|
||||||
|
To access Jellyfin, you can use port-forwarding:
|
||||||
|
|
||||||
|
$ kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "jellyfin.fullname" . }} {{ .Values.service.port }}:{{ .Values.service.port }}
|
||||||
|
|
||||||
|
Then visit http://localhost:{{ .Values.service.port }} in your browser.
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
suite: test httproute
|
||||||
|
templates:
|
||||||
|
- httproute.yaml
|
||||||
|
tests:
|
||||||
|
- it: should not create HTTPRoute by default
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|
||||||
|
- it: should create HTTPRoute when enabled
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
namespace: gateway-system
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: HTTPRoute
|
||||||
|
- isAPIVersion:
|
||||||
|
of: gateway.networking.k8s.io/v1
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME-jellyfin
|
||||||
|
|
||||||
|
- it: should add annotations when specified
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
httpRoute.annotations:
|
||||||
|
my-annotation: my-value
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: metadata.annotations.my-annotation
|
||||||
|
value: my-value
|
||||||
|
|
||||||
|
- it: should set parentRefs correctly
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
namespace: gateway-system
|
||||||
|
sectionName: https
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.parentRefs[0].name
|
||||||
|
value: my-gateway
|
||||||
|
- equal:
|
||||||
|
path: spec.parentRefs[0].namespace
|
||||||
|
value: gateway-system
|
||||||
|
- equal:
|
||||||
|
path: spec.parentRefs[0].sectionName
|
||||||
|
value: https
|
||||||
|
|
||||||
|
- it: should set hostnames when specified
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
httpRoute.hostnames:
|
||||||
|
- jellyfin.example.com
|
||||||
|
- media.example.com
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.hostnames[0]
|
||||||
|
value: jellyfin.example.com
|
||||||
|
- equal:
|
||||||
|
path: spec.hostnames[1]
|
||||||
|
value: media.example.com
|
||||||
|
|
||||||
|
- it: should create rules with path matches
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /jellyfin
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].matches[0].path.type
|
||||||
|
value: PathPrefix
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].matches[0].path.value
|
||||||
|
value: /jellyfin
|
||||||
|
|
||||||
|
- it: should set backendRefs to jellyfin service
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
service.port: 8096
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].backendRefs[0].name
|
||||||
|
value: RELEASE-NAME-jellyfin
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].backendRefs[0].port
|
||||||
|
value: 8096
|
||||||
|
|
||||||
|
- it: should support multiple rules
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: Exact
|
||||||
|
value: /api
|
||||||
|
asserts:
|
||||||
|
- lengthEqual:
|
||||||
|
path: spec.rules
|
||||||
|
count: 2
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].matches[0].path.value
|
||||||
|
value: /
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[1].matches[0].path.value
|
||||||
|
value: /api
|
||||||
|
|
||||||
|
- it: should support multiple matches in single rule
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /api
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /web
|
||||||
|
asserts:
|
||||||
|
- lengthEqual:
|
||||||
|
path: spec.rules[0].matches
|
||||||
|
count: 2
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].matches[0].path.value
|
||||||
|
value: /api
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].matches[1].path.value
|
||||||
|
value: /web
|
||||||
|
|
||||||
|
- it: should use custom service port
|
||||||
|
set:
|
||||||
|
httpRoute.enabled: true
|
||||||
|
service.port: 9000
|
||||||
|
httpRoute.parentRefs:
|
||||||
|
- name: my-gateway
|
||||||
|
httpRoute.rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.rules[0].backendRefs[0].port
|
||||||
|
value: 9000
|
||||||
Reference in new issue
Block a user