KubernetesIngressExtensions
Class static net8.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 MethodsAddIngress(IResourceBuilder<KubernetesEnvironmentResource>, string)extensionats exportIResourceBuilder<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.
WithHostname(IResourceBuilder<KubernetesIngressResource>, string)extensionats exportIResourceBuilder<KubernetesIngressResource> Adds a hostname that this ingress matches. Multiple hostnames can be added by calling this method repeatedly. If no hostnames are configured, the ingress matches 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.
WithIngressClass(IResourceBuilder<KubernetesIngressResource>, string)extensionats exportIResourceBuilder<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.
WithRoute(IResourceBuilder<KubernetesIngressResource>, string, EndpointReference, IngressPathType)extensionats exportIResourceBuilder<KubernetesIngressResource> Adds a path-based routing rule to the ingress. The rule matches all hosts and routes traffic matching the specified path to the given endpoint's backing Kubernetes service.
WithRoute(IResourceBuilder<KubernetesIngressResource>, string, string, EndpointReference, IngressPathType)extensionats exportIResourceBuilder<KubernetesIngressResource> Adds a host-and-path-based routing rule to the ingress. The rule matches traffic for the specified host and path, routing it to the given endpoint's backing Kubernetes service.
WithTls(IResourceBuilder<KubernetesIngressResource>, string)extensionats exportIResourceBuilder<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.
WithTls(IResourceBuilder<KubernetesIngressResource>)extensionats exportIResourceBuilder<KubernetesIngressResource> Configures TLS termination with an auto-generated secret name derived from the ingress name.