Skip to Content
Services

Lake

Declare a Lake over a Bucket prefix, bind it to a Function, and create and query its tables with SQL from the handler.

This page lists the spec and status fields of Lake, each with its type, its limits and its description. The Platform page explains the concept, and the metadata of every kind is the same.

Lake

apiVersion: funcd.io/v1alpha1
kind: Lake
metadata:
  name: analytics
  namespace: default
  resourceGroup: rg1
spec:
  buckets:
    - name: warehouse
      prefixes:
        - name: tables
  secrets:
    - name: lake-token
      keys:
        - QUACK_TOKEN
  bindings:
    blob:
      - alias: tables
        bucket: warehouse
        prefix: tables
    secret:
      - lake-token
  location:
    bucket: warehouse
    prefix: tables
apiVersionkind
funcd.io/v1alpha1Lake

Lake.spec

FieldType and limitsDescription
bindingsobject, Lake.spec.bindings, requiredWhat the Lake's engine uses: Bucket prefixes, and the ConfigMaps and Secrets of its environment.
bucketsarray of Lake.spec.buckets[]The Buckets that a Lake applied on its own declares: by name the Lake creates the Bucket, an omitted prefix owner being the Lake, and a Bucket of that name that is not the Lake's holds it in Pending with StoreNotOwned; by ref it binds an existing one. Each Bucket that the Lake's bindings.blob names must be declared here. A lake that another resource declares sets none.
configMapsarray of Lake.spec.configMaps[]The ConfigMaps that a Lake applied on its own declares: by name the Lake defines one, and a ConfigMap of its stored name that is not the Lake's holds it in Pending with StoreNotOwned; by ref it binds an existing one. Each ConfigMap that the Lake's bindings.config names must be declared here. A lake that another resource declares sets none.
ingressobject, Lake.spec.ingressExposes the Lake gateway at the edge, only when enabled is true and while the Lake is Ready. The path defaults to /lake/<name>, or / with a host. Setting auth is refused, since the Lake gateway checks each caller itself.
locationobject, Lake.spec.location, requiredThe Bucket prefix that holds the Lake's files, one of the Lake's bindings.blob. The Lake waits in Pending, with the reason PrefixNotOwned, until the prefix's owner is this Lake. The Lake's catalog is kept outside the Bucket, under the same location, so a Lake located where another was finds that Lake's files and catalog.
resourcesobject, Lake.spec.resourcesThe cpu and memory of the Lake's engine. An empty cpu or memory sets no limit on it, and a change replaces the running engine.
secretsarray of Lake.spec.secrets[]The Secrets that a Lake applied on its own declares, with the keys its engine reads. Each Secret that the Lake's bindings.secret names must be declared here, and the Lake waits in Pending, with SecretNotFound or SecretKeyMissing, while one is missing or lacks a key. A lake that another resource declares sets none.

Lake.spec.bindings

FieldType and limitsDescription
blobarray of Lake.spec.bindings.blob[], requiredThe Bucket prefixes the engine may read, each under an alias. It writes only a prefix whose owner is this Lake, and the Lake's location must be one of them.
configarray of string values, each a DNS-1123 labelConfigMaps whose data the engine gets as environment variables. Only QUACK_TOKEN and the DUCKDB_ keys pass, DUCKDB_EXTENSION_DIRECTORY excepted, and a bound Secret's value wins over a ConfigMap's for the same key. A missing ConfigMap holds the Lake in Pending, with the reason BindingResolveFailed.
secretarray of string values, each a DNS-1123 labelSecrets whose data the engine gets as environment variables, such as its QUACK_TOKEN; the same keys pass as for config. funcd asks Cedar, as the Lake, for secret::read on each: a forbidden Secret holds the Lake in Pending, with the reason BindingResolveFailed, as does a missing one in a lake that another resource declares. A changed value replaces the engine.

Lake.spec.bindings.blob[]

FieldType and limitsDescription
aliasstring, required, a DNS-1123 labelThe binding's name, unique in the list; code that reaches the prefix through ctx.blob passes it.
bucketstring, required, a DNS-1123 labelThe Bucket, in the same namespace, that holds the prefix.
prefixstring, required, a DNS-1123 labelThe prefix, by its name in the Bucket's prefixes.

Lake.spec.buckets[]

