discover extraobjects#212
Merged
Merged
Conversation
Signed-off-by: Daniel Guns <danbguns@gmail.com>
bradpenney
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #197
Why
The Flux ecosystem no longer ends at the core reconciler kinds. The Flux Operator ships ResourceSets, source-watcher produces ExternalArtifacts behind the RFC-0012 feature gate, and controllers like tf-controller extend clusters with their own Flux-adjacent CRDs. A Flux dashboard that only knows a closed enum of kinds goes blind exactly where clusters are heading.
The question was how to support extra kinds without making users maintain config lists of GVKs. Upstream already answered it: the Flux Operator's FluxReport discovers which reconciler CRDs exist on a cluster by reading the
app.kubernetes.io/part-of=<instance>label on CustomResourceDefinitions (internal/reporter/crds.go) — the FluxInstance labels the CRDs it manages, and anything else carrying the label is declared part of the Flux instance. flux9s now follows the exact same convention: one boolean opt-in, and the cluster itself says what to show. Staying on upstream's convention means zero per-kind config, and whatever the operator considers part of Flux, flux9s does too.Discovered kinds are deliberately view-only. Flux's runtime conventions (
spec.suspend, thereconcile.fluxcd.io/requestedAtannotation) are what would make suspend/resume/reconcile safe on arbitrary kinds, and RFC-0012 explicitly keeps arbitrary CRs as sourceRefs out of scope for now — so operations stay gated on the built-inFluxResourceKindenum until there's an upstream contract to lean on (tracked with the Flux v2.10 roadmap items in #198).What
Opt-in flag —
discoverFluxResources: falseby default. Off means no CRD watch, no extra API calls, no UI change whatsoever.Dynamic discovery (
src/models/extra_kinds.rs,src/watcher/mod.rs) — a CRD watcher with theapp.kubernetes.io/part-of=fluxlabel selector feeds a process-wideExtraKindRegistry. Each discovered kind gets aDynamicObjectwatcher; resources land in the unified list with generic columns (readiness from standardstatus.conditions). Labeling/unlabeling a CRD adds/removes the kind live — no restart.Guard rails, in the order they bit during development:
part-of=<instance>, so without this every Kustomization would be double-watched.Delete/Reconcilehadis_valid_for → truefor all kinds (pre-existing, latent); both are now gated onFluxResourceKind, and a zero-impact test proves discovered kinds get no operations.UX —
:commands from the CRD's own names (kind, plural, shortNames — e.g.:widget/:widgets/:wd), Tab autocomplete,y/ddescribe/yaml via GVK resolution, and a help entry that only renders while kinds are actually registered.Lifecycle correctness — the registry is cleared in
ResourceWatcher::stop(), so discovered kinds can't leak across context switches (caught in manual testing::wdfollowed me from the kind cluster back to a cluster with no Widget CRD). Re-discovery on the new watcher repopulates from whatever that cluster actually has.config listmade schema-driven — the new flag exposed that the listing was hand-maintained and silently incomplete. It's now derived from serde against aConfig::fully_populated()skeleton: every field always shows with a# (default)marker, adding a schema field without updating the reference docs is a compile error + failing test, andconfig getresolves any field through a serialized-config fallback.Testing
just cigreen (fmt, clippy-D warnings, audit, 690+ unit/integration tests).labeled_crd_discovers_and_lists_instances(7/7 live suite passing) against a real labeled CRD fixture:scripts/dev-manifests/simple/00-discovered-crd.yaml+ two Widget CRs (oneReady=True, oneReady=False) on theflux9s-simplekind cluster — also exercised weekly by the live-tests workflow.kind-flux9s-simpleand a real cluster.🤖 Generated with Claude Code