Reapply
defaultReverts changes made outside Kubernetes and recreates deleted objects. The spec stays the source of truth.
Describe a cloud resource in YAML: its schema and the API calls that read, create, update and delete it. kbridge generates the CRD, reconciles every custom resource, and catches drift. No Go code per provider.
kbridge validate --descriptors providers
providers/cloudflare/r2-bucket.yaml
apiVersion: kbridge.io/v1alpha1
kind: Resource
metadata:
name: r2-bucket
spec:
provider: cloudflare
crd:
group: r2.cloudflare.kbridge.io
version: v1alpha1
kind: Bucket
immutable: [name, locationHint, jurisdiction]
schema:
type: object
required: [name]
properties:
name:
type: string
pattern: '^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$'
locationHint:
type: string
enum: [apac, eeur, enam, weur, wnam, oc]
jurisdiction:
type: string
enum: [default, eu, us, fedramp, fedramp-high]
storageClass:
type: string
enum: [Standard, InfrequentAccess]
params:
account: config.accountId
bucket: spec.name
headers:
# Jurisdictional buckets are only reachable through their jurisdiction.
cf-r2-jurisdiction: spec.?jurisdiction.orValue("default")
operations:
read:
steps:
- name: get
method: GET
path: /accounts/{account}/r2/buckets/{bucket}
absentOn: [404]
# The location hint is best effort on Cloudflare's side, so it is never compared.
observe: >-
{
"jurisdiction": steps.get.body.result.jurisdiction,
"storageClass": steps.get.body.result.storage_class
}
create:
steps:
- method: POST
path: /accounts/{account}/r2/buckets
body: >-
{
"name": spec.name,
?"locationHint": spec.?locationHint,
?"storageClass": spec.?storageClass
}
id: spec.name
update:
steps:
- method: PATCH
path: /accounts/{account}/r2/buckets/{bucket}
when: '"storageClass" in changed'
headers:
cf-r2-storage-class: spec.storageClass
delete:
steps:
- method: DELETE
path: /accounts/{account}/r2/buckets/{bucket}
accept: [404]
terminal
$ kbridge gen --descriptors providers | kubectl apply -f - customresourcedefinition.apiextensions.k8s.io/buckets.r2.cloudflare.kbridge.io created $ kubectl apply -f r2-bucket.yaml bucket.r2.cloudflare.kbridge.io/static created $ kubectl -n web get buckets.r2.cloudflare.kbridge.io NAME READY SYNCED EXTERNAL-NAME AGE static True True acme-web-static 12s
events
Normal Created · created external object acme-web-static
Warning DriftDetected · fields storageClass differ
The descriptor is the whole integration. The output is a regular Kubernetes resource.
Drift detection
Every sync compares the external object with the spec. Each resource picks its policy.
Reverts changes made outside Kubernetes and recreates deleted objects. The spec stays the source of truth.
Reports the drift with a Kubernetes event, a JSON log line and a Prometheus metric, and leaves the object alone.
Keeps managing the object for your spec changes, without reporting differences made elsewhere.
Immutable fields are never changed in place, under any policy. Events and logs name the fields that differ, never their values.
One binary
kbridge loads the descriptors at startup and starts one controller per resource kind. Adding an API means adding YAML files, not deploying another operator.
Declarative
A descriptor holds the CRD schema, the HTTP calls and a projection of the response. Expressions are type-checked at load time and their cost is bounded.
Write a provider →Protocols
JSON or XML bodies. Bearer, header, basic or AWS SigV4 authentication. Several calls per operation, partial updates, retries with backoff.
Provider settings →Observable
Ready and Synced conditions with precise reasons, Kubernetes events, JSON logs, and Prometheus metrics for drift and every API call.
Metrics →How it works
A Provider says how to reach the API. A Resource maps a kind to its read, create, update and delete calls.
read:
steps:
- name: get
method: GET
path: /accounts/{account}/r2/buckets/{bucket}
absentOn: [404]kbridge gen prints the CRDs, with immutable fields enforced by the API server, and the minimal RBAC.
$ kbridge gen --descriptors providers \
--namespace kbridge > generated.yamlkbridge run reads each external object, creates it when absent, converges the fields that differ and reports drift.
$ kbridge run --descriptors /providers \
--namespace kbridgeSafe by default
Ownership
An object that kbridge did not create is never taken over, or deleted, until you name it.
Adoption →Idempotency
A pending-create marker survives crashes. When the outcome is uncertain, kbridge stops instead of guessing.
Interrupted creates →Secrets
Secrets live in the controller namespace. Each ProviderConfig lists the namespaces allowed to use it.
ProviderConfig →Network
HTTPS only, to allow-listed hosts. Redirects are refused and responses are capped at 4 MiB.
Security model →Shipped providers
The descriptors below are the real files that ship with kbridge.
apiVersion: kbridge.io/v1alpha1
kind: Resource
metadata:
name: s3-bucket
spec:
provider: aws
crd:
group: s3.aws.kbridge.io
version: v1alpha1
kind: Bucket
immutable: [name, region]
schema:
type: object
required: [name, region]
properties:
name:
type: string
# Dotless names keep the virtual-hosted TLS certificate valid.
pattern: '^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$'
region:
type: string
pattern: '^[a-z]{2}(-[a-z]+)+-[0-9]$'
versioning:
type: string
enum: [Enabled, Suspended]
tags:
type: object
additionalProperties:
type: string
endpoint: https://{bucket}.s3.{region}.amazonaws.com
params:
bucket: spec.name
region: spec.region
authParams:
service: '"s3"'
region: spec.region
operations:
read:
steps:
- name: head
method: HEAD
path: /
absentOn: [404]
- name: versioning
method: GET
path: /?versioning
- name: tags
method: GET
path: /?tagging
# NoSuchTagSet: the bucket exists but has no tag.
accept: [404]
observe: >-
{
"region": steps.head.headers["x-amz-bucket-region"],
"versioning": steps.versioning.body.VersioningConfiguration.?Status.orValue("Suspended"),
"tags": steps.tags.status == 404
? {}
: toList(steps.tags.body.Tagging.TagSet.Tag).transformMapEntry(i, t, {t.Key: t.Value})
}
create:
steps:
- method: PUT
path: /
# us-east-1 is the default location and rejects an explicit constraint.
body: >-
spec.region == "us-east-1"
? null
: dyn({"CreateBucketConfiguration": {"LocationConstraint": spec.region}})
id: spec.name
update:
steps:
- method: PUT
path: /?versioning
when: '"versioning" in changed'
body: '{"VersioningConfiguration": {"Status": spec.versioning}}'
- method: PUT
path: /?tagging
when: '"tags" in changed && size(spec.tags) > 0'
body: >-
{"Tagging": {"TagSet": {"Tag": spec.tags.transformList(k, v, {"Key": k, "Value": v})}}}
- method: DELETE
path: /?tagging
when: '"tags" in changed && size(spec.tags) == 0'
delete:
steps:
- method: DELETE
path: /
accept: [404]
apiVersion: s3.aws.kbridge.io/v1alpha1
kind: Bucket
metadata:
name: media
namespace: web
spec:
providerConfigRef: aws-prod
forProvider:
name: acme-web-media
region: eu-west-3
versioning: Enabled
tags:
team: web
apiVersion: kbridge.io/v1alpha1
kind: Resource
metadata:
name: r2-bucket
spec:
provider: cloudflare
crd:
group: r2.cloudflare.kbridge.io
version: v1alpha1
kind: Bucket
immutable: [name, locationHint, jurisdiction]
schema:
type: object
required: [name]
properties:
name:
type: string
pattern: '^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$'
locationHint:
type: string
enum: [apac, eeur, enam, weur, wnam, oc]
jurisdiction:
type: string
enum: [default, eu, us, fedramp, fedramp-high]
storageClass:
type: string
enum: [Standard, InfrequentAccess]
params:
account: config.accountId
bucket: spec.name
headers:
# Jurisdictional buckets are only reachable through their jurisdiction.
cf-r2-jurisdiction: spec.?jurisdiction.orValue("default")
operations:
read:
steps:
- name: get
method: GET
path: /accounts/{account}/r2/buckets/{bucket}
absentOn: [404]
# The location hint is best effort on Cloudflare's side, so it is never compared.
observe: >-
{
"jurisdiction": steps.get.body.result.jurisdiction,
"storageClass": steps.get.body.result.storage_class
}
create:
steps:
- method: POST
path: /accounts/{account}/r2/buckets
body: >-
{
"name": spec.name,
?"locationHint": spec.?locationHint,
?"storageClass": spec.?storageClass
}
id: spec.name
update:
steps:
- method: PATCH
path: /accounts/{account}/r2/buckets/{bucket}
when: '"storageClass" in changed'
headers:
cf-r2-storage-class: spec.storageClass
delete:
steps:
- method: DELETE
path: /accounts/{account}/r2/buckets/{bucket}
accept: [404]
# Reports drift without reverting it, and keeps the bucket when the resource is deleted.
apiVersion: r2.cloudflare.kbridge.io/v1alpha1
kind: Bucket
metadata:
name: static
namespace: web
spec:
providerConfigRef: cloudflare-prod
driftPolicy: Alert
deletionPolicy: Orphan
forProvider:
name: acme-web-static
jurisdiction: eu
locationHint: weur
storageClass: Standard
FAQ
No. kbridge is a standalone controller. It reuses familiar conventions, such as forProvider, a ProviderConfig and an external-name annotation, but needs neither Crossplane nor one binary per provider.
No. You write a Resource descriptor, and a Provider descriptor if the API is new. kbridge validate checks them, and kbridge gen produces the CRD and RBAC.
The next sync detects the difference. With Reapply, kbridge reverts it; with Alert, it reports it and leaves the object as is; with Ignore, it stays silent.
Not unless you ask. An existing object blocks the resource with AlreadyExists until you set the kbridge.io/external-name annotation. deletionPolicy: Orphan keeps the object when the resource is deleted.
With a Secret holding access keys, IRSA, or EKS Pod Identity, optionally followed by an assumed role for cross-account access. It never falls back to the default credential chain.
Not yet. kbridge is in early development: the shipped descriptors pass the integration tests against API fakes, and have not run against the real APIs yet.
Read how kbridge works, then describe the resource you need.