FieldType and limitsDescription
deletionstring, one of retain, deleteretain (the default) keeps the store and its data when the resource that declares it is deleted, and delete removes them. An App applies the same choice when it drops the entry.
namestring, a DNS-1123 labelThe object's name. It takes the namespace and resource group of the resource that declares it.
prefixesarray of Lake.spec.buckets[].prefixes[]The Bucket's prefixes, each a key space with its own owner and cap. Prefix names are unique within the Bucket. A Function or a Lake that binds a prefix the Bucket does not list waits, with the reason BucketNotFound.
quotaobject, Lake.spec.buckets[].quotaCaps on the Bucket's total size and on each object. While the Bucket has a size cap, funcd refuses to sign a presigned PUT URL for it, with 403.
refstring, a DNS-1123 labelThe name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field.

Lake.spec.buckets[].prefixes[]

FieldType and limitsDescription
namestring, required, a DNS-1123 labelThe prefix's name, unique within the Bucket. Over S3, it is the first segment of each object's key.
ownerobject, Lake.spec.buckets[].prefixes[].ownerThe one Function, Lake or Job that may write the prefix, named with its kind, besides the writers that a RolesAssignment names. In a Bucket that a Function, a Lake or a Job declares by name, an omitted owner is that workload. In a Workflow's buckets, a Function owner names a step and a Lake owner a lake that the Workflow declares. The prefix that a Site serves its bundle from must have no owner, since the Site writes its builds there; the prefixes of a Site's ingress rules may have one.
quotaobject, Lake.spec.buckets[].prefixes[].quotaA cap on the prefix's total size: a write into the prefix must fit both this cap and the Bucket's, and while it is set funcd refuses to sign a presigned PUT URL into the prefix, with 403. It also caps a Lake's files under the prefix, though not the Lake's catalog.

Lake.spec.buckets[].prefixes[].owner

FieldType and limitsDescription
kindstring, required, one of Function, Lake, JobThe workload's kind. A Function, a Lake and a Job may share a name, so the kind says which one it is; each field names the kinds it accepts.
namestring, required, a DNS-1123 labelThe workload's name, in the object's namespace.

Lake.spec.buckets[].prefixes[].quota

FieldType and limitsDescription
maxBytesinteger, at least 0The same cap as a number of bytes. Set maxSize or maxBytes, not both.
maxSizestring, a size: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B (512Ki, 2GiB)The cap on the total size held, above zero. Set maxSize or maxBytes, not both; neither means no cap. A write that would pass the cap gets 507 in a KV store or a Bucket; a SQL execute call gets 507 once the database holds the cap.

Lake.spec.buckets[].quota

FieldType and limitsDescription
maxBytesinteger, at least 0The same cap as a number of bytes. Set maxSize or maxBytes, not both.
maxObjectBytesinteger, at least 0The largest object a write may store, in bytes. A larger write gets 413, or EntityTooLarge over S3, and while it is set funcd refuses to sign a presigned PUT URL for the Bucket, with 403. 0 sets no cap of the Bucket's own, so only funcd's upload limits apply, such as s3gateway.maxUploadBytes.
maxSizestring, a size: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B (512Ki, 2GiB)The cap on the total size held, above zero. Set maxSize or maxBytes, not both; neither means no cap. A write that would pass the cap gets 507 in a KV store or a Bucket; a SQL execute call gets 507 once the database holds the cap.

Lake.spec.configMaps[]

FieldType and limitsDescription
datamap of string to stringKeys and their string values, for settings that are not secret. Each key is an environment variable name: ASCII letters, digits and _, not starting with a digit. Each value must be UTF-8 text with no NUL byte: a Function or a Lake that binds a ConfigMap holding another value does not start. Each worker of a Function that lists the ConfigMap in bindings.config gets each key as an environment variable when it starts, except a key that starts with FUNCD_ or that a bound Secret also holds; and while the S3 gateway is on, a Function that binds a Bucket gets the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY that funcd issues it, in place of the ConfigMap's. A Lake that lists it gives its engine only the keys that the Lake's bindings.config lets through.
namestring, a DNS-1123 labelThe ConfigMap's name, at most 52 characters. It is stored as <name>-<hash of data>, and the config of each part that names it is set to that stored name.
refstring, a DNS-1123 labelThe name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field.

Lake.spec.ingress

