KubernetesGatewayResource
Represents a Kubernetes Gateway API Gateway as a first-class resource in the Aspire application model. A Gateway defines listeners (ports, protocols, TLS) and HTTPRoutes attach to it for routing.
type KubernetesGatewayResource interface { Resource ResourceWithParent}Methods
WithGatewayAnnotation( key string, value string,) KubernetesGatewayResourceParameters
keystringThe annotation key.valuestringThe annotation value.Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithGatewayAnnotationParam( key string, value ParameterResource,) KubernetesGatewayResourceParameters
keystringThe annotation key.valueParameterResource A parameter resource builder for the annotation value.Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithGatewayClass(className string) KubernetesGatewayResourceParameters
className stringThe GatewayClass name (e.g., "azure-alb-external" , "istio").Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithGatewayClassParam(className ParameterResource) KubernetesGatewayResourceParameters
className ParameterResource A parameter resource builder for the GatewayClass name.Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithGatewayHostnameParam(hostname ParameterResource) KubernetesGatewayResourceParameters
hostnameParameterResource A parameter resource builder for the hostname value.Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
HTTPRoute resource with a hostnames filter.WithGatewayHostRoute( host string, path string, endpoint EndpointReference, options ...*WithGatewayHostRouteOptions,) KubernetesGatewayResourceParameters
hoststringThe hostname to match (e.g., "api.example.com" ).pathstringThe URL path to match. Must start with /.endpointEndpointReference The endpoint reference identifying the target service and port.options...*WithGatewayHostRouteOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithGatewayHostRouteOptions argument.
PathType *GatewayPathMatchType The path matching strategy. Defaults to PathPrefix .Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithHostname , or all hosts when no hostname is configured, and routes matching traffic to the endpoint's backing Kubernetes service. This generates an HTTPRoute resource attached to the Gateway.WithGatewayPathRoute( path string, endpoint EndpointReference, options ...*WithGatewayPathRouteOptions,) KubernetesGatewayResourceParameters
pathstringThe URL path to match (e.g., "/" or "/api"). Must start with /.endpointEndpointReference The endpoint reference identifying the target service and port.options...*WithGatewayPathRouteOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithGatewayPathRouteOptions argument.
PathType *GatewayPathMatchType The path matching strategy. Defaults to PathPrefix .Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithGatewayTlsAuto() KubernetesGatewayResourceReturns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
ClusterIssuer . This adds the cert-manager.io/cluster-issuer annotation to the generated Gateway resource, causing cert-manager to provision and renew a certificate for each gateway listener hostname.WithGatewayTlsIssuer(issuer CertManagerIssuerResource) KubernetesGatewayResourceParameters
issuerCertManagerIssuerResource The cert-manager ClusterIssuer to issue certificates from.Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithGatewayTlsParam(secretName ParameterResource) KubernetesGatewayResourceParameters
secretName ParameterResource A parameter resource builder for the secret name.Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
hostnames in generated HTTPRoute resources and as HTTPS listener hostnames when TLS is configured.WithHostname(hostname string) KubernetesGatewayResourceParameters
hostnamestringThe hostname to match (e.g., "api.example.com" ).Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().
WithTls(secretName string) KubernetesGatewayResourceParameters
secretName stringThe name of the Kubernetes kubernetes.io/tls Secret.Returns
KubernetesGatewayResource The resource builder.
Returns a handle; failures surface later via Err().