crate.operator.grand_central module¶
- async crate.operator.grand_central.create_grand_central_backend(namespace, name, spec, meta, logger, use_traefik=False)¶
- async crate.operator.grand_central.create_grand_central_exposure(namespace, name, spec, meta, logger, use_traefik=False)¶
Create only the routing resources for grand-central (HTTPRoute and Traefik Middlewares, or nginx Ingress), without touching the Deployment or Service.
This is used when resuming a suspended cluster or when switching the
spec.cluster.exposurefield, where the Deployment and Service already exist and only the routing layer needs to be (re-)created.- Parameters:
namespace (
str) – The Kubernetes namespace to create resources in.name (
str) – The CrateDB custom resource name defining the CrateDB cluster.spec (
Spec) – Thespecsection of the CrateDB custom resource.meta (
Meta) – Themetadatasection of the CrateDB custom resource.logger (
Logger) – Logger for operation tracking.use_traefik (
bool) – WhenTrue, create an HTTPRoute and Traefik Middlewares. WhenFalse(default), create an nginx Ingress.
- Return type:
- async crate.operator.grand_central.create_grand_central_user(namespace, name, meta, logger)¶
- async crate.operator.grand_central.delete_grand_central_ingress(namespace, name, logger)¶
Delete the nginx Ingress resource for grand-central.
A 404 response is treated as success so that the function is safe to call even when the Ingress has already been removed.
- async crate.operator.grand_central.delete_grand_central_traefik_resources(namespace, name, logger)¶
Delete the HTTPRoute and all three Traefik Middlewares for grand-central.
Resources are deleted in order: HTTPRoute first, then
grand-central-cors,grand-central-compress-js,grand-central-buffering, andgrand-central-ip-allowlist. A 404 response for any resource is treated as success.
- crate.operator.grand_central.get_grand_central_deployment(owner_references, name, labels, image_pull_secrets, spec)¶
- crate.operator.grand_central.get_grand_central_httproute(owner_references, name, labels, hostname, spec)¶
Build the HTTPRoute manifest for grand-central.
Creates two rules: one matching
/api(with JS compression, buffering, and IP allowlist middlewares) and one matching/socket.io(with buffering and IP allowlist only). Both rules set security and CORS response headers via a ResponseHeaderModifier filter.- Parameters:
owner_references (
Optional[List[V1OwnerReference]]) – Owner references to set on the resource.name (
str) – The CrateDB custom resource name defining the CrateDB cluster.labels (
Dict[str,str]) – Kubernetes labels to apply to the resource.hostname (
str) – The external hostname the HTTPRoute should match.spec (
Spec) – Thespecsection of the CrateDB custom resource.
- Return type:
- crate.operator.grand_central.get_grand_central_ingress(owner_references, name, labels, hostname, spec, cidrs=None)¶
- crate.operator.grand_central.get_grand_central_labels(name, meta)¶
- crate.operator.grand_central.get_grand_central_middleware_buffering(owner_references, name, labels)¶
Build the
grand-central-bufferingTraefik Middleware manifest.Configures request/response buffering with a 1 GiB maximum request body, replacing the nginx
proxy-body-size: 1Gannotation from the legacy Ingress.
- crate.operator.grand_central.get_grand_central_middleware_compress_js(owner_references, name, labels)¶
Build the
grand-central-compress-jsTraefik Middleware manifest.Configures Traefik to gzip-compress
application/javascriptandtext/javascriptresponses, replacing the nginxgzipconfiguration snippet from the legacy Ingress.
- crate.operator.grand_central.get_grand_central_middleware_cors(owner_references, name, labels, spec)¶
Build the
grand-central-corsTraefik Middleware manifest.The CrateDB setting accepts a comma-separated list of origins; these are split into individual entries. Falls back to
["*"]when the setting is absent.- Parameters:
owner_references (
Optional[List[V1OwnerReference]]) – Owner references to set on the resource.name (
str) – The CrateDB custom resource name defining the CrateDB cluster.labels (
Dict[str,str]) – Kubernetes labels to apply to the resource.spec (
Spec) – Thespecsection of the CrateDB custom resource, used to readcluster.settings.http.cors.allow-origin.
- Return type:
- crate.operator.grand_central.get_grand_central_middleware_ip_allowlist(owner_references, name, labels, cidrs=None)¶
Build the
grand-central-ip-allowlistTraefik Middleware manifest.Restricts access to the listed CIDR ranges, replacing the nginx
whitelist-source-rangeannotation from the legacy Ingress. Whencidrsis empty orNone, all traffic is allowed (0.0.0.0/0and::/0).- Parameters:
owner_references (
Optional[List[V1OwnerReference]]) – Owner references to set on the resource.name (
str) – The CrateDB custom resource name defining the CrateDB cluster.labels (
Dict[str,str]) – Kubernetes labels to apply to the resource.cidrs (
Optional[List[str]]) – Optional list of CIDR ranges to allow. Defaults to open access when not provided.
- Return type:
- crate.operator.grand_central.get_grand_central_service(owner_references, name, labels)¶
- async crate.operator.grand_central.read_grand_central_deployment(namespace, name)¶
- async crate.operator.grand_central.read_grand_central_httproute(namespace, name)¶
Return the HTTPRoute object for grand-central, or
Noneif it does not exist or cannot be read.
- async crate.operator.grand_central.read_grand_central_ingress(namespace, name)¶
- async crate.operator.grand_central.update_grand_central_deployment_image(namespace, name, image, logger)¶
- async crate.operator.grand_central.update_grand_central_ip_allowlist(namespace, name, cidrs, logger)¶
Patch the
grand-central-ip-allowlistMiddleware in place with a new set of CIDR ranges.When
cidrsis empty, the middleware is set to allow all traffic (0.0.0.0/0and::/0) rather than blocking everything.- Parameters:
- Return type: