Status and Conditions
Every Cloudflare-side resource this project manages reports its state through Kubernetes conditions — a small, fixed vocabulary repeated identically across every CRD, rather than each resource inventing its own status shape.
Why three conditions, not one
Section titled “Why three conditions, not one”A single Ready flag can’t distinguish “your spec is wrong” from “your spec is fine but the
last write to Cloudflare failed” from “the write succeeded but what it produced looks
unhealthy” — three genuinely different problems with three different fixes. So most of this
project’s Cloudflare-side resources report three independent conditions instead. (The
exception is the policy-attachment CRDs, CloudflareTunnelPolicy and CloudflareAccessPolicy
— a policy has no Cloudflare-side resource of its own to sync or check health on, so they
carry Accepted only; see Conditions
for the full breakdown.)
- Accepted — is the spec itself valid and admissible?
- Synced — did the last reconcile against the Cloudflare API succeed?
- Ready — is the resulting Cloudflare-side resource actually healthy?
Accepted=True, Synced=True, Ready=False is a real state you’ll see in practice: the
resource was written successfully, but what got written isn’t serving correctly yet (a
tunnel with no active connectors, a certificate still issuing). Collapsing that into one
Ready=False would throw away the distinction between “haven’t tried yet,” “tried and
failed,” and “there, but unhealthy.”
See Conditions for the full Reason vocabulary behind these three condition types.
Gateway API types keep their own conditions
Section titled “Gateway API types keep their own conditions”Gateway, HTTPRoute, GRPCRoute, and the rest of the Gateway API object set carry only
Gateway API’s own standard conditions (Accepted, Programmed, ResolvedRefs, and so on).
This project never adds a custom condition onto one of those types — it either writes those
standard conditions itself, or doesn’t write to that object’s status at all, depending on
mode.
Gateway.status is this project’s own: the controller that watches a Tunnel-mode Gateway
writes its Accepted and Programmed conditions directly, and status.addresses carries
the Cloudflare-generated hostname your traffic actually reaches. kubectl get gateway is a
complete readiness picture on its own.
Gateway.status belongs entirely to Envoy Gateway. This project reads it — to know which
addresses to turn into DNS records — but never writes to it: a separate Envoy Gateway
installation owns that Gateway and rebuilds its status.conditions from scratch on every
reconcile of its own, so writing anything else there would just get silently overwritten.
Because of that, kubectl get gateway alone doesn’t tell you whether this project’s side
of DNS mode is healthy — the Cloudflare-side DNS records and certificates it manages for that
Gateway could still be failing even while Envoy Gateway reports the Gateway itself as
Programmed. This project’s own readiness signal for DNS mode instead lives on an
auto-created CloudflareGatewayStatus object: one per DNS-mode Gateway, named identically
to it, created and owned by this project the moment it starts watching that Gateway. It
carries the same Accepted/Synced/Ready core as every other resource this project owns,
nested inside status.ancestors[0].conditions rather than a top-level status.conditions
(see Policy and ancestor status for
why). Check it alongside the Gateway itself, not instead of it.
observedGeneration
Section titled “observedGeneration”Every condition this project writes carries observedGeneration, set to the object’s
metadata.generation at the time the condition was computed. Compare it against the
object’s current metadata.generation to tell whether a condition reflects your latest edit
or a stale one from before it: if observedGeneration is behind generation, the controller
hasn’t reconciled your latest change yet, and the condition you’re looking at predates it.
One exception: CloudflareAccessApplication’s Ready condition is deliberately left
untouched (not re-asserted) on a transient Cloudflare API failure, so a real reconcile can
happen — bumping Accepted/Synced’s observedGeneration — while Ready’s
observedGeneration stays behind. Don’t read a lagging Ready.observedGeneration on that
kind as proof the controller hasn’t reconciled at all; check Accepted/Synced too.
Reading a failing object
Section titled “Reading a failing object”Start with a plain kubectl get, which surfaces Ready (or Accepted, for policy CRDs) via
a print column on most of this project’s CRDs:
kubectl get cloudflaretunnel my-tunnelFor the Reason and message behind that status, go through status.conditions directly:
kubectl get cloudflaretunnel my-tunnel \ -o jsonpath='{.status.conditions[?(@.type=="Ready")]}'For CloudflareGatewayStatus, the same condition lives one level deeper, inside its single
ancestors[] entry:
kubectl get cloudflaregatewaystatus my-gateway \ -o jsonpath='{.status.ancestors[0].conditions[?(@.type=="Ready")]}'A policy CRD (CloudflareTunnelPolicy, CloudflareAccessPolicy) instead carries one
ancestors[] entry per object it attaches to, each with an Accepted condition only — read
the specific entry for the target you care about rather than a single fixed index.
kubectl describe surfaces Kubernetes Events, but most kinds don’t emit one on a condition
transition — CloudflareTunnel (used in the example above) is one of them. Today only
CloudflareTunnelPolicy and CloudflareAccessPolicy emit a Warning/Normal Event on every
transition of their ancestor Accepted condition; a few other kinds emit Events for specific
named situations, not as a general condition-transition mechanism. See
Events for the fuller list, including the Event reasons
that aren’t tied to a condition transition at all.
Conditions has the full Reason-by-Reason reference: what each one means, and what to do about it.