Skip to content
Documentation menu

Docs / Reference / Workers and storage

KVNamespace

KVNamespace represents a Cloudflare Workers KV namespace. Deleting it deletes the namespace and all of its data, unless the retain deletion policy is set.

API version
kflare.dev/v1alpha1
Scope
Namespaced
Short name
cfkv
Token permission
Account · Workers KV Storage · Edit

Example

Every field, with the sample's values. The live lines are the repository's sample, which applies as it is; the commented ones are the other fields, filled from other samples where one sets them. Some exclude each other, so check the rules before you uncomment several.

kvnamespace.yaml
apiVersion: kflare.dev/v1alpha1
kind: KVNamespace
metadata:
  name: example-kvnamespace
  namespace: default
  annotations:
    kflare.dev/deletion-policy: retain
spec:
  accountRef:
    name: my-account
  title: example-kv

Spec

What you set, with the limits the API server enforces.

FieldDescription
accountRef
objectrequiredimmutable

AccountRef references the CloudflareAccount that owns the KV namespace. Immutable after creation.

accountRef.name
string

Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default: ""

title
stringrequired

Title is the namespace's title in Cloudflare, unique within the account. Changing it renames the namespace in place; its ID and data are kept.

Limits: 1 to 512 characters

Status

What kflare reports. conditions holds the Ready condition, whose reason says why a resource isn't ready.

FieldDescription
cloudflareMetadata
object

CloudflareMetadata holds identifiers returned by the Cloudflare API.

cloudflareMetadata.namespaceID
string

NamespaceID is the Cloudflare KV namespace identifier. WorkerScripts bind the namespace by this ID.

conditions
[]object

Conditions represent the latest available observations of the KV namespace state.

kubectl get

The columns kubectl get kvnamespaces prints.

ColumnSource
TITLE.spec.title
NAMESPACE ID.status.cloudflareMetadata.namespaceID
READY.status.conditions[?(@.type=="Ready")].status
AGE.metadata.creationTimestamp

Samples

From the repository's config/samples, comments included.

cloudflare_v1alpha1_kvnamespace.yaml
# Generated by kflare-gen from generator/generator.yaml. DO NOT EDIT.
#
# KVNamespace is the Schema for the kvnamespaces API.
# It represents a Cloudflare Workers KV namespace. Deleting it deletes the
# namespace and all of its data, unless the retain deletion policy is set.
apiVersion: kflare.dev/v1alpha1
kind: KVNamespace
metadata:
  name: example-kvnamespace
  namespace: default
  annotations:
    # The retain policy keeps the KV namespace in Cloudflare when this resource
    # is deleted. Without it, deleting the resource deletes the KV namespace.
    kflare.dev/deletion-policy: retain
spec:
  accountRef:
    name: my-account
  # Title is the namespace's title in Cloudflare, unique within the
  # account. Changing it renames the namespace in place; its ID and data
  # are kept.
  title: example-kv

On GitHub