import { Construct } from 'constructs'; import { Resource, ResourceProps } from './base'; import { ApiObject } from 'cdk8s'; import { Service } from './service'; /** * (experimental) Properties for `Ingress`. * * @experimental */ export interface IngressProps extends ResourceProps { /** * (experimental) The default backend services requests that do not match any rule. * * Using this option or the `addDefaultBackend()` method is equivalent to * adding a rule with both `path` and `host` undefined. * * @experimental */ readonly defaultBackend?: IngressBackend; /** * (experimental) Routing rules for this ingress. * * Each rule must define an `IngressBackend` that will receive the requests * that match this rule. If both `host` and `path` are not specifiec, this * backend will be used as the default backend of the ingress. * * You can also add rules later using `addRule()`, `addHostRule()`, * `addDefaultBackend()` and `addHostDefaultBackend()`. * * @experimental */ readonly rules?: IngressRule[]; } /** * (experimental) Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. * * An Ingress can be configured to give services * externally-reachable urls, load balance traffic, terminate SSL, offer name * based virtual hosting etc. * * @experimental */ export declare class Ingress extends Resource { /** * (experimental) The underlying cdk8s API object. * * @see base.Resource.apiObject * @experimental */ protected readonly apiObject: ApiObject; private readonly _rulesPerHost; private _defaultBackend?; /** * @experimental */ constructor(scope: Construct, id: string, props?: IngressProps); /** * (experimental) Validate the current construct. * * This method can be implemented by derived constructs in order to perform * validation logic. It is called on all constructs before synthesis. * * @experimental */ protected onValidate(): string[]; /** * (experimental) Defines the default backend for this ingress. * * A default backend capable of * servicing requests that don't match any rule. * * @param backend The backend to use for requests that do not match any rule. * @experimental */ addDefaultBackend(backend: IngressBackend): void; /** * (experimental) Specify a default backend for a specific host name. * * This backend will be used as a catch-all for requests * targeted to this host name (the `Host` header matches this value). * * @param host The host name to match. * @param backend The backend to route to. * @experimental */ addHostDefaultBackend(host: string, backend: IngressBackend): void; /** * (experimental) Adds an ingress rule applied to requests to a specific host and a specific HTTP path (the `Host` header matches this value). * * @param host The host name. * @param path The HTTP path. * @param backend The backend to route requests to. * @experimental */ addHostRule(host: string, path: string, backend: IngressBackend): void; /** * (experimental) Adds an ingress rule applied to requests sent to a specific HTTP path. * * @param path The HTTP path. * @param backend The backend to route requests to. * @experimental */ addRule(path: string, backend: IngressBackend): void; /** * (experimental) Adds rules to this ingress. * * @param rules The rules to add. * @experimental */ addRules(...rules: IngressRule[]): void; private synthRules; } /** * (experimental) Options for setting up backends for ingress rules. * * @experimental */ export interface ServiceIngressBackendOptions { /** * (experimental) The port to use to access the service. * * - This option will fail if the service does not expose any ports. * - If the service exposes multiple ports, this option must be specified. * - If the service exposes a single port, this option is optional and if * specified, it must be the same port exposed by the service. * * @default - if the service exposes a single port, this port will be used. * @experimental */ readonly port?: number; } /** * (experimental) The backend for an ingress path. * * @experimental */ export declare class IngressBackend { private readonly backend; /** * (experimental) A Kubernetes `Service` to use as the backend for this path. * * @param service The service object. * @experimental */ static fromService(service: Service, options?: ServiceIngressBackendOptions): IngressBackend; private constructor(); } /** * (experimental) Represents the rules mapping the paths under a specified host to the related backend services. * * Incoming requests are first evaluated for a host match, * then routed to the backend associated with the matching path. * * @experimental */ export interface IngressRule { /** * (experimental) Backend defines the referenced service endpoint to which the traffic will be forwarded to. * * @experimental */ readonly backend: IngressBackend; /** * (experimental) Host is the fully qualified domain name of a network host, as defined by RFC 3986. * * Note the following deviations from the "host" part of the URI as * defined in the RFC: 1. IPs are not allowed. Currently an IngressRuleValue * can only apply to the IP in the Spec of the parent Ingress. 2. The `:` * delimiter is not respected because ports are not allowed. Currently the * port of an Ingress is implicitly :80 for http and :443 for https. Both * these may change in the future. Incoming requests are matched against the * host before the IngressRuleValue. * * @default - If the host is unspecified, the Ingress routes all traffic based * on the specified IngressRuleValue. * @experimental */ readonly host?: string; /** * (experimental) Path is an extended POSIX regex as defined by IEEE Std 1003.1, (i.e this follows the egrep/unix syntax, not the perl syntax) matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional "path" part of a URL as defined by RFC 3986. Paths must begin with a '/'. * * @default - If unspecified, the path defaults to a catch all sending traffic * to the backend. * @experimental */ readonly path?: string; }