FieldType and limitsDescription
authobject, Lake.spec.ingress.authHow the edge checks callers at the resource's own address; unset, the namespace's spec.edgeDefaults.auth decides, else open. A Lake refuses it, since the Lake gateway checks each caller.
enabledbooleanTurns the resource's own address on or off. Unset, it is on unless the namespace's spec.defaultExposure is explicit; a Lake's address is on only when this is true.
hoststringThe exact host of the resource's own address. Empty is the namespace's host, <namespace>.<server.baseDomain>, or, in the default namespace, any host that no other namespace reserves.
pathstringThe edge path of the resource's own address, which begins with / and does not end with / unless it is /. Empty is / when host is set, else /function/<name>, /site/<name> or /lake/<name> by kind.

Lake.spec.ingress.auth

FieldType and limitsDescription
modestring, one of "", authenticated, open, oidcHow the edge checks callers. authenticated requires a bearer token, or an X-Api-Key header, of an identity that RBAC lets get Functions in the namespace: 401 without a valid one, 403 when it may not; while server.auth.edge is off, every caller gets 401. open lets anonymous callers in. oidc signs callers in with the OIDCProvider that provider names, and passes the signed-in user to the code behind it in the X-Funcd-Principal headers. Empty takes the enclosing stance, if any, else the namespace's spec.edgeDefaults.auth.mode, else open.
providerstring, a DNS-1123 labelWith mode oidc, the OIDCProvider of the namespace that signs callers in; required with oidc and refused with another mode.
unauthenticatedstring, one of "", redirect, 401, allowWith mode oidc, what a call that is not signed in gets: redirect, the default, sends a GET or HEAD navigation to the provider with 302 and gives any other call 401; 401 gives every such call 401; allow passes every call, with no principal. Refused with another mode.

Lake.spec.location

FieldType and limitsDescription
bucketstring, required, a DNS-1123 labelA Bucket of the same namespace.
prefixstring, required, a DNS-1123 labelA prefix of that Bucket.

Lake.spec.resources

FieldType and limitsDescription
cpustringThe CPU cap of the worker or engine it sizes, as a number of cores of at least 0.01, such as 0.5 or 2. Empty takes the default of the resource that declares it, or no cap when there is none. Only the containerd runtime enforces it.
memorystringThe memory cap of the worker or engine it sizes, such as 256Mi or 4GiB: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B, above zero. Empty takes the default of the resource that declares it, or no cap when there is none. Only the containerd runtime enforces it, and there a worker that uses more memory than the cap is killed.

Lake.spec.secrets[]

FieldType and limitsDescription
descriptionstringWhat the Secret is for, for the installer who provides it.
keysarray of string values, required, each matching ^[A-Za-z_][A-Za-z0-9_]*$The keys read from the Secret: its data must hold each of them.
namestring, required, a DNS-1123 labelThe name of a Secret in the namespace of the resource that declares it. funcd holds its value; the resource never writes it.

Lake.status

FieldType and limitsDescription
conditionsarray of ConditionThe conditions that explain the phase.
endpointstringWhile the Lake is Ready, the host and port of its Lake gateway, which a Function that binds the Lake gets as FUNCD_LAKE_<ALIAS>_URL. In any other phase it is empty or holds the engine's own address.
functionstring, a DNS-1123 labelfuncd sets it to <name>-duckdb, after the Lake's name. funcd makes no object of that name and does not read it.
observedGenerationintegerThe generation of the spec that funcd last acted on.
phasestring, one of Pending, Deploying, Ready, Idle, Degraded, Failed, TerminatingWhere the object is in its lifecycle.
proxyPortintegerThe port of the Lake gateway. funcd binds it again after a restart, so the address that Functions binding the Lake hold keeps working; when the port is taken, funcd binds a new one, and their address changes.

Handler API

The methods a handler calls on its context's clients, in each language funcd ships a shim for.

ctx.lake

The Lakes that the function binds, by alias: the address of each Lake's gateway, and the token that the gateway accepts from the function.

MethodWhat it does
get(alias: string): LakeEndpointThe gateway of the Lake bound as alias: url, its address as host
, and token, the token that it accepts from the function. Throws an Error naming the alias when the function binds no Lake with that alias.

HTTP API

The table lists each described operation of these kinds, with its method and path. The operation's page in the API reference gives its parameters, its body, its authentication and every answer, with when it happens and what to do.

MethodPathOperation
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/lakesList the Lakes of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/lakesCreate a Lake
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/lakes/{name}Read a Lake
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/lakes/{name}Replace a Lake
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/lakes/{name}Delete a Lake
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/lakes/{name}/logsRead the logs of a Lake's engine

On this page