KubernetesIngressExtensions
Classstaticnet10.0
Provides extension methods for configuring Kubernetes Ingress resources in the Aspire application model.
namespace Aspire.Hosting;
public static class KubernetesIngressExtensions{ // ...}13 members
Methods13
Section titled MethodsIResourceBuilder<KubernetesIngressResource> Adds a Kubernetes Ingress resource to the application model as a child of the specified Kubernetes environment. The ingress generates a
networking.k8s.io/v1 Ingress resource in the Helm chart output at publish time. WithDefaultBackend(IResourceBuilder<KubernetesIngressResource>, EndpointReference)extensionats exportIResourceBuilder<KubernetesIngressResource> Sets the default backend for the ingress. The default backend handles requests that do not match any of the defined routing rules.
IResourceBuilder<KubernetesIngressResource> 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(IResourceBuilder<KubernetesIngressResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<KubernetesIngressResource> Adds a hostname using a parameter that will be resolved at deploy time.
WithIngressAnnotation(IResourceBuilder<KubernetesIngressResource>, string, string)extensionats exportIResourceBuilder<KubernetesIngressResource> 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(IResourceBuilder<KubernetesIngressResource>, string, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<KubernetesIngressResource> Adds a Kubernetes metadata annotation with a parameter value that will be resolved at deploy time.
IResourceBuilder<KubernetesIngressResource> Sets the Kubernetes ingress class name that selects which ingress controller handles this ingress resource.
WithIngressClass(IResourceBuilder<KubernetesIngressResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<KubernetesIngressResource> Sets the Kubernetes ingress class name using a parameter that will be resolved at deploy time.
WithPath(IResourceBuilder<KubernetesIngressResource>, string, EndpointReference, IngressPathType)extensionats exportIResourceBuilder<KubernetesIngressResource> Adds a path-based rule to the ingress. The rule matches each hostname configured with
KubernetesIngressExtensions.WithHostname, or all hosts when no hostname is configured, and forwards matching traffic to the endpoint's backing Kubernetes service. WithPath(IResourceBuilder<KubernetesIngressResource>, string, string, EndpointReference, IngressPathType)extensionats exportIResourceBuilder<KubernetesIngressResource> 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.
IResourceBuilder<KubernetesIngressResource> Configures TLS termination for the ingress by referencing a Kubernetes TLS secret. The TLS configuration applies to all hostnames configured via
KubernetesIngressExtensions.WithHostname. WithTls(IResourceBuilder<KubernetesIngressResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<KubernetesIngressResource> Configures TLS termination using a parameter for the secret name.
IResourceBuilder<KubernetesIngressResource> Configures TLS termination with an auto-generated secret name derived from the ingress name.