API Reference
Packages
Section titled “Packages”cfgateway.dreamfuselabs.com/v1alpha1
Section titled “cfgateway.dreamfuselabs.com/v1alpha1”Package v1alpha1 contains API Schema definitions for the cfgateway v1alpha1 API group.
Resource Types
Section titled “Resource Types”- CloudflareAccessApplication
- CloudflareAccessIdentityProvider
- CloudflareAccessPolicy
- CloudflareAccessServiceToken
- CloudflareDNSRecord
- CloudflareGatewayConfiguration
- CloudflareGatewayStatus
- CloudflareTunnel
- CloudflareTunnelPolicy
AccessApplicability
Section titled “AccessApplicability”AccessApplicability holds the three target-shaped facts ADR-024 rule 5 rejects on, resolved by the CloudflareAccessPolicy reconciler at carrier-generation time (ADR-026 rule 1) over the same Gateway/Route snapshot in which it already computes this carrier’s namespace, ownerReference, configurationRef, hostname and rules[].
One nested struct rather than three top-level booleans (ADR-026 rule 2(a)): rule 5’s matrix is one concept and may gain a fourth row, which then lands as a field inside this struct rather than a fourth flag loose in a spec whose other fields are about something else, and “controller-computed, never user-authored” is stated once, here.
*Plain bool, not bool (ADR-026 rule 2(b)): there is deliberately no unset-versus-false tri-state, because both readings mean “no known obstacle”. The case a third state would serve – the generator could not resolve these facts this reconcile – is handled by not writing the carrier at all (it skips with the existing ConfigRefUnresolved Warning Event, exactly as it does today when configurationRef is unresolvable). Writing a speculative all-false block on unresolved inputs is how a fail-open default becomes fail-open behavior.
Each fact is ANY-wins over every Access-managed Gateway and every accepted Route serving the hostname cluster-wide (ADR-026 rule 3), never scoped to the one targetRef that happened to resolve it: a Cloudflare Access application is keyed on the hostname and protects every request to it, including traffic served by other Routes in other namespaces (ADR-023 rule 2), so a verdict scoped more narrowly than the thing it describes would be wrong by construction.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
tlsPassthrough boolean |
tlsPassthrough is true when any Access-managed listener serving this hostname is a TLS passthrough listener (protocol: TLS, mode: Passthrough). The connection never terminates at Cloudflare’s edge, so there is no HTTP layer for Access to act on (ADR-022’s reasoning; structural, not an experiment). |
Optional: {} |
|
unproxied boolean |
unproxied is true when this hostname’s DNS-mode record resolves proxied: false – a direct-to-origin A/AAAA with Cloudflare’s edge out of path, so an Access application would report success while protecting nothing. Always false in tunnel mode, where every generated record is proxied by construction. |
Optional: {} |
|
grpc boolean |
grpc is true when any GRPCRoute with an accepted Access-managed parent serves this hostname. Combined with an interactive (browser-login) rule set it is a rejection: grpc-go rejects Access’s login redirect outright (S14’s A9, live-verified with a real grpcurl call: exit code 66, “unexpected HTTP status code … 302”). A NonIdentity service-token rule set over the same hostname is deliberately NOT rejected (ADR-024 rule 5), which is why this is an input rather than a verdict. |
Optional: {} |
AccessApplicationRule
Section titled “AccessApplicationRule”AccessApplicationRule is one inline Cloudflare Access policy document, as the carrier holds it – the actuation-side twin of CloudflareAccessPolicy’s AccessRule.
Array position in spec.rules is precedence (S14 item (f): the server assigns
precedence: 1 to the first entry), so no numeric precedence field is exposed. Each entry’s
Cloudflare-side name is the translator-emitted constant “cgc-
The NonIdentity fail-open guard is repeated here rather than inherited, and that is the
point of putting it on this CRD too. ADR-025 rule 7’s 2026-09-20 amendment rejects a
NonIdentity rule whose include list contains an everyone entry: NonIdentity establishes
no user identity and everyone matches every requester unconditionally, so the pair admits
every request with no credential check and no login prompt – functionally the Bypass
semantics rule 7(a) rejected for failing open, reassembled out of two individually-legal
values. The policy CRD carries the same rule, but the carrier is what the actuation
reconciler translates into the Cloudflare document (plan Task 13), and ADR-023’s M7 path
creates carriers with no policy in front of them at all – so a guard living only on the
policy would be a guard the actuated object can bypass.
The quantifier is all(), not exists(): include entries are OR’d, so a rule carrying both
everyone and a serviceToken still admits every unauthenticated request through the
everyone arm, with the service-token entry doing nothing but satisfying a weaker check.
An exists() phrasing would reduce the rule to “add one decorative entry to bypass it” –
the gap Task 8’s review caught on the policy CRD before anything shipped.
Allow + everyone is untouched and remains fully legal: that is the ordinary “anyone who
can log in may through” case, live-verified by S14’s A9 login redirect.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
decision AccessDecision |
decision is this rule’s verdict. Required with no default, deliberately: there is no defensible default for a security decision, and a value that arrived by defaulting rather than by choice is exactly what a carrier created outside the policy path (ADR-023’s M7 case) must not be able to inherit silently. |
Enum: [Allow NonIdentity] Required: {} |
|
include AccessApplicationRuleInclude array |
include is the set of rule forms that make a request match this rule. A request matching any entry matches the rule. MinItems=1 because a rule with no include entries matches nothing. MaxItems=32 and the uniqueness rule mirror CloudflareAccessPolicy’s, for the same reasons: a service-token allowlist is the one list here that plausibly grows past 16, and two identical include entries mean exactly what one means while risking the permanent DriftDetected-plus-no-op-repair loop S1 found for warp-routing and S13 for originRequest, since neither spike established whether Cloudflare de-duplicates a repeated include entry on read-back. Both bounds are relaxable additively; a uniqueness rule added later would reject already-stored objects, so it ships with the first published version or never. |
MaxItems: 32 MinItems: 1 Required: {} |
AccessApplicationRuleInclude
Section titled “AccessApplicationRuleInclude”AccessApplicationRuleInclude is one entry of a carrier rule’s include list – the same discriminated union CloudflareAccessPolicy exposes, with the service-token arm carrying a resolved UUID instead of a same-namespace object name (AccessApplicationServiceToken).
AccessRuleEveryone and AccessDevicePostureReference are shared verbatim with the policy CRD: the first is an empty marker struct and the second already carries an opaque Cloudflare-assigned UID, so neither has a namespace-scoped half to resolve.
There is deliberately no require and no exclude list here either. ADR-025 rule 7(b) fixes the v1alpha1 vocabulary at include-only, and ADR-023 rule 7(e) (as amended) normalizes Cloudflare’s server-injected empty require/exclude arrays away during drift comparison rather than authoring them.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
everyone AccessRuleEveryone |
everyone matches any requester who completes a login through any identity provider configured on the Cloudflare account. |
Optional: {} |
|
serviceToken AccessApplicationServiceToken |
serviceToken matches a request carrying the CF-Access-Client-Id/CF-Access-Client-Secret header pair of the service token with this Cloudflare-side UUID. |
Optional: {} |
|
devicePosture AccessDevicePostureReference |
devicePosture matches a request from a WARP-enrolled device satisfying the referenced posture integration. |
Optional: {} |
AccessApplicationServiceToken
Section titled “AccessApplicationServiceToken”AccessApplicationServiceToken names a Cloudflare Access service token by the UUID Cloudflare assigned it, not by any Kubernetes object name.
This is the one place the carrier’s rule shape deliberately diverges from CloudflareAccessPolicy’s. The policy’s include[].serviceToken.name is a same-namespace reference to a CloudflareAccessServiceToken; the policy reconciler resolves it to that object’s status.externalID and writes the resolved UUID here (ADR-025 rule 8(a), plan Task 12). Two things force that, both load-bearing. The carrier lands in the owning Gateway’s namespace (ADR-023 rule 6), which cross-namespace route attachment makes routinely different from the policy’s – a carrier holding names would have to resolve a credential reference across a tenant boundary. And ADR-023’s M7 extension path requires the carrier to be self-contained: an M7-authored carrier has no policy reconciler behind it to resolve anything, so its spec must already be actuable as written.
The corresponding Cloudflare document element is
{“service_token”:{“token_id”:“
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
tokenID string |
tokenID is the Cloudflare-side service-token UUID – the value a CloudflareAccessServiceToken reports in status.externalID. No UUID pattern is imposed, matching AccessDevicePostureReference.ruleID’s reasoning (ADR-025 rule 5): S15 observed exactly one shape without establishing that Cloudflare never accepts another, and a pattern that turns out to be too narrow would make the policy reconciler’s CreateOrUpdate fail permanently for a value Cloudflare itself minted. MinLength=1 is the check that is unambiguously right – an empty token_id is wrong under every reading – and MaxLength=64 is a defensive self-imposed bound (a UUID is 36 characters), relaxable additively. |
MaxLength: 64 MinLength: 1 Required: {} |
AccessDecision
Section titled “AccessDecision”Underlying type: string
AccessDecision is the verdict one CloudflareAccessPolicy rule produces at Cloudflare’s edge (ADR-025 rule 7(a)).
The enum is exactly the two values spikes S14 and S15 actually sent and observed live (“allow” throughout S14 and in S15’s A8(d); “non_identity” in A8(b)’s 200/403 round trip). Cloudflare’s own API additionally accepts “deny” and “bypass”; both are deliberately excluded. Neither was ever sent by a spike, and “bypass” additionally fails open – a bypass rule matching more traffic than its author expected silently disables Access for that traffic, which is the one failure mode a security feature must not ship unobserved. Adding an enum value later is additive; publishing an unverified one is not.
These are this project’s own CamelCase CRD vocabulary, not Cloudflare’s wire values (“allow”/“non_identity”): ADR-006/D4 keeps the published API type and the Cloudflare-facing domain type (internal/cfapi.AccessDecision) independent, translated by a pure function in internal/access.
Validation:
- Enum: [Allow NonIdentity]
Appears in:
| Field | Description |
|---|---|
Allow |
AccessDecisionAllow admits a request that matches any include entry, after identity is established. Translates to Cloudflare’s “allow”. |
NonIdentity |
AccessDecisionNonIdentity admits a matching request without establishing a user identity at all – the decision a service-token rule set needs, since a machine client cannot complete an interactive login. Translates to “non_identity”. |
AccessDevicePostureReference
Section titled “AccessDevicePostureReference”AccessDevicePostureReference names an existing Cloudflare device-posture integration by its UID.
Posture rules are referenced, never managed – spike S8’s locked scope line (“WARP device enrollment/posture is permanently out of controller scope”) stands, and S15’s A8(d) independently confirmed the controller’s token cannot even list them (HTTP 403 on both list and create against /accounts/{id}/devices/posture). There is therefore no CloudflareAccessDevicePostureRule CRD to reference by name; the operator supplies the UID Cloudflare already assigned.
SECURITY-RELEVANT, and stated here because nobody gets a signal otherwise: Access does not validate this UID at create or attachment time (S15 A8(d) observed HTTP 201 for a deliberately unchecked value), and this controller cannot validate it either, for the permission reason above. A typo produces a Ready=True carrier and no error anywhere. ADR-025 rule 5 makes that an evidenced decision rather than an oversight.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
ruleID string |
ruleID is the Cloudflare device-posture integration UID, emitted as {“device_posture”:{“integration_uid”:“ No UUID pattern is imposed: ADR-025 rule 5 fixes v1alpha1 at no client-side validation, and S15 observed exactly one shape without establishing that Cloudflare never accepts another. MinLength=1 is the one check that is unambiguously right – an empty integration_uid is wrong under every reading. MaxLength is a defensive bound this project imposes on itself (a UUID is 36 characters), in the same posture ADR-023 rule 7(b) takes for the ownership marker’s 255; relaxing it later is additive. |
MaxLength: 64 MinLength: 1 Required: {} |
AccessIdentityProviderType
Section titled “AccessIdentityProviderType”Underlying type: string
AccessIdentityProviderType discriminates the managed arm’s five identity-provider types (ADR-025 rule 2(d)).
Exactly these five ship, and the set is evidenced rather than chosen: S15’s A7 created all five against the real Access API with verbatim HTTP 201 transcripts, using placeholder credentials (Cloudflare defers credential validation to first login, so no real identity tenant was needed). Any sixth type is additive under ADR-023 rule 8’s extension protocol, which requires a live create->GET round-trip before a field ships.
These are this project’s own CamelCase CRD vocabulary, not Cloudflare’s wire values (“google-apps”/“github”/“azureAD”/“okta”/“onetimepin”): ADR-006/D4 keeps the published API type and the Cloudflare-facing domain type (internal/cfapi.AccessIdentityProviderType) independent, translated by a pure function in internal/access.
Validation:
- Enum: [GoogleWorkspace GitHub EntraID Okta OTP]
Appears in:
| Field | Description |
|---|---|
GoogleWorkspace |
AccessIdentityProviderTypeGoogleWorkspace translates to Cloudflare’s “google-apps”. |
GitHub |
AccessIdentityProviderTypeGitHub translates to Cloudflare’s “github”. |
EntraID |
AccessIdentityProviderTypeEntraID translates to Cloudflare’s “azureAD”. |
Okta |
AccessIdentityProviderTypeOkta translates to Cloudflare’s “okta”. |
OTP |
AccessIdentityProviderTypeOTP translates to Cloudflare’s “onetimepin”, the one type that takes no credentials at all – A7 sent "config":\{\} for it. |
AccessRule
Section titled “AccessRule”AccessRule is one inline Cloudflare Access policy document.
Array position in spec.rules is precedence: S14 item (f) observed the server assigning
precedence: 1 to the first entry, so no numeric precedence field is exposed (ADR-023 rule
8). Each entry’s Cloudflare-side name is likewise a translator-emitted constant,
“cgc-
Policies are authored inline on the application, never as reusable account-level policies: S14 item (f) found that deleting an application does not cascade to a reusable policy, so every teardown would leak an account-level object.
Every include entry of a NonIdentity rule must be a serviceToken or devicePosture
entry (ADR-025 rule 7’s 2026-09-20 amendment). NonIdentity establishes no user identity
and everyone matches every requester unconditionally, so decision: NonIdentity with
an include list containing everyone admits every request with no credential check and
no login prompt – functionally the Bypass semantics rule 7(a) rejected for failing
open, reassembled out of two individually-legal values. It is rejected here, in CEL, and
not merely in the translator: a rejection added after v0.3.0 publishes would be a
breaking tightening on already-stored objects, whereas adding it before the schema is
finalized costs nothing.
The quantifier is all, not exists, and that distinction is the whole rule. Include
entries are OR semantics – a request matching any one entry matches the rule. So
requiring merely that some entry be a real check is no protection at all: a rule set
carrying both everyone and a serviceToken still admits every unauthenticated request
through the everyone arm, with the service-token entry doing nothing but satisfying the
check. An exists phrasing would therefore reduce the rule to “add one decorative entry
to bypass it”. ADR-025 rule 7(f) already reaches for the same quantifier one paragraph
over, for the neighbouring classification question: “non-interactive if and only if
decision is NonIdentity and every include entry is non-interactive”.
Allow + everyone is untouched and remains fully legal – that is the ordinary
“anyone who can log in may through” case, live-verified by S14’s A9 login redirect.
The rule is phrased as an enumeration of the forms that count as a real check
(serviceToken, devicePosture) rather than as a negation of everyone. Given the three
forms shipping today the two are exactly equivalent; they diverge only if ADR-025 rule
7(d)’s gated email/emailDomain forms ever ship, and the enumerated phrasing forces
whoever lands those to decide deliberately whether an email match is a credential check,
instead of inheriting “yes” for free from whichever phrasing happened to be typed.
This does not disturb ADR-025 rule 7(f)’s interactive/non-interactive classification, which ADR-024 rule 5 consumes: 7(f) classifies what exists, this narrows what can be constructed, and every combination that remains constructible still classifies exactly as before.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
decision AccessDecision |
decision is this rule’s verdict. Required with no default, deliberately: there is no defensible default for a security decision, and a user who mistypes the field name should get a rejection rather than a silently-applied verdict they did not choose. Relaxing a required field to optional-with-a-default later is additive. |
Enum: [Allow NonIdentity] Required: {} |
|
include AccessRuleInclude array |
include is the set of rule forms that make a request match this rule. A request matching any entry matches the rule. MinItems=1 because a rule with no include entries matches nothing and is a configuration mistake the API server can catch for free. MaxItems=32 is a defensive self-imposed bound rather than a documented Cloudflare limit – deliberately larger than the 16 used for rules and targetRefs, because a service-token allowlist is the one list here that plausibly grows past 16 whereas a 17-entry rule set is not a shape anyone has asked for. Both bounds are relaxable additively. Entries must be distinct. Two identical include entries mean exactly what one means, so the rule can never reject a meaningful configuration – and it closes an unevidenced hazard: neither spike established whether Cloudflare de-duplicates a repeated include entry on read-back, and if it does, the desired document would differ from every GET forever, producing the permanent DriftDetected-plus-no-op-repair loop that S1 found for warp-routing and S13 for originRequest. A uniqueness rule is a tightening, so it ships with the schema’s first published version rather than later, where it would reject already-stored objects. Expressed as whole-entry equality rather than a field-by-field comparison so that the email/emailDomain forms ADR-025 rule 7(d) may add later are covered without touching this rule. |
MaxItems: 32 MinItems: 1 Required: {} |
AccessRuleEveryone
Section titled “AccessRuleEveryone”AccessRuleEveryone is the “everyone” rule form: every requester who completes a login through any identity provider configured on the account matches.
Deliberately an empty struct rather than a bool, mirroring the {“everyone”:{}} shape Cloudflare’s own include array uses, so a future refinement can gain a field here without a breaking change to the discriminated union around it.
Note what this means in v1alpha1: ADR-025 rule 7(e) does not expose allowed_idps, so an
application permits every identity provider configured on the Cloudflare account. This
form is classified Interactive (ADR-025 rule 7(f), live-evidenced by S14’s A9: a real
grpcurl call received a 302 to the login chooser), which is what makes an everyone rule
set incompatible with gRPC traffic under ADR-024 rule 5.
Appears in:
AccessRuleInclude
Section titled “AccessRuleInclude”AccessRuleInclude is one entry of a rule’s include list – a discriminated union over the Cloudflare Access rule forms this project has live evidence for (ADR-025 rule 7(c)).
Exactly three forms ship in v1alpha1, and the omissions are evidenced, not arbitrary.
email and emailDomain are specified by ADR-025 rule 7(d) but gated behind a
create->GET round-trip probe that “ships if and only if a transcript for each exists
before plan Task 8 lands the CRD”. Neither docs/spikes/s14-access-apps.md nor
docs/spikes/s15-access-identity.md contains any email transcript, so the probe has not
run and the two forms are not published here. Adding them later is additive at every
layer (a new optional field plus a relaxed union rule); publishing a rule form whose
server behavior nobody has observed, in a security feature, is exactly the ADR-017 shape
of mistake this project’s evidence discipline exists to prevent. Cloudflare’s remaining
~20 forms (anyValidServiceToken, loginMethod, authMethod, ip, ipList, geo, group,
externalEvaluation, certificate, commonName, the provider-group forms, saml) are
unevidenced named rejections in the same rule.
There is deliberately no require and no exclude list anywhere in this schema. ADR-025
rule 7(b) fixes the v1alpha1 vocabulary at include-only: neither spike ever sent a
non-empty one, both are server-injected as [] on every GET, and ADR-023 rule 7(e) (as
amended) normalizes them away during drift comparison rather than authoring them. Shipping
published, irreversible spec fields the controller can never populate would be worse than
useless – it would advertise a capability that does not exist.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
everyone AccessRuleEveryone |
everyone matches any requester who completes a login through any identity provider configured on the Cloudflare account. |
Optional: {} |
|
serviceToken AccessServiceTokenReference |
serviceToken matches a request carrying the CF-Access-Client-Id/CF-Access-Client-Secret header pair of the named CloudflareAccessServiceToken. |
Optional: {} |
|
devicePosture AccessDevicePostureReference |
devicePosture matches a request from a WARP-enrolled device satisfying the referenced posture integration. |
Optional: {} |
AccessServiceTokenReference
Section titled “AccessServiceTokenReference”AccessServiceTokenReference names a CloudflareAccessServiceToken whose Cloudflare-side UUID this rule admits.
The reference is same-namespace by construction – there is no namespace field, per ADR-025 rule 8(a), which keeps a credential reference from reaching across a tenant boundary. The CloudflareAccessPolicy reconciler resolves the name to the referenced object’s status.externalID and writes the resolved UUID into the generated CloudflareAccessApplication (plan Task 12), so the carrier – which may live in a different namespace entirely (ADR-023 rule 6) – never has to resolve a name across namespaces. An unresolvable or not-yet-Ready reference reports Accepted=False, Reason=InvalidParameters on every ancestor and generates no application at all (ADR-025 rule 8(b)).
This form is classified Non-interactive (ADR-025 rule 7(f), live-verified end to end by S15’s A8(b): 200 with the CF-Access-Client-Id/CF-Access-Client-Secret header pair, 403 with no Location header without them).
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
name string |
name is the CloudflareAccessServiceToken’s object name, in this policy’s namespace. Bounded and pattern-checked as a DNS subdomain because that is what a Kubernetes object name is: a value failing this could never name a real object, so rejecting it at admission turns a silent InvalidParameters at reconcile time into an immediate, legible error. This is not a check that the referenced object exists – that is the reconciler’s job and cannot be expressed in CEL. |
MaxLength: 253 MinLength: 1 Pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ Required: {} |
CertStrategy
Section titled “CertStrategy”CertStrategy is reserved for DNS-mode certificate configuration (roadmap M3). Tunnel mode’s Universal SSL / ACM coverage check (ADR-008/D6’s CertificateCoverageInsufficient reason, per spike S7) runs automatically and is not configurable – there is nothing to set here for tunnel mode. Scaffolded now per ADR-004 (D2)’s field list; fields land in M3.
Appears in:
ClientSecretKeySelector
Section titled “ClientSecretKeySelector”ClientSecretKeySelector references the key of a Secret, in an explicitly-named namespace, holding an identity provider’s OAuth client secret (ADR-025 rule 6(a)).
Do not “tidy” this into SecretKeySelector (api/v1alpha1/cloudflaregatewayconfiguration_types.go).
The near-duplication is deliberate and mechanical, not stylistic: SecretKeySelector bakes
+kubebuilder:default=api-token onto its own Key field, and controller-gen has no
per-embedding override for an inner field’s marker – so embedding it here as
clientSecretRef would publish a CRD schema in which the key holding an OAuth client
secret silently defaults to a name meaning “Cloudflare API token”. That is actively
misleading to every operator and every External Secrets Operator template that later reads
the Secret, and it is irreversible once v0.3.0 is on GHCR. Collapsing the two types back
into one silently re-breaks exactly this; ADR-025’s Options considered records that
accepting the wrong default, and making the field required with no default, were both
weighed and rejected. The only difference that matters is the default key, and it cannot be
expressed at the use site.
Both types exist for the same underlying reason corev1.SecretKeySelector cannot satisfy: CloudflareAccessIdentityProvider is cluster-scoped (ADR-025 rule 2(a)), so there is no implicit namespace to resolve a bare selector against and the namespace must be explicit. Only a privileged actor can create a cluster-scoped object at all, so the boundary is “whatever namespace a cluster-admin names”, RBAC-gated by construction (ADR-025 rule 6(b)).
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
namespace string |
namespace is the namespace containing the referenced Secret. Required and never defaulted to a tenant namespace (ADR-025 rule 6(b)) – the client secret is read, sent to Cloudflare, and dropped; it is never copied into any Secret, status field, Event or log line, and nothing derived from it reaches a tenant namespace. |
MaxLength: 63 MinLength: 1 Required: {} |
|
name string |
name is the Secret’s name. | MaxLength: 253 MinLength: 1 Required: {} |
|
key string |
key is the key within the Secret’s data holding the OAuth client secret. Defaults to client-secret – NOT to SecretKeySelector’s api-token; see the type’s doc comment. |
client-secret | Optional: {} |
CloudflareAccessApplication
Section titled “CloudflareAccessApplication”CloudflareAccessApplication is the Schema for the cloudflareaccessapplications API.
It is the ADR-007 external-resource carrier for one Cloudflare Access application protecting one hostname – the object that holds the finalizer, the deletionPolicy, the status.externalID, the ownership marker and the drift-repair loop that a CloudflareAccessPolicy cannot hold itself, because one policy targeting a Gateway with three listeners produces three applications and a single Synced would have to aggregate or lie (ADR-023 rule 1).
Controller-generated and not user-creatable in spirit (ADR-018’s CloudflareGatewayStatus precedent). “In spirit” is exact, not a hedge: this project runs no admission webhook by design (ADR-003/D1), so nothing mechanically prevents a human from creating one. What the schema does instead is make every field the controller sets either structurally unrepresentable-if-wrong (no wildcard hostname, no fail-open NonIdentity rule set) or absent entirely (the five translator-emitted constants), so a hand-written or M7-authored carrier cannot express a document the policy path could not. Objects are created by the CloudflareAccessPolicy reconciler (plan Task 12) and actuated by the CloudflareAccessApplication reconciler (plan Task 13); neither exists yet.
Placement and ownership (ADR-013, ADR-023 rule 6): the carrier lands in the owning Gateway’s namespace – never the authoring policy’s or the triggering Route’s – with an ownerReference naming that Gateway, so Gateway deletion cascades. Where a Route is accepted by parent Gateways in two namespaces, the owning Gateway is the oldest by CreationTimestamp among the parents of the winner’s non-suppressed targetRefs that resolve this hostname, tie-broken alphabetically by {namespace}/{name} (ADR-023 rule 6 as amended by ADR-024). The authoring object cannot be an owner – an ownerReference cannot cross namespaces – so it is recorded as the labels cfgateway.dreamfuselabs.com/access-owner-namespace and cfgateway.dreamfuselabs.com/access-owner-name, which double as the reap selector for the policy’s cfgateway.dreamfuselabs.com/accesspolicy-cleanup finalizer and for the application controller’s orphan sweep. The labels name the authoring object, not “the policy”, because M7 authors carriers from something that is not a policy at all.
This object’s own name is a pure function of (owner namespace, owner name, hostname) (ADR-023 rule 7(c) as amended by ADR-024):
access-<readable>-<hash>where
Ownership marker: the Cloudflare application’s own name field,
cgc-name, not tags: S14 item (e) found Access tags unusable on this account
(HTTP 400 for an unregistered tag, HTTP 403 on creating or listing tags at all) while a
270-character name round-tripped unmodified. The marker is regenerated and
exact-string-compared, never parsed back apart, and it sits inside the drift-compared
subset – so dashboard tampering with the marker itself is detected, and when name is the
drifted field the application is reported DriftDetected and is neither repaired nor deleted
(ADR-023 rule 7(e)’s carve-out: re-PUTting our marker over someone else’s edit would assert
ownership of an object we can no longer prove is ours).
Adoption is refused unconditionally and there is no adopt opt-in field, unlike CloudflareTunnel and CloudflareDNSRecord (ADR-023 rule 7(d)). A pre-existing application on the hostname may belong to another cluster, another tenant or the dashboard, and S14’s A3 evidence cannot distinguish those; letting a namespace tenant opt into adopting an account-wide object on that evidence is not a risk worth taking for a convenience. An unowned application on the hostname yields Accepted=False, Reason=AdoptionRefused and nothing is written.
Finalizer: cfgateway.dreamfuselabs.com/accessapplication-cleanup (plan Task 13), which honors deletionPolicy and re-verifies the marker immediately before any Cloudflare-side delete.
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareAccessApplication |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareAccessApplicationSpec |
spec defines the desired state of CloudflareAccessApplication | Required: {} |
|
status CloudflareAccessApplicationStatus |
status defines the observed state of CloudflareAccessApplication | Optional: {} |
CloudflareAccessApplicationSpec
Section titled “CloudflareAccessApplicationSpec”CloudflareAccessApplicationSpec defines the desired state of CloudflareAccessApplication.
Every field here is controller-set, and the spec is deliberately smaller than the
Cloudflare document it produces (ADR-023 rule 1(b)). Five values this project sends are
translation-emitted constants with no schema field on either CRD: type (self_hosted),
name (the ownership marker, derived), domain (derived from hostname),
app_launcher_visible (false) and session_duration (“24h”). A constant with a writable
spec field is not a constant – this CRD is “not user-creatable in spirit” (ADR-018’s
precedent) but nothing in the schema enforces that, no webhook exists (ADR-003/D1), and
ADR-023 rule 8’s drift-soundness argument for session_duration depends on the comparison
never seeing any string but the one live-observed round-tripping byte-identically. Sourcing
all five from internal/access’s translator makes that structural rather than conventional,
and means an M7-created carrier inherits every one of them correctly by doing nothing.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
configurationRef LocalObjectReference |
configurationRef references the CloudflareGatewayConfiguration this application resolves its credential, accountID, clusterID and zoneAllowlist from (ADR-004/D2). It must resolve to a configuration whose own Accepted condition is True, or this object is rejected with Accepted=False, Reason=InvalidParameters. Every Access API call uses the account-scoped endpoint (/accounts/{account}/access/apps), never the zone-scoped one: S14 item (g) found the zone-scoped create succeeding with a token holding only the account-scoped grant, and building on an unexplained permission outcome is what the evidence rule forbids (ADR-023 rule 3). zoneAllowlist is still enforced, as an admission-time precondition checked before any call – spec.hostname must lie inside an allowlisted zone, else Accepted=False, Reason=InvalidZone and nothing is sent (ADR-009/D7). It is not a containment boundary on Cloudflare’s side; S14’s A3 could not establish one, so the isolation this project actually relies on is its own ownership marker plus unconditional adoption refusal. Mutable, and not CEL-immutable, and this is a decision rather than an omission. Repointing this at a configuration with a different accountID or clusterID changes the ownership marker (whose cgc- configuration), so the Cloudflare-side application this carrier created would no longer match its own marker and could never again be repaired or deleted by it – the CloudflareTunnel.spec.configurationRef orphaning shape M4’s API review found. The identity-bearing value lives on the referenced object, not on this one, so it is not expressible as a same-object CEL transition rule; it is closed instead with reconciler-level detect-and-fail-loud, the pattern CloudflareTunnel already uses (ErrTunnelUnresolvable -> ReasonDriftDetected), and plan Task 13 owes this CRD that check. A silent re-resolve would orphan a live Access application – which, for a security feature, leaves a hostname protected by an application nothing in the cluster can any longer manage. The non-empty check is a CEL rule rather than a MinLength because upstream corev1.LocalObjectReference defaults its own name to “” for backwards compatibility,so +required alone admits an empty reference. |
Required: {} |
|
hostname string |
hostname is the single concrete hostname this application protects. It becomes the Cloudflare application’s top-level domain, sent alone: S14’s “2b” probe isdecisive that destinations cannot be authored at create time (HTTP 400 / code 12130both standalone and alongside domain), and that the server derives destinations: [{“type”:“public”,“uri”:“ Never a wildcard, enforced by the pattern rather than left to every authoring path to remember (ADR-023 rule 2). A wildcard listener hostname produces no application of its own; it expands to the concrete hostnames Routes attached to that listener contribute, and each gets its own application. A request to a name under the wildcard with no attached Route is unrouted anyway, so nothing reachable is left unprotected – whereas S14 never tested a wildcard domain, and a security feature whose coverage is unobserved must not ship on an inference. Immutable, and this is the ADR-007 identity rule applied rather than a preference. hostname is identity-bearing three times over: it is the Cloudflare application’s domain, it is the last segment of the ownership marker (cgc- half the key this object’s own Kubernetes name is derived from (ADR-023 rule 7(c) as amended by ADR-024). Mutating it on a live carrier would have the reconciler re-PUT a different marker over the application recorded in status.externalID – claiming an object it can no longer prove is its own, which is precisely the state ADR-023 rule 7(e)’s name-drift carve-out refuses to enter – and would leave the object’s name and its spec disagreeing, so ADR-024 rule 2’s name-based carrier lookup would resolve to an object protecting some other hostname. This is the CloudflareDNSRecord.spec.zone bug class (M4’s API review, docs/api-review-m4.md), closed the same way and before a reconciler exists to be bitten by it. Costs the M6 authoring path nothing: the policy reconciler CreateOrUpdates on a name derived from the hostname, so a different hostname is always a different object. No path component: ADR-023 rule 2 defers path scoping for want of evidence (S14 exercised none), and internal/access.AccessTarget.Path is reserved-and-always-empty for the same reason. Protection is therefore hostname-wide – attaching a policy to an HTTPRoute protects every request to that hostname, including traffic served by other Routes in other namespaces. |
MaxLength: 253 MinLength: 1 Pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ Required: {} |
|
rules AccessApplicationRule array |
rules is the Cloudflare Access rule set applied to this hostname, authored inline on the application rather than as reusable account-level policies: S14 item (f) found that deleting an application does not cascade to a reusable policy, so every teardown would leak an account-level object. Array order is precedence. Copied from the authoring CloudflareAccessPolicy’s spec.rules with every symbolic reference already resolved (ADR-025 rule 8(a)) – see AccessApplicationServiceToken. MinItems=1 because an Access application with no policies is an unevidenced shape: neither S14 nor S15 created one, and whether Cloudflare’s edge then denies everyone or admits everyone is exactly the fail-open/fail-closed question a security feature must not guess at. MaxItems=16 is a defensive self-imposed bound matching the policy CRD’s. Entries must be distinct. Array order is precedence, so a rule identical to an earlier one can never fire – rejecting it cannot reject a meaningful configuration, and it catches the obvious copy-paste mistake at admission instead of creating a redundant Cloudflare policy object. Two rules differing in any way, including differing only in decision while naming the same service token, remain legal. |
MaxItems: 16 MinItems: 1 Required: {} |
|
deletionPolicy DeletionPolicy |
deletionPolicy overrides the referenced CloudflareGatewayConfiguration’s default deletionPolicy for the Cloudflare Access application this object manages (ADR-007/D5). The authoring CloudflareAccessPolicy propagates its own spec.deletionPolicy here (ADR-023 rule 8); the resolution chain is this field, then the configuration’s default, then Delete. Deliberately left human-overridable and deliberately undefaulted, matching CloudflareTunnel and CloudflareDNSRecord – which are, in practice, equally controller-generated. A +kubebuilder:default=Delete here would make the field always present and cut the configuration-level default out of its own chain, since the reconciler could no longer tell “unset, inherit” from “explicitly Delete”. Leaving it overridable also gives an operator a way to detach a live application from a controller-managed carrier during an incident without editing the authoring policy, which is the only manual lever ADR-007 offers on a machine-created object. |
Enum: [Delete Orphan] Optional: {} |
|
applicability AccessApplicability |
applicability carries the three target-shaped facts ADR-024 rule 5 rejects on, which the application reconciler cannot see from this spec and must not acquire a Gateway/Route dependency to re-derive (ADR-023 rule 9). Controller-computed; never user-authored. An absent block means “no known obstacle” – see ADR-026 rule 2 for why absent == false is the only correct encoding and what it costs. Not immutable, deliberately (ADR-026 rule 2(e)). ADR-024 rule 6’s two transitions – a live, Ready carrier becoming rejected, and a rejected one becoming eligible again – ARE this block changing on an existing object, so a self == oldSelf rule herewould make rule 6 unimplementable. The policy reconciler’s CreateOrUpdate re-asserts the block on every reconcile and it re-converges the same way rules[] does. Unlike hostname, nothing here is identity-bearing: no ownership marker, object name or externalID is derived from it, so the orphaning hazard that forces hostname’s immutability has no counterpart. Controller-computed is a convention, not an enforcement. This project runs no admission webhook by design (ADR-003/D1) and CEL cannot express “only my controller may write this”, so the guarantee is the same one configurationRef and deletionPolicy already rely on: the generating reconciler is the sole writer and re-asserts its value every reconcile, so a hand-edit is reverted rather than honored. The one caller this does not cover is ADR-023’s M7 extension path, which creates carriers with no generator in front of them: before M7 authors a carrier for a hostname that is passthrough, unproxied or gRPC-served, it must set this block itself (ADR-026 rule 2(d)) – absent reads as applicable, which is fail-open in exactly that one direction. |
Optional: {} |
CloudflareAccessApplicationStatus
Section titled “CloudflareAccessApplicationStatus”CloudflareAccessApplicationStatus defines the observed state of CloudflareAccessApplication.
Structurally identical to CloudflareDNSRecordStatus, and deliberately not ADR-018’s ancestors[] container (ADR-023 rule 1(b)). CloudflareGatewayStatus uses ancestors[] because ADR-010 forbids writing this project’s readiness onto a Gateway owned by another implementation’s class, and PolicyAncestorStatus is the Gateway-API-blessed shape for that “two controllers, one object” situation. This carrier reports on a Cloudflare resource it solely owns, with exactly one writer and no foreign controller anywhere in the picture.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
conditions Condition array |
conditions is the Accepted/Synced/Ready core every non-policy Cloudflare CRD carries (ADR-008/D6), with these referents (ADR-023 rule 1(b)): - Accepted – configurationRef resolved to an Accepted configuration, the hostname lies inside an allowlisted zone, the desired document translated without error, and no pre-existing unowned application was found on the hostname. - Synced – the last create/update against the Access API succeeded, and the marker re-verification immediately before it passed. - Ready – the application exists Cloudflare-side, externalID is set, and the most recent GET matched the desired document (no unrepaired drift). Ready=True asserts the API object exists as specified; it does not assert edge enforcement has propagated. S14 item (b) measured a consistent 2-5 second lag from the create’s HTTP 201 to the first enforced edge response, which is why ADR-024 rule 1’s publish gate waits a settle delay after Ready’s LastTransitionTime rather than releasing on Ready alone. That gate (internal/access.ClassifyCarrier, plan Task 15) reads exactly three things from this block – Ready’s status, its observedGeneration against metadata.generation, and its LastTransitionTime – plus the Accepted=False reason, so an unrecognized state classifies CarrierPending and withholds: the failure mode of an unmaintained classifier is a visibly un-published hostname rather than a silently unprotected one. Reasons used are all already in ADR-008’s frozen enum: Accepted, InvalidParameters, InvalidZone, Conflicted, AdoptionRefused, DriftDetected, CloudflareAPIError, RateLimited, Pending, and UnsupportedFeature (ADR-024 rule 5’s three applicability rejections, added to this CRD’s reason list by ADR-024’s amendment to ADR-023). |
Optional: {} |
|
externalID string |
externalID is the Cloudflare-side Access application UUID (ADR-007/D5’s .status.externalID convention – the primary link between this CR and the real resource). There is no lastAppliedVersion counterpart to CloudflareTunnelStatus’s: S14 item (a) established that Access applications carry no content-hash version field, so ADR-007’s cheap version-compare drift shortcut has no referent here and its own named fallback – full-document comparison over the project-owned subset – becomes the primary mechanism (ADR-023 rule 7(e)). updated_at is deliberately not used as a drift signal: it is timestamp- rather than content-based, and S14 explicitly flagged its behavior on a no-op re-PUT as untested. |
Optional: {} |
|
accountFingerprint string |
accountFingerprint is the first 12 hex characters of SHA-256(accountID): which Cloudflare account the application recorded in externalID actually belongs to. Set and updated by the reconciler on every successful create or repair, and absent until the first successful create. It exists because two very different situations produce a byte-identical symptom – a 404 from GetAccessApplication on the recorded externalID – and the correct reaction to them is opposite: - The application genuinely vanished (deleted in the dashboard, or by another tool) while configurationRef still resolves to the same account. The fingerprint matches, ADR-024 rule 4(c) applies, and the application is recreated. - configurationRef was repointed at a configuration naming a different accountID since the last actuation, so the recorded externalID is a perfectly live application in the account this object no longer resolves. The fingerprint does not match, and the reconciler must fail loud with Reason=DriftDetected – the detect-and-fail-loud half of spec.configurationRef’s “mutable by decision, not by omission” argument above, which is the shape M4’s API review found on CloudflareTunnel (ErrTunnelUnresolvable). Recreating here would leave the original application live and unmanaged, protecting a hostname nothing in the cluster can reach any more, while a second application appears in the new account. A stored derivation rather than a heuristic, because nothing observable distinguishes the two: Cloudflare returns the same 404 either way, and the old account’s credential is by then no longer resolvable to go look. A fingerprint rather than the accountID itself, because status is world-readable to anyone with get on this kind while the accountID is not otherwise published on a namespaced object; 12 hex characters carry the same distinguishing power for an equality check against a value this controller derives both times, and match CarrierName’s own truncation. The pattern guards a value that is always controller-derived and never operator-supplied, the same reasoning as CloudflareAccessServiceToken.status.credentialsHash: an off-shape fingerprint could only arrive from a controller bug or a hand-patched status, and it would compare unequal to every freshly-derived one, converting an ordinary recreate into a permanent fail-loud. Clearing the field (an admin patch on the status subresource) is the deliberate escape hatch from exactly that state. |
MaxLength: 12 Pattern: ^[0-9a-f]\{12\}$ Optional: {} |
CloudflareAccessIdentityProvider
Section titled “CloudflareAccessIdentityProvider”CloudflareAccessIdentityProvider is the Schema for the cloudflareaccessidentityproviders API.
It configures a Cloudflare Access identity provider – Google Workspace, GitHub, Entra ID, Okta or one-time PIN – taking the OAuth client secret from a Kubernetes Secret by reference, never from an inline field (ADR-025 rule 2).
Cluster-scoped, deliberately and irreversibly. An Access identity provider is
account-global: one a tenant deletes takes every other tenant’s login with it. A namespaced
CRD would mean any tenant with create in its own namespace could delete the account’s
Okta configuration, the outright ADR-009/D7 containment violation ADR-025 rule 2(a)
rejects. This mirrors CloudflareGatewayConfiguration’s role exactly (ADR-004/D2): a
cluster-scoped, RBAC-gated, credential-holding object only a privileged actor can create.
The asymmetry with the namespaced CloudflareAccessServiceToken is intentional – deleting a
service token breaks exactly one consumer, not the account.
The ownership marker is the Cloudflare-side name, cgc-<cluster-id-short>-idp-<object-name>
(ADR-007’s 2026-09-20 amendment, ADR-025 rule 2(b)) – regenerated and exact-string-compared,
never parsed back apart, truncated to 242 characters plus a 12-hex SHA-256 suffix only if the
untruncated string exceeds 255. A conditional hash is sufficient here, unlike the service
token’s unconditional one, because the key has a single variable component (a cluster-unique
object name on a cluster-scoped CRD) and so has no --delimited field-shifting ambiguity to
close. name is the only writable free-text field A7 observed on an identity provider;
a user-settable display name is impossible without breaking marker regeneration.
Known open question, recorded rather than discovered later: Cloudflare’s hosted login
page lists the account’s identity providers, and nobody has established whether it renders
the name field. If it does, a managed provider’s login button reads
cgc-a1b2c3d4-idp-okta. The probe is one live check in plan Task 16’s e2e run; a “yes”
makes the marker template a UX defect whose fix is a superseding ADR, not a field addition
(ADR-025 rule 2(b)).
Adoption – writing to an identity provider this project did not create – is refused
unconditionally, so there is no adopt opt-in field. The reference-only arm
(spec.existingID) is the supported way to point at a dashboard-configured provider, and it
is not adoption because it never writes.
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareAccessIdentityProvider |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareAccessIdentityProviderSpec |
spec defines the desired state of CloudflareAccessIdentityProvider | Required: {} |
|
status CloudflareAccessIdentityProviderStatus |
status defines the observed state of CloudflareAccessIdentityProvider | Optional: {} |
CloudflareAccessIdentityProviderSpec
Section titled “CloudflareAccessIdentityProviderSpec”CloudflareAccessIdentityProviderSpec defines the desired state of CloudflareAccessIdentityProvider.
It is a two-armed discriminated union (ADR-025 rule 2(c)): exactly one of spec.provider (managed – this controller creates, updates and deletes the Cloudflare object) or spec.existingID (reference-only – this controller GETs it once per resync to confirm it exists and never POSTs, PUTs or DELETEs, and writes no ownership marker).
The reference-only arm exists because brownfield accounts already have identity providers and recreating a live one changes its UUID, breaking every login in the account during the gap. It is not adoption and does not weaken ADR-023 rule 7(d)’s unconditional refusal: adoption’s hazard is clobbering an object of unknown provenance, and a path that never writes cannot clobber. The line is exactly that – reference means never writing.
The arm choice is immutable, which ADR-025 rule 2(c) specifies the union but not the mutability of. It is closed here, at first publish, because both switch directions are unrecoverable and neither is expressible any other way at the schema layer:
- managed -> reference: the managed arm already created a Cloudflare provider carrying this object’s ownership marker, and the reference arm never writes or deletes, so that provider is orphaned with no reconcile path back to it. This is precisely the class M4’s API review closed on CloudflareDNSRecord.spec.zone.
- reference -> managed: status.externalID holds a UUID this project never created, so a managed reconcile could write to a dashboard-configured provider – adoption, which ADR-025 refuses unconditionally, against the one object whose misconfiguration breaks every login in the account.
The remedy is the same one ADR-025 already prescribes elsewhere: delete and recreate, setting deletionPolicy: Orphan first if the Cloudflare-side provider should survive. Relaxing an immutability rule later is additive; adding one later rejects already-stored objects, which is why it ships now rather than after v0.3.0 publishes.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
configurationRef LocalObjectReference |
configurationRef references the CloudflareGatewayConfiguration this identity provider resolves its Cloudflare credential and accountID from (ADR-004/D2). It must resolve to a configuration whose own Accepted condition is True, or this object is rejected with Reason=InvalidParameters. Its spec.mode is deliberately not checked (ADR-025 rule 2(a)): an Access identity object is neither tunnel-mode nor DNS-mode – Access is account-level and mode-agnostic. zoneAllowlist likewise has no referent here, since an identity provider is account-scoped and has no hostname; what bounds this CRD instead is cluster scope plus RBAC. Mutable, and not CEL-immutable, deliberately – matching CloudflareTunnel.spec.configurationRef rather than CloudflareDNSRecord.spec.zone. The identity-bearing value (accountID) lives on the referenced object, not on this one, so self == oldSelf here would both over-constrain (a rename to anidentically-accounted configuration is harmless) and under-constrain (the referenced configuration’s own accountID can change underneath it). M4’s API review closed the same shape of hazard for CloudflareTunnel with reconciler-level detection instead (ErrTunnelUnresolvable -> ReasonDriftDetected), and plan Task 14 owes this CRD the same detect-and-fail-loud check: if the resolved accountID no longer matches the one status.externalID was minted under, report rather than silently orphan. The non-empty check is a CEL rule rather than a MinLength because upstream corev1.LocalObjectReference defaults its own name to “” for backwardscompatibility (“instances of this type with an empty value here are almost certainly wrong”, in its own words), so +required alone admits an empty reference. The olderCRDs in this project accept one for that reason; these two do not, since a tightening is free at first publish and impossible afterwards. |
Required: {} |
|
provider ManagedIdentityProvider |
provider is the managed arm: the five-type discriminated union this controller creates and owns Cloudflare-side. Mutually exclusive with existingID. |
Optional: {} |
|
existingID string |
existingID is the reference-only arm: the UUID of an identity provider an admin configured in the Cloudflare dashboard. The controller GETs it once per resync to confirm it exists and records status.externalID; it never writes. A UUID that does not resolve reports Accepted=False, Reason=InvalidParameters. Deleting the Kubernetes object removes the finalizer and nothing else. Mutable, and safe to be: the reference arm never created anything, so re-pointing it orphans nothing – status.externalID is fully re-derived from this field on the next reconcile. That is the property CloudflareDNSRecord.spec.zone lacked. No UUID pattern is imposed, matching AccessDevicePostureReference.ruleID’s posture: A7 observed exactly one shape without establishing that Cloudflare never accepts another. MinLength=1 is the one check that is unambiguously right. |
MaxLength: 64 MinLength: 1 Optional: {} |
|
deletionPolicy DeletionPolicy |
deletionPolicy overrides the referenced CloudflareGatewayConfiguration’s default deletionPolicy for the Cloudflare identity provider this object manages (ADR-007/D5). Rejected on the reference-only arm, where it has no referent: that arm owns nothing, so there is nothing to delete or orphan (ADR-025 rule 2(c)). |
Enum: [Delete Orphan] Optional: {} |
CloudflareAccessIdentityProviderStatus
Section titled “CloudflareAccessIdentityProviderStatus”CloudflareAccessIdentityProviderStatus defines the observed state of CloudflareAccessIdentityProvider.
Status shape is CloudflareDNSRecord’s – a top-level conditions list plus externalID – for the same reason ADR-023 rule 1(b) gives: one writer, one solely-owned external resource, no foreign controller in the picture (ADR-025 rule 2(a)). Reasons used are all already in ADR-008’s frozen enum: Accepted, InvalidParameters, Conflicted, AdoptionRefused, DriftDetected, CloudflareAPIError, RateLimited, Pending. InvalidZone has no referent here.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
conditions Condition array |
conditions is the Accepted/Synced/Ready core every non-policy Cloudflare CRD carries (ADR-008/D6). Note what Synced=True does and does not claim: A7 established Cloudflare defers credential validation to first login for all four real types, so a re-PUT whose client secret is wrong still succeeds. This controller therefore never reports “these credentials are valid”, only “this configuration was accepted” (ADR-025 rules 6(c)(6) and 9). |
Optional: {} |
|
externalID string |
externalID is the Cloudflare-side identity-provider UUID (ADR-007/D5’s .status.externalID convention). On the reference-only arm it simply echoes spec.existingID once the GET has confirmed the provider exists. |
Optional: {} |
|
credentialsHash string |
credentialsHash is the first 32 hex characters of SHA-256(metadata.uid || 0x00 || It is the only way credential rotation can be detected: A7 found a Cloudflare GET omits client_secret entirely – key absent, not redacted, not null – for all four credential-bearing types, so the current Cloudflare-side secret is unknowable and no comparison can ever detect that it drifted. A mismatch against the freshly-read Secret triggers an unconditional re-PUT of the whole config, after which the hash is updated (plan Task 14). Config drift is a separate, ordinary ADR-007 full-document comparison over the fields this project sends. Keyed on content, not the Secret’s resourceVersion: a resourceVersion changes on any metadata write (a label, an ESO refresh that rewrote identical bytes), each of which would spend an unnecessary PUT against ADR-006’s ~3 req/s budget, and a Secret restored from backup gets a new resourceVersion with identical content. metadata.uid is a salt – not itself secret, free, and it keeps the published value from being a bare digest of the credential. This is the established checksum/config idiom; it is not a substitute for RBAC on the Secret, and ADR-025 does not pretend otherwise. Clearing this field (an admin patch on the status subresource) forces the next reconcile to re-PUT. That is the deliberate escape hatch for the one case an operator will otherwise be surprised by: a client secret edited in the Cloudflare dashboard and nowhere else is undetectable and will not be repaired until the Kubernetes Secret changes (ADR-025 rule 6(c)(5)). A spec.forceSync-style knob is deliberately not added. Empty on the reference-only arm, which reads no Secret at all. |
MaxLength: 32 Pattern: ^[0-9a-f]\{32\}$ Optional: {} |
CloudflareAccessPolicy
Section titled “CloudflareAccessPolicy”CloudflareAccessPolicy is the Schema for the cloudflareaccesspolicies API.
It attaches a Cloudflare Access (Zero Trust) rule set to a Gateway, one of its listeners, an HTTPRoute or a GRPCRoute, so that the hostnames this project already publishes are authenticated at Cloudflare’s edge. It is the second consumer of this project’s GEP-713 policy-attachment engine (ADR-005/D3, ADR-021) after CloudflareTunnelPolicy, and the first that works in both tunnel and DNS mode.
The CRD carries the gateway.networking.k8s.io/policy: Direct label from day one, the declaration GEP-713-aware tooling reads; flipping it to Inherited would be the single visible signal that the semantics changed.
Namespaced deliberately, and not marked otherwise: spec.targetRefs uses Gateway API’s LocalPolicyTargetReference family, which is same-namespace by construction, so a cluster-scoped policy could not express a target at all.
This CRD authors no Cloudflare resource directly. Winning the (hostname, ACCESS) claim generates a CloudflareAccessApplication carrier in the owning Gateway’s namespace (ADR-013/ADR-023 rule 6), which is where the ADR-007 external-resource lifecycle lives. Two consequences users should know about, both stated in ADR-023 rather than discovered: protection is per-hostname, not per-path, so attaching this policy to an HTTPRoute protects every request to that route’s hostnames including traffic served by other Routes on the same hostname, in other namespaces (each such Route receives a Warning Event); and a policy that loses a hostname contest loses that targetRef outright rather than partially, reporting Accepted=False, Reason=Conflicted.
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareAccessPolicy |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareAccessPolicySpec |
spec defines the desired state of CloudflareAccessPolicy | Required: {} |
|
status CloudflareAccessPolicyStatus |
status defines the observed state of CloudflareAccessPolicy | Optional: {} |
CloudflareAccessPolicySpec
Section titled “CloudflareAccessPolicySpec”CloudflareAccessPolicySpec defines the desired state of CloudflareAccessPolicy.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
targetRefs LocalPolicyTargetReferenceWithSectionName array |
targetRefs names the objects this policy attaches to, in the policy’s own namespace (LocalPolicyTargetReference is same-namespace by construction, per ADR-005/D3). v1alpha1 accepts gateway.networking.k8s.io/Gateway, HTTPRoute and GRPCRoute (ADR-023 rule 4), with three CEL rules over them: - The kind allowlist. A CloudflareTunnel or any other infrastructure CR can never be targeted – ADR-005 excludes them, since their lifecycle is owned by the controller (ADR-007/ADR-014), not by a namespace tenant. The group half of the conjunction enforces that mechanically rather than by kind-name coincidence. TLSRoute and TCPRoute are excluded for a substantive reason, not an oversight: a TLS-passthrough listener never terminates at Cloudflare’s edge (ADR-022), so Access structurally cannot apply to it. - sectionName is permitted only on a Gateway target, where it names a listener. This is the CRD ADR-021 rule 2 unlocked sectionName for, and the one place this project’s policy surface differs from CloudflareTunnelPolicy, which rejects it outright. On a Route it would name an HTTPRouteRule, whose only Access-meaningful refinement is per-path scoping – and path scoping is deferred out of v1alpha1 for want of evidence (ADR-023 rule 2), so a Route sectionName would be accepted and then silently ignored. A sectionName naming no listener on the target Gateway is TargetNotFound at reconcile time, not a schema error (ADR-021 rule 2). - Entries must be unique on the full (group, kind, name, sectionName) tuple, which is what internal/policy’s TargetRef.Scope() keys the conflict domain on and what DesiredAncestors carries into each ancestorRef. Naming one Gateway both whole-object and listener-scoped is therefore legal and meaningful – two independent conflict domains, two distinct ancestor-status slots (ADR-021 rule 2) – while repeating either form verbatim can only produce a duplicate ancestor entry. Like CloudflareTunnelPolicy’s narrower version of this rule, it ships with the first published version because a uniqueness rule added later would reject already-stored objects. Mutable, and deliberately so: editing targetRefs changes which hostnames this policy resolves to, and therefore which CloudflareAccessApplication carriers should exist. That is not an orphaning hazard of the kind CEL immutability guards against, because ADR-023 rule 6 makes reaping an explicit, specified reconcile-path obligation – carriers whose hostname the policy no longer resolves to are deleted on the ordinary path, with an orphan sweep on the application controller’s resync as a backstop. No spec field on this CRD derives a status.externalID (this CRD has none, per rule 1(a)); carrier identity is derived from the policy’s namespace/name – immutable by Kubernetes itself – plus the hostname. |
MaxItems: 16 MinItems: 1 Required: {} |
|
rules AccessRule array |
rules is the Cloudflare Access rule set applied to every hostname this policy claims. Array order is precedence (ADR-023 rule 8). MinItems=1 because an Access application with no policies is an unevidenced shape – neither S14 nor S15 created one, and whether Cloudflare’s edge then denies everyone or admits everyone is exactly the sort of fail-open/fail-closed question a security feature must not guess at. MaxItems=16 is a defensive self-imposed bound rather than a documented Cloudflare limit, matching targetRefs; relaxing it later is additive. Entries must be distinct, on the same “ships with the first published version or never” logic as include’s uniqueness rule – but for a narrower reason, which is worth stating rather than inheriting. include’s rule is justified partly by a false-drift hazard: two identical include entries are anonymous within their array, so Cloudflare de-duplicating them on read-back is plausible and unevidenced. That half does not transfer here. Each rules[] entry becomes a separate Cloudflare policy object with its own translator-emitted name (cgc- and its own server-assigned precedence, so two identical rules are distinguishable server-side and cannot silently collapse. What does transfer is the dead-entry argument: array order is precedence, so a rule identical to an earlier one can never fire – the earlier one always matches first. Rejecting it therefore cannot reject a meaningful configuration, and it catches the obvious copy-paste authoring mistake at admission instead of creating a redundant Cloudflare policy object nobody asked for. Two rules that differ in any way – including differing only in decision while naming the same service token – remain legal, because those are genuinely distinct. |
MaxItems: 16 MinItems: 1 Required: {} |
|
deletionPolicy DeletionPolicy |
deletionPolicy overrides the resolved CloudflareGatewayConfiguration’s default deletionPolicy for every CloudflareAccessApplication this policy generates (ADR-007/D5, ADR-023 rule 8). Precedence: this field, then the configuration’s default, then Delete. It is propagated onto each generated carrier rather than acted on here: this policy owns no Cloudflare-side resource itself and calls no Cloudflare API (ADR-023 rule 1(a)). Its one finalizer, cfgateway.dreamfuselabs.com/accesspolicy-cleanup, reaps only the Kubernetes carrier objects it generated and cannot owner-reference across namespaces (ADR-023 rule 6). |
Enum: [Delete Orphan] Optional: {} |
CloudflareAccessPolicyStatus
Section titled “CloudflareAccessPolicyStatus”CloudflareAccessPolicyStatus defines the observed state of CloudflareAccessPolicy.
It is ancestors-only, with no top-level conditions field, no status.externalID and no Synced/Ready anywhere (ADR-021 rule 3, applied unchanged by ADR-023 rule 1(a)). This is worth stating explicitly because CloudflareAccessPolicy is the first CRD in this project that is simultaneously a GEP-713 policy and the author of an external Cloudflare resource, which looks like the “genuinely policy-wide fact” ADR-021 rule 3 left the door open for. It is not one: a policy targeting a Gateway with three listeners produces three Access applications, so a single top-level Synced would have to invent an aggregation rule nobody asked for or lie about at least one of them, and status.externalID would have no singular referent. The external-resource lifecycle ADR-007 mandates – finalizer, deletionPolicy, externalID, ownership marker, adoption refusal, drift repair – lives on the generated CloudflareAccessApplication carrier instead, which carries ADR-008’s full Accepted/Synced/Ready triple.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
ancestors PolicyAncestorStatus array |
ancestors reports this policy’s attachment verdict, one entry per targetRef that this controller is responsible for, keyed (ancestorRef, controllerName) per GEP-713. Each entry carries Gateway API’s single Accepted condition, with observedGeneration set from this policy’s own metadata.generation. Reasons are exactly Accepted, Conflicted, TargetNotFound and InvalidParameters – ADR-021’s policy-ancestor set verbatim; ADR-023 introduces no new Reason and does not amend ADR-008. A targetRef naming a Gateway this controller is not responsible for gets no entry at all, which is why this field is optional here where upstream’s PolicyStatus.Ancestors is required: an empty ancestors list next to a non-empty spec.targetRefs is valid, meaningful state – every ref declined – not an error. Note that “responsible for” is broader here than for CloudflareTunnelPolicy: a Gateway is Access-managed when its GatewayClass names either this project’s tunnel controller or its DNS controller (ADR-023 rule 4), since Cloudflare’s edge sits in front of both modes. |
MaxItems: 16 Optional: {} |
CloudflareAccessServiceToken
Section titled “CloudflareAccessServiceToken”CloudflareAccessServiceToken is the Schema for the cloudflareaccessservicetokens API.
It mints a Cloudflare Access service token – the machine credential a workload sends as the CF-Access-Client-Id/CF-Access-Client-Secret header pair to reach an Access-protected hostname without an interactive login – and delivers it into a Secret in this object’s own namespace (ADR-025 rule 3).
Namespaced, deliberately, and asymmetrically with the cluster-scoped CloudflareAccessIdentityProvider. A service token is a consumer credential: the workload that sends it lives in a namespace and needs the values mounted there, and a cluster-scoped owner could not own a namespaced Secret. Deleting one breaks exactly one consumer, unlike an identity provider, which would break every login in the account. The precedent is already in the tree – a namespaced CloudflareTunnel creates an account-scoped Cloudflare tunnel today (ADR-007/ADR-011) – so “account-scoped Cloudflare object, namespaced Kubernetes owner” is not a new posture. ADR-025’s Consequences classes a scope change on either CRD as a CRD replacement, not a migration.
This is the one place this project persists an Access credential, and it does so because S15’s A8(a) leaves no alternative: Cloudflare returns client_secret exactly once, in the create response, and omits it from every subsequent GET. A controller that did not store it would force a dashboard-only workflow on every consumer.
The ownership marker is the Cloudflare-side name,
cgc-<cluster-id-short>-svctoken-<readable>-<hash>, where <readable> is
<namespace>-<name> lowercased and truncated to 200 characters and <hash> is the first
12 hex characters of the SHA-256 of the /-delimited <namespace>/<name> key (ADR-007’s
2026-09-20 amendment, ADR-025 rule 3(a’)). The hash is unconditional, not an overflow
fallback: it, not the readable prefix, carries identity. Two --delimited variable
components field-shift against each other – (team-a, web) and (team, a-web) render the
same naive string – and unlike the Access-application marker nothing disambiguates before
the comparison, because a service token’s name is the account-wide-unique key
Cloudflare enforces. The collision is therefore reachable, and its symptom is an
undiagnosable cross-namespace Conflicted naming an object in a namespace the affected
tenant cannot read. Bound: 235 characters for every input.
Adoption is not merely refused here but impossible, which is why there is no adopt
opt-in field: A8(a) means an adopted token’s client_secret can never be fetched, so the
controller could never populate the Secret it must deliver.
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareAccessServiceToken |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareAccessServiceTokenSpec |
spec defines the desired state of CloudflareAccessServiceToken | Required: {} |
|
status CloudflareAccessServiceTokenStatus |
status defines the observed state of CloudflareAccessServiceToken | Optional: {} |
CloudflareAccessServiceTokenSpec
Section titled “CloudflareAccessServiceTokenSpec”CloudflareAccessServiceTokenSpec defines the desired state of CloudflareAccessServiceToken.
secretName’s immutability rule lives here, at the spec level, rather than as a
self == oldSelf on the field itself, and the difference is load-bearing rather than
stylistic: a Kubernetes CEL transition rule is not evaluated at all when the field is
absent from the old object, so a field-level rule would silently permit the one transition
that actually matters – an object created without secretName (whose Secret the reconciler
has by then written under the default name) later gaining one. Phrasing it over the spec
lets has() see both states and close unset -> set, set -> changed and set -> unset alike.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
configurationRef LocalObjectReference |
configurationRef references the CloudflareGatewayConfiguration this service token resolves its Cloudflare credential and accountID from (ADR-004/D2). It must resolve to a configuration whose own Accepted condition is True. Containment reuses ADR-009’s existing gate rather than a new one (ADR-025 rule 3(a)): this object’s namespace must satisfy the referenced configuration’s namespaceSelector, else Accepted=False, Reason=InvalidParameters and no Cloudflare call is made. A tenant whose namespace the admin has not selected cannot mint account-scoped tokens against the admin’s credential. zoneAllowlist has no referent here – a service token is account-scoped and hostname-free. Mutable, and not CEL-immutable, for the reason CloudflareAccessIdentityProvider.spec.configurationRef’s doc comment records at length: the identity-bearing accountID lives on the referenced object, so the hazard is not expressible as a same-object CEL rule and is closed with reconciler-level detect-and-fail-loud instead (CloudflareTunnel’s ErrTunnelUnresolvable -> ReasonDriftDetected precedent, M4’s API review). Plan Task 14 owes this CRD that check. The non-empty check is a CEL rule rather than a MinLength because upstream corev1.LocalObjectReference defaults its own name to “” for backwards compatibility,so +required alone admits an empty reference. |
Required: {} |
|
secretName string |
secretName is the name of the Secret this controller writes the token’s credentials into. Defaults to this object’s own name; the default is applied by the reconciler rather than by a +kubebuilder:default, because a CRD default cannot reference metadata.name. The Secret is always in this object’s own namespace and there is deliberately no namespace field (ADR-025 rule 3(b)), so a tenant cannot aim a credential write outside its own trust boundary. It carries the keys client-id and client-secret,mapping to the CF-Access-Client-Id and CF-Access-Client-Secret request headers S15’s A8(b) used live, and is owner-referenced to this CR so it is garbage-collected with it. Those key names are part of every consumer’s mount and ADR-025’s Consequences classes changing them as a breaking change. It is written exactly once, from the create response, and never rewritten on resync: A8(a) found Cloudflare returns client_secret exactly once, at create, and omits it from every later GET, so a “repair” write could only overwrite a working secret with nothing. If the Secret is deleted out of band the value is unrecoverable and the controller says so (Ready=False, Reason=DriftDetected) rather than silently minting a replacement token under consumers who did not ask for one. Before the Cloudflare call, the reconciler refuses a Secret of this name that exists and is not controller-owned by this CR (Accepted=False, Reason=Conflicted, and no token created) – checking after the call would burn an account-scoped token the controller then cannot deliver. That is a live-object check, so it is the reconciler’s (plan Task 14), not a CEL rule’s; the schema’s contribution is the structural half above, that no Secret outside this namespace is nameable at all. Immutable, enforced by the spec-level rule on this type including the unset -> set direction. The reason is a shipped-mechanism limit, not an impossibility, and saying so precisely matters: the client secret is unrecoverable from Cloudflare (A8(a)), but the controller wrote the Secret itself and status.secretName records which one, so a rename could in principle be honoured by copying. That copy is deliberately not built (ADR-025 rule 3(b) specifies a write-once Secret creation and nothing more, and nobody has asked for rename-copy), so a rename today would leave this CR pointing at a Secret name that never gets written. The remedy is the one rule 3(b) already names for a lost Secret: delete and recreate the CR, which mints a new token. |
MaxLength: 253 MinLength: 1 Pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ Optional: {} |
|
deletionPolicy DeletionPolicy |
deletionPolicy overrides the referenced CloudflareGatewayConfiguration’s default deletionPolicy for the Cloudflare service token this object manages (ADR-007/D5). Orphan is of limited practical use on this kind specifically. The Secret this controller wrote is deleted with this object regardless of this field – it is local Kubernetes state rather than the external resource deletionPolicy governs, and its owner reference would have it garbage-collected anyway – and its client secret is unrecoverable from Cloudflare afterwards (S15 A8(a)). Orphan here therefore leaves a live Cloudflare-side token whose only credential copy no longer exists, rather than the fully usable external resource Orphan leaves behind on every other CRD. |
Enum: [Delete Orphan] Optional: {} |
CloudflareAccessServiceTokenStatus
Section titled “CloudflareAccessServiceTokenStatus”CloudflareAccessServiceTokenStatus defines the observed state of CloudflareAccessServiceToken.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
conditions Condition array |
conditions is the Accepted/Synced/Ready core every non-policy Cloudflare CRD carries (ADR-008/D6). Reasons used are all already in ADR-008’s frozen enum. |
Optional: {} |
|
externalID string |
externalID is the Cloudflare-side service-token UUID (ADR-007/D5’s .status.externalID convention). This is the value a CloudflareAccessPolicy rule’s serviceToken reference resolves to and that the generated application’s service_token.token_id carries (ADR-025 rule 8(a); S15 A8(b)’s transcript). |
Optional: {} |
|
clientID string |
clientID is the token’s non-secret client ID, the <32-hex>.access shape A8(a) observed. Surfaced in status because it is not a secret and a consumer debugging a 403 needs it; its companion client secret is only ever in the Secret. |
MaxLength: 128 Optional: {} |
|
secretName string |
secretName is the Secret this controller actually wrote, always in this object’s own namespace. Reported because spec.secretName is optional and defaulted by the reconciler, so status is the only place the resolved name is legible. |
MaxLength: 253 Optional: {} |
|
expiresAt Time |
expiresAt is the token’s expiry, from the create response. Surfaced because A8(a) observed a server-injected one-year expiry nobody asked for ( duration:"8760h", an expires_at a year out) – an operator who does notknow it exists gets a 403 twelve months later with no warning. A Warning Event once a token has passed it is intended but not yet implemented as of v0.3.0: the reconciler holds no event recorder and never compares this value against the current time. ADR-025 rule 3(c) states the same intent in the present tense; it describes the same unbuilt behavior, not a second mechanism. duration is correspondingly not aspec field: it is a value this project never sends, and ADR-023 rule 8’s discipline is that an unsent value gets no field. Rotation in v1alpha1 is deliberately minimal (ADR-025 rule 3(c)): delete and recreate the CR, or run two CRs and cut consumers over. Cloudflare exposes a token-rotate endpoint but S15 did not exercise it, so no field is built on it. The failure direction is fail-closed – an expired token gets 403 – which is why deferring is acceptable. |
Optional: {} |
|
credentialsHash string |
credentialsHash is the first 32 hex characters of SHA-256(metadata.uid || 0x00 || rationale as CloudflareAccessIdentityProvider’s (ADR-025 rule 6(c)(2)). Its job on this CRD is narrower than on the identity provider, and worth stating exactly so plan Task 14 does not have to guess. There is no rotation trigger here: the credential is minted by Cloudflare and written by this controller, not supplied by an operator, so nothing on the Kubernetes side can legitimately change it. What the hash buys is tamper detection over the one credential this project persists: the controller can tell that the Secret it wrote still holds the value it wrote, without ever being able to recover that value from Cloudflare (A8(a)). A mismatch is the same unrecoverable state as the Secret having been deleted, and reports the same way – Ready=False, Reason=DriftDetected naming the Secret, with “delete and recreate the CR” as the remedy (ADR-025 rule 3(b)). It must not trigger a re-mint: that would rotate a live credential under consumers who did not ask. |
MaxLength: 32 Pattern: ^[0-9a-f]\{32\}$ Optional: {} |
CloudflareDNSRecord
Section titled “CloudflareDNSRecord”CloudflareDNSRecord is the Schema for the cloudflarednsrecords API
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareDNSRecord |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareDNSRecordSpec |
spec defines the desired state of CloudflareDNSRecord | Required: {} |
|
status CloudflareDNSRecordStatus |
status defines the observed state of CloudflareDNSRecord | Optional: {} |
CloudflareDNSRecordSpec
Section titled “CloudflareDNSRecordSpec”CloudflareDNSRecordSpec defines the desired state of CloudflareDNSRecord.
Both user-facing (a tenant creates one directly) and controller-generated (the HTTPRoute controller creates one per matched hostname, roadmap M2 Task 11, or the DNS-mode Gateway controller creates one per Gateway.status.addresses entry, roadmap M3 Task 6) – ADR-016 governs how the two interact via the cluster-wide hostname-uniqueness index (internal/hostname). recordType was CNAME-only in M2 (matching what internal/cfapi/cloudflare’s adapter implemented then); M3 adds A/AAAA for DNS mode’s LB-address records (roadmap M3 Task 2) – an additive, non-breaking enum change.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
configurationRef LocalObjectReference |
configurationRef references the CloudflareGatewayConfiguration this record resolves its credential, accountID, and zoneAllowlist from (ADR-004/D2). Must have spec.mode == tunnel or dns (this CRD is shared by both modes – a tunnel-mode routing CNAME or a DNS-mode LB A/AAAA record, roadmap M2/M3) and its own Accepted condition True, or this CloudflareDNSRecord is rejected with Reason=InvalidParameters. |
Required: {} |
|
zone string |
zone is the Cloudflare zone name this record is created in. Must be present in the referenced configuration’s zoneAllowlist (ADR-009/D7), or this record is rejected with Reason=InvalidZone. Immutable – M4’s API review found that mutating zone post-creation makes the reconciler look up the existing status.externalID against the new zone’s ID, which Cloudflare rejects as not found (the ID belongs to the old zone), permanently orphaning the record there with no reconcile path back to it. Delete and recreate instead. |
Required: {} |
|
recordType string |
recordType is the DNS record type. CNAME (routing, tunnel-mode), A, and AAAA (DNS-mode LB addresses, roadmap M3) are supported. Mutable, unlike zone above – UpdateDNSRecord rebuilds the full type-specific request body from record.Type on every reconcile and Cloudflare’s update endpoint accepts a type change on an existing record ID, so this flows through the normal update path correctly. |
CNAME | Enum: [CNAME A AAAA] Required: {} |
name string |
name is the DNS record name (hostname), e.g. “app.example.com”. | Required: {} |
|
content string |
content is the record’s target: for a tunnel-mode routing CNAME, the tunnel CNAME target ( <tunnel-id>.cfargotunnel.com, ADR-011/D9); for a DNS-mode A/AAAA record, theliteral IP address from Gateway.status.addresses (roadmap M3). Set directly by auser creating a record by hand, or computed by the generating controller. |
Required: {} |
|
proxied boolean |
proxied controls whether the record is proxied (orange-cloud) through Cloudflare’s edge. Defaults to true. A tunnel-mode routing CNAME only resolves correctly when proxied, since cfargotunnel.com is only reachable through Cloudflare’s proxy, not viaplain DNS resolution to a public IP; a DNS-mode A/AAAA record’s proxied-vs-DNS-only choice is a real per-record decision instead ( dnsDefaults.proxied, roadmap M3).No omitempty, deliberately: this field’s +kubebuilder:default (true) does not matchits Go zero value (false) – omitempty would silently drop an explicit false duringJSON marshaling (Go’s encoding/json treats the zero value as “absent” under omitempty), and the API server would substitute the default true instead. Agenerating controller can never actually request DNS-only (roadmap M3 Task 9 caught this the hard way – M2’s tunnel-mode CNAME generation only ever needed true, so thisnever manifested until DNS mode’s first false). |
true | Optional: {} |
deletionPolicy DeletionPolicy |
deletionPolicy overrides the referenced CloudflareGatewayConfiguration’s default deletionPolicy for this specific record (ADR-007/D5). |
Enum: [Delete Orphan] Optional: {} |
|
adopt boolean |
adopt is the explicit opt-in required to adopt a pre-existing Cloudflare DNS record matching this resource’s zone/name/recordType. Defaults to false – adoption is refused by default (ADR-007/D5), the same posture as CloudflareTunnel. |
false | Optional: {} |
CloudflareDNSRecordStatus
Section titled “CloudflareDNSRecordStatus”CloudflareDNSRecordStatus defines the observed state of CloudflareDNSRecord.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
conditions Condition array |
conditions is the Accepted/Synced/Ready core every Cloudflare CRD carries (ADR-008/D6). Ready mirrors Synced for this CR – a DNS record has no separate “external health” signal beyond having been written as specified, unlike a tunnel’s connector count. |
Optional: {} |
|
externalID string |
externalID is the Cloudflare-side DNS record ID (ADR-007/D5’s .status.externalIDconvention). |
Optional: {} |
CloudflareGatewayConfiguration
Section titled “CloudflareGatewayConfiguration”CloudflareGatewayConfiguration is the Schema for the cloudflaregatewayconfigurations API. It is cluster-scoped (ADR-004/D2): it carries credential references and tenancy boundaries that must not be forgeable by creating a namespaced object in a namespace a tenant doesn’t control.
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareGatewayConfiguration |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareGatewayConfigurationSpec |
spec defines the desired state of CloudflareGatewayConfiguration | Required: {} |
|
status CloudflareGatewayConfigurationStatus |
status defines the observed state of CloudflareGatewayConfiguration | Optional: {} |
CloudflareGatewayConfigurationSpec
Section titled “CloudflareGatewayConfigurationSpec”CloudflareGatewayConfigurationSpec defines the desired state of CloudflareGatewayConfiguration.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
mode ConfigurationMode |
mode declares whether this configuration is for Tunnel Mode or DNS Mode (ADR-004/D2). |
Enum: [tunnel dns] Required: {} |
|
credentialSecretRef SecretKeySelector |
credentialSecretRef references the Kubernetes Secret (and namespace) holding the Cloudflare API token that this configuration’s controller reads to authenticate. |
Required: {} |
|
accountID string |
accountID is the Cloudflare account ID this configuration acts within. | Required: {} |
|
zoneAllowlist string array |
zoneAllowlist restricts which Cloudflare zones (by name or ID) this configuration may act on – the least-privilege and rate-limit isolation boundary (ADR-009/D7). A hostname outside this list is rejected with Reason=InvalidZone. Not enforced by any M1 controller (CloudflareTunnel has no zone-scoped fields yet); exercised from M2 onward. |
Optional: {} |
|
namespaceSelector LabelSelector |
namespaceSelector restricts which namespaces may reference this configuration (ADR-009/D7). Nil (the default) means no restriction – any namespace may reference it, matching standard Kubernetes selector-field convention (unset = no filtering) and ADR-009’s framing of this as an optional least-privilege boundary, not a mandatory allowlist every configuration must opt into. |
Optional: {} |
|
clusterID string |
clusterID overrides the auto-derived cluster identifier (default: the kube-system namespace’s UID) used in every ownership marker this controller writes to Cloudflare (ADR-007/D5) – ADR-007’s exact tunnel-name and DNS-record-comment encodings both embed this value. |
Optional: {} |
|
tunnelDefaults TunnelDefaults |
tunnelDefaults carries default settings for tunnel-mode CloudflareTunnel resources referencing this configuration (ADR-011/D9). |
Optional: {} |
|
dnsDefaults DNSDefaults |
dnsDefaults carries default settings for DNS-mode resources referencing this configuration (ADR-010/D8). Reserved for M3. |
Optional: {} |
|
certStrategy CertStrategy |
certStrategy is reserved for DNS-mode certificate configuration (roadmap M3). | Optional: {} |
|
deletionPolicy DeletionPolicy |
deletionPolicy is the default Delete/Orphan policy for every external-resource CR referencing this configuration, overridable per-CR (ADR-007/D5). |
Delete | Enum: [Delete Orphan] Optional: {} |
targetRefs NamespacedPolicyTargetReference array |
targetRefs attaches this configuration to one or more Gateways (mode: dns only, ADR-020) – a kind: Gateway entry targets that Gateway directly; a kind: GatewayClass entrymakes this configuration the class-wide default for every Gateway under it. A direct match always wins over a class-wide default. Not used by mode: tunnel, which continues resolving its configuration via GatewayClass.parametersRef (ADR-004/D2) – unlike DNS mode, Tunnel Mode’s GatewayClass is owned by this project’s own controller, so that field is free to repurpose; DNS mode’s GatewayClass is owned by a companion Envoy Gateway install (ADR-010/D8), which hard-rejects any Gateway API field it inspects (including Gateway.spec.infrastructure.parametersRef, ADR-017’s original mechanism) naming a kind it doesn’t recognize – confirmed against real Envoy Gateway v1.8.2 during roadmap M3 Task 10’s live e2e run, hence this side-channel policy-attachment mechanism instead. |
Optional: {} |
CloudflareGatewayConfigurationStatus
Section titled “CloudflareGatewayConfigurationStatus”CloudflareGatewayConfigurationStatus defines the observed state of CloudflareGatewayConfiguration.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
conditions Condition array |
conditions is the Accepted/Synced/Ready core every Cloudflare CRD carries (ADR-008/D6). For CloudflareGatewayConfiguration these three are set together – there is no separate “sync a resource” or “external health” concept for a configuration object, this is the simplest CRD in the set. |
Optional: {} |
CloudflareGatewayStatus
Section titled “CloudflareGatewayStatus”CloudflareGatewayStatus is the Schema for the cloudflaregatewaystatuses API
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareGatewayStatus |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareGatewayStatusSpec |
spec defines the desired state of CloudflareGatewayStatus | Required: {} |
|
status CloudflareGatewayStatusStatus |
status defines the observed state of CloudflareGatewayStatus | Optional: {} |
CloudflareGatewayStatusSpec
Section titled “CloudflareGatewayStatusSpec”CloudflareGatewayStatusSpec defines the desired state of CloudflareGatewayStatus.
This CRD is the DNS-mode readiness carrier ADR-018 defines: a controller-managed singleton, one per watched DNS-mode Gateway, never user-created. Unlike a normal policy-attachment CRD (ADR-005/D3), it is not subject to GEP-713 conflict resolution – nothing else ever creates or competes for a given Gateway’s CloudflareGatewayStatus, since the DNS-mode Gateway controller (roadmap M3 Task 6) CreateOrUpdates it against a deterministic name (the Gateway’s own name) on every reconcile. targetRefs is still GEP-713-shaped (ADR-005) purely for consistency with every other Gateway-API-adjacent CRD in this project, always holding exactly one entry naming the owning Gateway.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
targetRefs LocalPolicyTargetReference array |
targetRefs names the Gateway this status describes – always exactly one entry (ADR-018), the same Gateway that owns this object via an ordinary owner reference (ADR-013’s auto-generated-CR precedent). |
MaxItems: 1 MinItems: 1 Required: {} |
CloudflareGatewayStatusStatus
Section titled “CloudflareGatewayStatusStatus”CloudflareGatewayStatusStatus defines the observed state of CloudflareGatewayStatus.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
ancestors PolicyAncestorStatus array |
ancestors reports readiness per ADR-010 (D8)’s mandate: DNS-mode readiness must never be written as a custom condition directly on the shared Gateway (Envoy Gateway rebuilds Gateway.status.conditions from scratch every reconcile, per spike S5). PolicyAncestorStatus is Gateway API’s own blessed mechanism for exactly this “two controllers, one object” situation (ADR-005/D3, GEP-713). Always exactly one entry (ADR-018), keyed (ancestorRef, controllerName) naming the owning Gateway and this project’s DNS-mode controllerName. Its conditions carry ADR-008 (D6)’s standard Accepted/Synced/Ready core. |
MaxItems: 1 Optional: {} |
CloudflareTunnel
Section titled “CloudflareTunnel”CloudflareTunnel is the Schema for the cloudflaretunnels API
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareTunnel |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareTunnelSpec |
spec defines the desired state of CloudflareTunnel | Required: {} |
|
status CloudflareTunnelStatus |
status defines the observed state of CloudflareTunnel | Optional: {} |
CloudflareTunnelPolicy
Section titled “CloudflareTunnelPolicy”CloudflareTunnelPolicy is the Schema for the cloudflaretunnelpolicies API.
It is the first consumer of this project’s GEP-713 policy-attachment engine (ADR-005/D3, ADR-021): a namespaced, direct attachment policy that tunes the cloudflared connector backing the Gateways it targets. The CRD carries the gateway.networking.k8s.io/policy: Direct label from day one, the declaration GEP-713-aware tooling reads; flipping it to Inherited would be the single visible signal that the semantics changed.
Namespaced deliberately, and not marked otherwise: spec.targetRefs uses Gateway API’s LocalPolicyTargetReference family, which is same-namespace by construction, so a cluster-scoped policy could not express a target at all.
| Field | Description | Default | Validation |
|---|---|---|---|
apiVersion string |
cfgateway.dreamfuselabs.com/v1alpha1 |
||
kind string |
CloudflareTunnelPolicy |
||
kind string |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
Optional: {} |
|
apiVersion string |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
Optional: {} |
|
metadata ObjectMeta |
Refer to Kubernetes API documentation for fields of metadata. |
Optional: {} |
|
spec CloudflareTunnelPolicySpec |
spec defines the desired state of CloudflareTunnelPolicy | Required: {} |
|
status CloudflareTunnelPolicyStatus |
status defines the observed state of CloudflareTunnelPolicy | Optional: {} |
CloudflareTunnelPolicySpec
Section titled “CloudflareTunnelPolicySpec”CloudflareTunnelPolicySpec defines the desired state of CloudflareTunnelPolicy.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
targetRefs LocalPolicyTargetReferenceWithSectionName array |
targetRefs names the objects this policy attaches to, in the policy’s own namespace (LocalPolicyTargetReference is same-namespace by construction, per ADR-005/D3). v1alpha1 accepts gateway.networking.k8s.io/Gateway only, whole-object. Two consequences worth stating explicitly, both CEL-enforced below: - A CloudflareTunnel can never be targeted. ADR-005 excludes infrastructure CRs from being policy targets: their lifecycle is owned by the controller (ADR-007/ADR-014), not by a namespace tenant. - sectionName is rejected. None of this policy’s fields have a coherent listener-scoped meaning – protocol and the HA settings are whole-connector properties of the cloudflared process (ADR-021 rule 2). Both restrictions are pure CEL rules over a schema that already models section scoping, so relaxing either later (M6’s CloudflareAccessPolicy attaches at listener level; HTTPRoute/GRPCRoute targeting is a plausible v1beta1 addition) is backwards-compatible and needs no schema or status-shape change. A third rule requires the entries to be distinct. Upstream BackendTLSPolicy – the only direct policy Gateway API ships – rejects two targetRefs naming the same (group, kind, name) unless sectionName distinguishes them; since the rule above forbids sectionName outright, that degenerates here to plain uniqueness. A repeated Gateway has no meaning either way: both entries key the same (ancestorRef, controllerName) ancestor-status slot, so the second can only produce a duplicate. This is a tightening, so it ships with the schema’s first published version rather than later, where it would reject already-stored objects. |
MaxItems: 16 MinItems: 1 Required: {} |
|
protocol string |
protocol selects cloudflared’s edge transport, passed through as its –protocol flag. When unset the controller passes no flag at all and cloudflared’s own default (QUIC) applies – forcing http2 cluster-wide is not free, since a tunnel on the http2 transport cannot also serve WARP-to-Tunnel UDP proxying (spike S11). The enum is exactly the two values spike S11 exercised live. auto and the legacy h2mux are deliberately excluded: adding an enum value later is additive, publishing an unverified one is not. |
Enum: [http2 quic] Optional: {} |
|
replicas integer |
replicas overrides the cloudflared Deployment’s replica count for the tunnels bound to the targeted Gateways. ADR-011 established (with spike S6 evidence) that replica count is the only HA knob worth tuning, so no HA-strategy enum exists. |
Minimum: 1 Optional: {} |
|
terminationGracePeriodSeconds integer |
terminationGracePeriodSeconds overrides the cloudflared pods’ termination grace period, giving in-flight connections longer to drain during a rollout. |
Minimum: 0 Optional: {} |
|
originRequest TunnelOriginRequest |
originRequest overrides per-ingress-rule origin behaviour for the routes attached to the targeted Gateways. |
Optional: {} |
|
autoscaling TunnelAutoscaling |
autoscaling overrides the cloudflared HorizontalPodAutoscaler settings for the tunnels bound to the targeted Gateways. It replaces tunnelDefaults.autoscaling whole, with no per-subfield merge, and while enabled replicas is ignored (ADR-032). |
Optional: {} |
CloudflareTunnelPolicyStatus
Section titled “CloudflareTunnelPolicyStatus”CloudflareTunnelPolicyStatus defines the observed state of CloudflareTunnelPolicy.
It is ancestors-only, with no top-level conditions field (ADR-021 rule 3). Every fact this policy’s status can report is inherently per-ancestor: a policy with two targetRefs can be Accepted for one Gateway and Conflicted for another, so a single top-level Accepted would have to either invent an aggregation rule or lie about one of the two. Adding a conditions field later is additive if a genuinely policy-wide fact ever appears.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
ancestors PolicyAncestorStatus array |
ancestors reports this policy’s attachment verdict, one entry per targetRef that this controller is responsible for, keyed (ancestorRef, controllerName) per GEP-713. Each entry carries Gateway API’s single Accepted condition – not ADR-008/D6’s Accepted/Synced/Ready triple, which ADR-021 rule 3 narrows for policy CRDs, since a direct-attachment policy has no Cloudflare-side resource of its own for Synced/Ready to refer to. Reasons are Accepted, Conflicted, TargetNotFound and InvalidParameters. A targetRef naming a Gateway this controller does not own gets no entry at all (upstream’s “populate ancestor status only for Ancestors you are responsible for”), which is why this field is optional here where upstream’s PolicyStatus.Ancestors is required: an empty ancestors list next to a non-empty spec.targetRefs is a valid, meaningful state – every ref declined – not an error. |
MaxItems: 16 Optional: {} |
CloudflareTunnelSpec
Section titled “CloudflareTunnelSpec”CloudflareTunnelSpec defines the desired state of CloudflareTunnel.
M1 scaffolds the bare tunnel lifecycle only (ADR roadmap “Out”: Gateway/HTTPRoute wiring, DNS records, ingress-config translation are M2). A CloudflareTunnel’s ingress config starts as just the catch-all 404 rule until M2 wires real routes in.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
configurationRef LocalObjectReference |
configurationRef references the CloudflareGatewayConfiguration this tunnel resolves its credential, accountID, and defaults from (ADR-004/D2). Must have spec.mode == tunnel and its own Accepted condition True, or this CloudflareTunnel is rejected with Reason=InvalidParameters. |
Required: {} |
|
deletionPolicy DeletionPolicy |
deletionPolicy overrides the referenced CloudflareGatewayConfiguration’s default deletionPolicy for this specific tunnel (ADR-007/D5). |
Enum: [Delete Orphan] Optional: {} |
|
adopt boolean |
adopt is the explicit opt-in required to adopt a pre-existing Cloudflare tunnel matching this resource’s derived name. Defaults to false – adoption is refused by default (ADR-007/D5): a remote-config PUT is full-replace, so adopting a hand-managed tunnel would silently clobber its existing configuration on the very first reconcile. |
false | Optional: {} |
CloudflareTunnelStatus
Section titled “CloudflareTunnelStatus”CloudflareTunnelStatus defines the observed state of CloudflareTunnel.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
conditions Condition array |
conditions is the Accepted/Synced/Ready core every Cloudflare CRD carries (ADR-008/D6): Accepted (spec is valid and admissible), Synced (last reconcile against the Cloudflare API succeeded), Ready (the tunnel has at least one active connector). |
Optional: {} |
|
externalID string |
externalID is the Cloudflare-side tunnel ID (ADR-007/D5’s .status.externalIDconvention – the primary link between this CR and the real resource). |
Optional: {} |
|
connectorCount integer |
connectorCount is the number of active edge connections reported by the Cloudflare connections API across every cloudflared replica for this tunnel. Ready=True once this is greater than zero. |
Optional: {} |
|
lastAppliedVersion integer |
lastAppliedVersion is the tunnel config version returned by the most recent successful PutIngressConfig call – the drift-detection baseline (ADR-007/D5): version is content-based (spike S2), so a mismatch against a later GetIngressConfig call means genuine drift, not merely a re-PUT of identical content. |
Optional: {} |
ConfigurationMode
Section titled “ConfigurationMode”Underlying type: string
ConfigurationMode discriminates which Gateway API mode a CloudflareGatewayConfiguration applies to (ADR-004/D2). Tunnel mode and DNS mode have different default fields and are referenced by different GatewayClass controllerNames (ADR-003/D1, ADR-010/D8).
Validation:
- Enum: [tunnel dns]
Appears in:
| Field | Description |
|---|---|
tunnel |
|
dns |
DNSDefaults
Section titled “DNSDefaults”DNSDefaults carries default settings for DNS-mode Cloudflare records (ADR-010/D8). Not consumed by any M1 controller – DNS mode is out of scope until M3 – but scaffolded now per ADR-004 (D2)’s field list.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
proxied boolean |
proxied is the default proxied (orange-cloud) vs DNS-only setting for records this controller creates in DNS mode. |
Optional: {} |
|
issuerRef TypedLocalObjectReference |
issuerRef is the default cert-manager Issuer/ClusterIssuer used to obtain certificates for DNS-mode Gateways (ADR-010/D8, roadmap M3). |
Optional: {} |
DeletionPolicy
Section titled “DeletionPolicy”Underlying type: string
DeletionPolicy controls whether an external-resource CR’s Cloudflare-side resource is deleted or left in place when the Kubernetes object is deleted (ADR-007/D5).
Validation:
- Enum: [Delete Orphan]
Appears in:
- CloudflareAccessApplicationSpec
- CloudflareAccessIdentityProviderSpec
- CloudflareAccessPolicySpec
- CloudflareAccessServiceTokenSpec
- CloudflareDNSRecordSpec
- CloudflareGatewayConfigurationSpec
- CloudflareTunnelSpec
| Field | Description |
|---|---|
Delete |
|
Orphan |
EntraIDProviderConfig
Section titled “EntraIDProviderConfig”EntraIDProviderConfig carries the one field Entra ID needs beyond
clientID/clientSecretRef, verbatim from S15 A7’s request body ("directory_id").
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
directoryID string |
directoryID is the Entra ID (Azure AD) tenant/directory UUID. No UUID pattern is imposed, matching the posture AccessDevicePostureReference.ruleID takes: A7 observed exactly one shape without establishing that Cloudflare never accepts another, and MaxLength is a defensive bound this project imposes on itself (a UUID is 36 characters). Relaxing it later is additive. |
MaxLength: 64 MinLength: 1 Required: {} |
GoogleWorkspaceProviderConfig
Section titled “GoogleWorkspaceProviderConfig”GoogleWorkspaceProviderConfig carries the one field Google Workspace needs beyond
clientID/clientSecretRef, verbatim from S15 A7’s request body ("apps_domain").
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
appsDomain string |
appsDomain is the Google Workspace domain whose users may log in, e.g. “example.com”. A plain spec field rather than a Secret key: a Workspace domain is not a secret, and burying it in a Secret would make it invisible to code review and unvalidatable by CEL for no security gain (ADR-025 rule 2(d)). |
MaxLength: 253 MinLength: 1 Required: {} |
ManagedIdentityProvider
Section titled “ManagedIdentityProvider”ManagedIdentityProvider is the managed arm of CloudflareAccessIdentityProvider’s two-armed union (ADR-025 rule 2(d)): a discriminated union over the five identity-provider types this controller creates and owns Cloudflare-side under ADR-007.
The field set for each type is taken verbatim from S15 A7’s request bodies rather than from documentation:
GoogleWorkspace -> google-apps : clientID, clientSecretRef, googleWorkspace.appsDomainGitHub -> github : clientID, clientSecretRefEntraID -> azureAD : clientID, clientSecretRef, entraID.directoryIDOkta -> okta : clientID, clientSecretRef, okta.accountURLOTP -> onetimepin : nothing at all -- `config: {}`Exactly one value per provider is secret, and it is the only one behind a reference (ADR-025 rule 2(d)). An OAuth client ID, a Workspace domain, an Entra directory ID and an Okta account URL are not secrets; a structured Secret with fixed per-type key names and a selector per field were both weighed and rejected in ADR-025’s Options considered.
Neither spec.provider.scimConfig nor Google’s directory-sync service-account JSON is exposed: A7 never sent either. Those are named rejections under ADR-023 rule 8’s extension protocol, not silent omissions.
The five CEL rules below are the discriminated union’s whole enforcement – ADR-025 rule 2(d) requires one rejection test each, and every one has one. They ship with the schema’s first published version rather than later, where a tightening would reject already-stored objects.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
type AccessIdentityProviderType |
type selects which identity provider this object configures. Immutable (ADR-025 rule 2(d)). Re-typing a live provider changes what it fundamentally is while keeping the same Cloudflare-side UUID, so every application that already permits it would silently point at something else – the same identity-derived-field hazard M4’s API review closed on CloudflareDNSRecord.spec.zone. Delete and recreate instead. ADR-025’s Consequences classes making this field mutable as a breaking change to the decision. |
Enum: [GoogleWorkspace GitHub EntraID Okta OTP] Required: {} |
|
clientID string |
clientID is the OAuth client ID Cloudflare sends to the provider. Required for every type except OTP, and forbidden for OTP, which takes no credentials at all. |
MaxLength: 512 MinLength: 1 Optional: {} |
|
clientSecretRef ClientSecretKeySelector |
clientSecretRef names the Secret key holding the OAuth client secret. Required for every type except OTP, and forbidden for OTP (ADR-025 rule 6(a)’s table). The controller reads this Secret, sends the value, and drops it: the client secret is never persisted by this project, unlike a service token’s, which A8(a) makes unfetchable and therefore mandatory to store. Rotation is driven from the Kubernetes side alone – status.credentialsHash below – because A7 established a Cloudflare GET omits client_secret entirely (key absent, not redacted), so no comparison can ever detect that the Cloudflare-side secret drifted. |
Optional: {} |
|
googleWorkspace GoogleWorkspaceProviderConfig |
googleWorkspace carries Google Workspace’s type-specific configuration. Set if and only if type is GoogleWorkspace. |
Optional: {} |
|
entraID EntraIDProviderConfig |
entraID carries Entra ID’s type-specific configuration. Set if and only if type is EntraID. |
Optional: {} |
|
okta OktaProviderConfig |
okta carries Okta’s type-specific configuration. Set if and only if type is Okta. | Optional: {} |
OktaProviderConfig
Section titled “OktaProviderConfig”OktaProviderConfig carries the one field Okta needs beyond clientID/clientSecretRef,
verbatim from S15 A7’s request body ("okta_account").
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
accountURL string |
accountURL is the Okta account URL, e.g. “https://example.okta.com”. The https:// prefix is required: A7 sent exactly that shape, and an Okta account reached over plain HTTP would carry an OAuth flow in the clear. This is a tightening, so it ships with the schema’s first published version rather than later, where it would reject already-stored objects. |
MaxLength: 253 MinLength: 9 Pattern: ^https:// Required: {} |
SecretKeySelector
Section titled “SecretKeySelector”SecretKeySelector references a key within a Secret in a specific namespace. Used instead of corev1.SecretKeySelector because CloudflareGatewayConfiguration is cluster-scoped (ADR-004/D2) and therefore has no implicit namespace to resolve a bare SecretKeySelector against – the namespace must be explicit. Only privileged actors can create a cluster-scoped CloudflareGatewayConfiguration in the first place (naturally RBAC-gated), so an explicit namespace here does not weaken the “credentials must not be namespace-forgeable by an arbitrary tenant” property this CRD exists to provide.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
namespace string |
namespace is the namespace containing the referenced Secret. | Required: {} |
|
name string |
name is the Secret’s name. | Required: {} |
|
key string |
key is the key within the Secret’s data holding the Cloudflare API token. | api-token | Optional: {} |
TunnelAutoscaling
Section titled “TunnelAutoscaling”TunnelAutoscaling configures a HorizontalPodAutoscaler for the cloudflared Deployment (ADR-032). CPU utilization is the only metric.
It is settable on both CloudflareTunnelPolicy and CloudflareGatewayConfiguration.spec.tunnelDefaults, and resolves whole: the winning level’s struct replaces the other’s, with no per-subfield merge (ADR-032 rule 2, ADR-005). While the resolved struct has enabled: true, replicas (from any level) is ignored and the HorizontalPodAutoscaler owns the replica count (ADR-032 rule 4).
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
enabled boolean |
enabled turns autoscaling on or off. Required, with no default, so that a struct holding only numbers is rejected rather than silently meaning on or off. false means “autoscaling off; use the resolved replicas”, and leaves any numbers set here inert so autoscaling can be toggled without deleting them (ADR-032 rule 1). |
Required: {} |
|
minReplicas integer |
minReplicas is the HorizontalPodAutoscaler’s lower bound, and the Deployment’s replica count when it is first created. Required, and at least 2, when enabled is true (ADR-032 rule 1). |
Optional: {} |
|
maxReplicas integer |
maxReplicas is the HorizontalPodAutoscaler’s upper bound. Required, and at least minReplicas, when enabled is true (ADR-032 rule 1). |
Optional: {} |
|
targetCPUUtilizationPercentage integer |
targetCPUUtilizationPercentage is the average CPU utilization, as a percentage of the cloudflared container’s CPU request, that the HorizontalPodAutoscaler scales to hold. CPU utilization is the only metric. Defaults to 70 (ADR-032 rule 1). |
70 | Minimum: 1 Optional: {} |
TunnelDefaults
Section titled “TunnelDefaults”TunnelDefaults carries default settings for the cloudflared Deployment a CloudflareTunnel manages. ADR-011 (D9)’s numbers are the defaults applied when these are unset.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
replicas integer |
replicas is the default cloudflared Deployment replica count. Defaults to 2 (ADR-011) – each replica independently carries cloudflared’s default HA edge connections, so tune this for redundancy, not per-replica connection count. |
Minimum: 1 Optional: {} |
|
terminationGracePeriodSeconds integer |
terminationGracePeriodSeconds is the default cloudflared pod termination grace period. Defaults to 30 (ADR-011 – validated empirically as sufficient for a zero-dropped-request rolling update at the tested load). |
Minimum: 0 Optional: {} |
|
autoscaling TunnelAutoscaling |
autoscaling is the default cloudflared HorizontalPodAutoscaler setting. A CloudflareTunnelPolicy’s autoscaling replaces it whole, with no per-subfield merge, and while the resolved value is enabled replicas is ignored (ADR-032). |
Optional: {} |
|
imagePullSecrets LocalObjectReference array |
imagePullSecrets is copied onto the pod template of every cloudflared Deployment built for a CloudflareTunnel referencing this configuration (ADR-033 rule 6). The names resolve in the pod’s namespace, which is the CloudflareTunnel’s namespace: the operator provisions the Secret in each tunnel namespace, and the controller never reads, checks or copies it (ADR-033 rules 7-8). A missing or invalid Secret surfaces as the new pod’s ImagePullBackOff. On a tunnel that is already running the rollout stalls while the old pods keep serving, so the tunnel’s Ready condition and connector count do not change: check the Deployment’s rollout instead (ADR-033 rule 9 and its amendment). Set here only; CloudflareTunnelPolicy has no equivalent. |
Optional: {} |
TunnelOriginRequest
Section titled “TunnelOriginRequest”TunnelOriginRequest is the CRD-side subset of cloudflared’s per-ingress-rule originRequest block (ADR-021 rule 6). It mirrors internal/cfapi.OriginRequest field-for-field but is deliberately a separate Go type: ADR-006/D4’s boundary keeps the published API type and the Cloudflare-facing domain type independent, translated by a pure function, so either side can gain a field without a lockstep change to the other.
Every field is a pointer because Cloudflare’s GET returns only the keys that were set – a plain bool would make “absent” and “false” indistinguishable and produce a false DriftDetected on every resync.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
http2Origin boolean |
http2Origin makes cloudflared speak HTTP/2 to the origin rather than HTTP/1.1. Spike S11 established this is required (together with noTLSVerify and a connector on protocol: http2) for gRPC to traverse a Cloudflare Tunnel. |
Optional: {} |
|
noTLSVerify boolean |
noTLSVerify disables origin certificate verification for the rules this policy covers. Required by spike S11’s working gRPC configuration, which reaches the origin over https:// with a self-signed certificate. |
Optional: {} |
TunnelSettings
Section titled “TunnelSettings”TunnelSettings holds every settable CloudflareTunnelPolicy field.
It is a named struct embedded with json:“,inline” rather than a set of fields declared
directly on the spec, per ADR-021 rule 5: the generated OpenAPI is flat today (correct for
a GEP-713 direct policy, which puts its fields at the top level of spec), and if ADR-005’s
reserved inherited-policy extension is ever taken up, defaults/overrides blocks can
reuse this identical schema with no field duplication in either the Go types or the CRD.
Do not flatten these fields onto CloudflareTunnelPolicySpec.
Precedence when a field is set here and also in CloudflareGatewayConfiguration.spec.tunnelDefaults (ADR-021 rule 4): this policy wins, then tunnelDefaults, then ADR-011’s hard default. Overlap is allowed by design – forbidding it would make a cluster-scoped default unrefinable per Gateway.
Appears in:
| Field | Description | Default | Validation |
|---|---|---|---|
protocol string |
protocol selects cloudflared’s edge transport, passed through as its –protocol flag. When unset the controller passes no flag at all and cloudflared’s own default (QUIC) applies – forcing http2 cluster-wide is not free, since a tunnel on the http2 transport cannot also serve WARP-to-Tunnel UDP proxying (spike S11). The enum is exactly the two values spike S11 exercised live. auto and the legacy h2mux are deliberately excluded: adding an enum value later is additive, publishing an unverified one is not. |
Enum: [http2 quic] Optional: {} |
|
replicas integer |
replicas overrides the cloudflared Deployment’s replica count for the tunnels bound to the targeted Gateways. ADR-011 established (with spike S6 evidence) that replica count is the only HA knob worth tuning, so no HA-strategy enum exists. |
Minimum: 1 Optional: {} |
|
terminationGracePeriodSeconds integer |
terminationGracePeriodSeconds overrides the cloudflared pods’ termination grace period, giving in-flight connections longer to drain during a rollout. |
Minimum: 0 Optional: {} |
|
originRequest TunnelOriginRequest |
originRequest overrides per-ingress-rule origin behaviour for the routes attached to the targeted Gateways. |
Optional: {} |
|
autoscaling TunnelAutoscaling |
autoscaling overrides the cloudflared HorizontalPodAutoscaler settings for the tunnels bound to the targeted Gateways. It replaces tunnelDefaults.autoscaling whole, with no per-subfield merge, and while enabled replicas is ignored (ADR-032). |
Optional: {} |