fix(common): Release common-4.0.1 (#415)

This commit is contained in:
Bernd Schorgers 2025-05-16 12:40:44 +02:00 committed by GitHub
parent a01a89cb13
commit 9a478444a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 163 additions and 15 deletions

View file

@ -60,6 +60,30 @@ tests:
port: 8080
weight: 1
- it: automatic service and port reference should pass
values:
- ../_values/service_main_default.yaml
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs: [{}]
documentSelector:
path: $[?(@.kind == "HTTPRoute")].metadata.name
value: release-name
asserts:
- equal:
path: spec.rules[0].backendRefs[0]
value:
group: ""
kind: Service
name: release-name
namespace: NAMESPACE
port: 8081
weight: 1
- it: custom service reference should pass
set:
route.main:

View file

@ -41,3 +41,40 @@ tests:
asserts:
- failedTemplate:
errorMessage: "backend refs and request redirect filters cannot co-exist."
- it: automatic service determination should fail when no service is enabled
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- port: 8080
asserts:
- failedTemplate:
errorMessage: "Either name or identifier is required because automatic Service detection is not possible. (route: main)"
- it: automatic service determination should fail when >1 service is enabled
set:
service:
main:
controller: main
ports:
ui:
port: 8082
second:
controller: main
ports:
ui:
port: 8082
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- port: 8080
asserts:
- failedTemplate:
errorMessage: "Either name or identifier is required because automatic Service detection is not possible. (route: main)"

View file

@ -0,0 +1,54 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service - fields - selector
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
- ../_values/service_main_default.yaml
tests:
- it: selector is configured by default
documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: release-name
asserts:
- equal:
path: spec.selector
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
- it: additional selector labels can be configured
set:
service:
main:
extraSelectorLabels:
extraLabel: extraValue
documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: release-name
asserts:
- equal:
path: spec.selector
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
extraLabel: extraValue
- it: selector can determine default controller automatically
set:
service:
main:
controller: ""
documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: release-name
asserts:
- equal:
path: spec.selector
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME

View file

@ -42,7 +42,6 @@ tests:
- failedTemplate:
errorMessage: "controller field is required because automatic controller detection is not possible. (service: main)"
- it: no ports enabled should fail
values:
- ../_values/service_main_default.yaml