Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@agrogov
Copy link

@agrogov agrogov commented Nov 9, 2025

What this PR does / why we need it:

Added full templating support for Ingress/annotations/TLS in the InferenceService controller:
users can now define annotationsTemplate and tlsTemplate in their InferenceServicesConfig
(or ConfigMap) using the fields {{ .Name }}, {{ .Namespace }}, and {{ .IngressDomain }}
to generate annotations, TLS hosts and TLS Secret name dynamically.

Type of changes

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Feature/Issue validation/testing:

  • TestNewIngressConfig|TestRenderStringTemplate_WithIngressDomain
$ go test ./pkg/apis/serving/v1beta1 -run 'TestNewIngressConfig|TestRenderStringTemplate_WithIngressDomain' -v
=== RUN   TestNewIngressConfig
=== RUN   TestNewIngressConfig/loads_annotationsTemplate_and_tlsTemplate_from_ingress_config
--- PASS: TestNewIngressConfig (0.00s)
    --- PASS: TestNewIngressConfig/loads_annotationsTemplate_and_tlsTemplate_from_ingress_config (0.00s)
=== RUN   TestRenderStringTemplate_WithIngressDomain
--- PASS: TestRenderStringTemplate_WithIngressDomain (0.00s)
=== RUN   TestNewIngressConfigDefaultKnativeService
--- PASS: TestNewIngressConfigDefaultKnativeService (0.00s)
=== RUN   TestNewIngressConfig_Validation
=== RUN   TestNewIngressConfig_Validation/returns_error_on_invalid_ingress_config_json
=== RUN   TestNewIngressConfig_Validation/returns_error_if_ingressGateway_is_missing
=== RUN   TestNewIngressConfig_Validation/returns_error_if_pathTemplate_is_invalid_template
=== RUN   TestNewIngressConfig_Validation/returns_error_if_pathTemplate_is_set_but_ingressDomain_is_missing
=== RUN   TestNewIngressConfig_Validation/returns_error_if_EnableGatewayAPI_is_true_and_kserveIngressGateway_is_missing
=== RUN   TestNewIngressConfig_Validation/returns_error_if_EnableGatewayAPI_is_true_and_kserveIngressGateway_is_invalid
=== RUN   TestNewIngressConfig_Validation/returns_config_with_defaults_when_config_map_is_empty
=== RUN   TestNewIngressConfig_Validation/sets_KnativeLocalGatewayService_from_LocalGatewayServiceName_if_missing
=== RUN   TestNewIngressConfig_Validation/returns_error_if_pathTemplate_is_valid_but_ingressDomain_is_empty
=== RUN   TestNewIngressConfig_Validation/returns_config_when_all_required_fields_are_present
--- PASS: TestNewIngressConfig_Validation (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_error_on_invalid_ingress_config_json (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_error_if_ingressGateway_is_missing (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_error_if_pathTemplate_is_invalid_template (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_error_if_pathTemplate_is_set_but_ingressDomain_is_missing (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_error_if_EnableGatewayAPI_is_true_and_kserveIngressGateway_is_missing (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_error_if_EnableGatewayAPI_is_true_and_kserveIngressGateway_is_invalid (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_config_with_defaults_when_config_map_is_empty (0.00s)
    --- PASS: TestNewIngressConfig_Validation/sets_KnativeLocalGatewayService_from_LocalGatewayServiceName_if_missing (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_error_if_pathTemplate_is_valid_but_ingressDomain_is_empty (0.00s)
    --- PASS: TestNewIngressConfig_Validation/returns_config_when_all_required_fields_are_present (0.00s)
PASS
ok      github.com/kserve/kserve/pkg/apis/serving/v1beta1       0.049s
  • TestCreateRawIngress
$ go test ./pkg/controller/v1beta1/inferenceservice/reconcilers/ingress -v -run 'TestCreateRawIngress'
=== RUN   TestCreateRawIngress_Templates_Rendered
--- PASS: TestCreateRawIngress_Templates_Rendered (0.00s)
=== RUN   TestCreateRawIngress_Templates_Malformed_Skips
--- PASS: TestCreateRawIngress_Templates_Malformed_Skips (0.00s)
=== RUN   TestCreateRawIngress_NoTemplates_NoTLS_NoExtraAnno
--- PASS: TestCreateRawIngress_NoTemplates_NoTLS_NoExtraAnno (0.00s)
=== RUN   TestCreateRawIngress_DoesNotChangeClassName
--- PASS: TestCreateRawIngress_DoesNotChangeClassName (0.00s)
PASS
ok      github.com/kserve/kserve/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress    0.052s

Special notes for your reviewer:

NONE

Checklist:

  • Have you added unit/e2e tests that prove your fix is effective or that this feature works?
  • Has code been commented, particularly in hard-to-understand areas?
  • Have you made corresponding changes to the documentation?

Release note:

Added full templating support for Ingress/annotations/TLS in the InferenceService controller: 
users can now define annotationsTemplate and tlsTemplate in their InferenceServicesConfig 
(or ConfigMap) using the fields {{ .Name }}, {{ .Namespace }}, and {{ .IngressDomain }} 
to generate annotations, TLS hosts and TLS Secret name dynamically.

## User-visible additions
IngressConfig schema now supports:
- annotationsTemplate (map of annotation keys -> string templates)
- tlsTemplate (array of objects: { hosts: [string templates], secretName: string template })
Template render context now includes:
- Name (InferenceService name)
- Namespace (InferenceService namespace)
- IngressDomain (configured ingressDomain from ConfigMap)
- Labels, Annotations (optional)

agrogov and others added 10 commits November 9, 2025 18:42
Signed-off-by: Alexey Rogov <[email protected]>
Signed-off-by: Alexey Rogov <[email protected]>
Signed-off-by: Murat Aslan <[email protected]>
Co-authored-by: Sivanantham <[email protected]>
Signed-off-by: Alexey Rogov <[email protected]>
Signed-off-by: Spolti <[email protected]>
Co-authored-by: Sivanantham <[email protected]>
Signed-off-by: Alexey Rogov <[email protected]>
Signed-off-by: Brett Thompson <[email protected]>
Co-authored-by: Jooho Lee <[email protected]>
Signed-off-by: Alexey Rogov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants