Skip to Content
Workloads

Site

Serve a static web app with settings for each deployment.

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

Site

apiVersion: funcd.io/v1alpha1
kind: Site
metadata:
  name: handbook
  namespace: default
  resourceGroup: rg1
spec:
  image: registry.example.com/handbook-web:1.4.0
  buckets:
    - name: handbook
  bindings:
    blob:
      - bucket: handbook
        prefix: web
  spa: true
  ingress:
    path: /handbook
    baseHref: true
    auth:
      mode: open
apiVersionkind
funcd.io/v1alpha1Site

Site.spec

FieldType and limitsDescription
bindingsobject, Site.spec.bindingsWhere the Site stores and serves its bundles: one Bucket prefix, in blob.
bucketsarray of Site.spec.buckets[]Exactly the one Bucket that bindings.blob names, never with deletion: delete; a Site in an App sets none and refers to that Bucket by ref. By name, the Site creates the Bucket with that prefix, without an owner, and the prefixes listed here, which may not repeat it; a Bucket of that name that the Site did not create leaves the Site not Ready. By ref, the Site is Ready only once the Bucket holds that prefix without an owner, and it never changes the Bucket.
imagestring, requiredThe OCI artifact of the Site's static files, which funcdctl push --site makes, named by a tag or a digest. funcd resolves a tag to a digest when the spec changes, so a tag that moves after a deploy changes nothing until the spec changes again. Each deployed bundle stays in the Bucket, so pointing image back at an earlier one serves it again without an upload. A bundle with a _runtime entry at its root does not deploy: funcd keeps that name for the files it generates.
indexstringThe bundle's file served for /, by its file name for any other path that ends in /, and with spa for a path that matches no file. It is a path in the bundle, with no leading /; a bundle without it does not deploy, and the previous one keeps serving. Empty means site.defaultIndex, index.html by default.
ingressobject, Site.spec.ingress, requiredWhere the edge serves the Site: its own address and its rules, through a Route of the Site's name that the Site writes. A Route of that name that the Site does not own leaves the Site not Ready.
runtimeConfigobject, Site.spec.runtimeConfigValues each deployment sets without a rebuild, served as config.json beside the bundle. Every client that can load the Site can read it: never put a secret in it.
spabooleanServe the index, with status 200, for a path under the bundle's path that matches no file, so that a client-side router handles it. ingress.rules never fall back to it: a missing file there is 404.

Site.spec.bindings

FieldType and limitsDescription
blobarray of Site.spec.bindings.blob[], requiredExactly one entry: the Bucket and the prefix that hold the Site's bundles.

Site.spec.bindings.blob[]

FieldType and limitsDescription
bucketstring, required, a DNS-1123 labelThe Bucket that holds the Site's bundles, in the Site's namespace.
prefixstring, required, a DNS-1123 labelThe prefix of that Bucket under which the Site stores each bundle, at <prefix>/sha256-<hex>/, and the config.json that runtimeConfig generates. It cannot change once the Site exists: a new prefix needs a new Site.

Site.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 Site.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, Site.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.

Site.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, Site.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, Site.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.

Site.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.

Site.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.

Site.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.

Site.spec.ingress

FieldType and limitsDescription
authobject, Site.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.
baseHrefbooleanServe a copy of the bundle's index whose <base href> is the Site's mount, so a bundle built with relative URLs runs at any path, deep links included.
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.
rulesarray of Site.spec.ingress.rules[]More Bucket prefixes the Site serves, each at its own path, with the bundle's host, auth and enabled. A rule may sit below the bundle's path, since the longest matching path wins, and a missing file there is 404, never the bundle's index.

Site.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.

Site.spec.ingress.rules[]

FieldType and limitsDescription
bucketstring, a DNS-1123 labelA Bucket of the Site's namespace, which buckets need not declare; empty means the Bucket of bindings.blob. While it does not exist, the Site's Route serves nothing, the bundle included, and the Site is not Ready.
pathstring, requiredThe path where the prefix is served, matching it and every path below it. It begins with / and may not be /, another rule's path or the bundle's path, which is ingress.path or its default. With runtimeConfig, it may not be the path of config.json either.
prefixstring, required, a DNS-1123 labelThe prefix of that Bucket served at path: <path>/<key> reads the object <prefix>/<key> as the Bucket holds it, since nothing is copied.

Site.spec.runtimeConfig

FieldType and limitsDescription
configMapstring, a DNS-1123 labelA ConfigMap of the Site's namespace whose data adds keys to config.json; a key of values wins over the same key here. In an App, it may name one of the App's configMaps entries. While it does not exist, the Site is not Ready, though its bundle still deploys and its last config.json, if any, keeps serving; a change to it rewrites only the file.
valuesmap of string to stringKeys and the string values that config.json gives them; a key here wins over the same key from configMap. Each key is an environment variable name: ASCII letters, digits and _, not starting with a digit. The file holds at most 32768 bytes (32 KiB): values that alone pass it are refused, and a file that configMap takes past it leaves the Site not Ready, serving its last config.json, if any.

Site.status

FieldType and limitsDescription
bytesintegerThe total size, in bytes, of the files that objects counts.
conditionsarray of ConditionThe conditions that explain the phase.
digeststring, a sha256 digestThe digest of the bundle that the Site's Route is set to serve, empty before the first deploy. A deploy that fails leaves the previous bundle's digest.
objectsintegerThe number of that bundle's files in the Bucket, without the files funcd generates for the Site. It reads 0 while the Site cannot resolve its image or use its Bucket.
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.
servingPrefixstringWhere that bundle's files are in the Bucket: <prefix>/sha256-<hex>/, from the prefix of spec.bindings.blob and the digest.

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}/sitesList the Sites of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/sitesCreate a Site
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/sites/{name}Read a Site
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/sites/{name}Replace a Site
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/sites/{name}Delete a Site

On this page