Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

KubernetesIngressResource

Handle
📦 Aspire.Hosting.Kubernetes v13.6.5-preview.1.26559.7

Represents a Kubernetes Ingress as a first-class resource in the Aspire application model. An Ingress defines HTTP routing rules that direct external traffic to services in the cluster.

type KubernetesIngressResource interface {
Resource
ResourceWithParent
}

Methods

methodWithDefaultBackendbuilder
Sets the default backend for the ingress. The default backend handles requests that do not match any of the defined routing rules.
WithDefaultBackend(endpoint EndpointReference) KubernetesIngressResource
endpointEndpointReferenceThe endpoint reference identifying the default backend service and port.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithHostnamebuilder
Adds a hostname that this ingress matches. Multiple hostnames can be added by calling this method repeatedly. Path rules without an explicit host apply to each configured hostname. If no hostnames are configured, those rules match all hosts.
WithHostname(hostname string) KubernetesIngressResource
hostnamestringThe hostname to match (e.g., "api.example.com").
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

Adds a Kubernetes metadata annotation to the generated Ingress resource. These are key-value pairs in the metadata.annotations field of the K8S Ingress, commonly used to configure ingress controller-specific behavior.
WithIngressAnnotation(
key string,
value string,
) KubernetesIngressResource
keystringThe annotation key (e.g., "nginx.ingress.kubernetes.io/rewrite-target").
valuestringThe annotation value.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

Adds a Kubernetes metadata annotation with a parameter value that will be resolved at deploy time.
WithIngressAnnotationParam(
key string,
value ParameterResource,
) KubernetesIngressResource
keystringThe annotation key.
valueParameterResourceA parameter resource builder for the annotation value.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithIngressClassbuilder
Sets the Kubernetes ingress class name that selects which ingress controller handles this ingress resource.
WithIngressClass(className string) KubernetesIngressResource
classNamestringThe ingress class name (e.g., "nginx", "traefik", "azure-alb-external").
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

Sets the Kubernetes ingress class name using a parameter that will be resolved at deploy time.
WithIngressClassParam(className ParameterResource) KubernetesIngressResource
classNameParameterResourceA parameter resource builder for the ingress class name.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

Adds a host-scoped path rule to the ingress. The rule matches traffic for the specified host and path, forwarding it to the given endpoint's backing Kubernetes service.
WithIngressHostAndPath(
host string,
path string,
endpoint EndpointReference,
options ...*WithIngressHostAndPathOptions,
) KubernetesIngressResource
hoststringThe hostname to match (e.g., "api.example.com").
pathstringThe URL path to match (e.g., "/" or "/api"). Must start with /.
endpointEndpointReferenceThe endpoint reference identifying the target service and port.
options...*WithIngressHostAndPathOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithIngressHostAndPathOptions argument.

PathType*IngressPathTypeThe path matching strategy. Defaults to Prefix.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

Adds a hostname using a parameter that will be resolved at deploy time.
WithIngressHostnameParam(hostname ParameterResource) KubernetesIngressResource
hostnameParameterResourceA parameter resource builder for the hostname value.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithIngressPathbuilder
Adds a path-based rule to the ingress. The rule matches each hostname configured with WithHostname, or all hosts when no hostname is configured, and forwards matching traffic to the endpoint's backing Kubernetes service.
WithIngressPath(
path string,
endpoint EndpointReference,
options ...*WithIngressPathOptions,
) KubernetesIngressResource
pathstringThe URL path to match (e.g., "/" or "/api"). Must start with /.
endpointEndpointReferenceThe endpoint reference identifying the target service and port.
options...*WithIngressPathOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithIngressPathOptions argument.

PathType*IngressPathTypeThe path matching strategy. Defaults to Prefix.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithIngressTlsAutobuilder
Configures TLS termination with an auto-generated secret name derived from the ingress name.
WithIngressTlsAuto() KubernetesIngressResource
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithIngressTlsParambuilder
Configures TLS termination using a parameter for the secret name.
WithIngressTlsParam(secretName ParameterResource) KubernetesIngressResource
secretNameParameterResourceA parameter resource builder for the secret name.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithTlsbuilder
Configures TLS for a Kubernetes Ingress using a K8S secret
WithTls(secretName string) KubernetesIngressResource
secretNamestringThe name of the Kubernetes kubernetes.io/tls Secret.
KubernetesIngressResource

The resource builder.

Returns a handle; failures surface later via Err().