Skip to content

Latest commit

 

History

History

platform

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

platform

A Crossplane v2 Configuration that wraps the bootstrap building-block Configurations behind a single namespaced Platform XR (group config.stuttgart-things.com).

The Composition is a function-kcl step that composes one child XR per enabled component — today a Cni (the cni Configuration, opt-in) and a FluxInit (the flux-init Configuration), with further Configurations to follow. The wrapped Configurations stay independently usable; platform supplies the shared inputs and aggregates the results.

Why

Without it, every bootstrap Configuration on a cluster restates the same cluster identity, and there is no single object that answers "is this cluster's platform up, and what was it given?". Platform states that once and publishes it back.

What gets created

A Platform composes child XRs, not managed resources — the managed resources below are emitted one level deeper, by the wrapped Configuration's own Composition. platform itself never talks to a target cluster.

flowchart TD
    P["Platform<br/>the XR you apply"]
    C["Cni<br/>{platform}-cni<br/>opt-in; gates the rest"]
    F["FluxInit<br/>{platform}-flux-init"]

    CRC["Object: RemoteCluster<br/>...-observe-rc<br/>Observe only, gates the install"]
    CR["Release<br/>...-cilium<br/>CNI Helm chart"]

    RC["Object: RemoteCluster<br/>...-observe-rc<br/>Observe only, gates the install"]
    R["Release<br/>...-flux-operator<br/>flux-operator Helm chart"]
    I["Object: FluxInstance<br/>...-flux-instance<br/>installs Flux itself"]
    U["Usage<br/>...-flux-instance-uses-operator<br/>teardown ordering"]
    S["Object: OCIRepository / GitRepository<br/>...-source-{name}"]
    SA["Object: Secret<br/>...-sops-age<br/>age decryption key"]

    P -.->|"only if spec.cni.enabled"| C
    C -.->|"only if spec.clusterName"| CRC
    C --> CR
    C ==>|"held until status.ready"| F
    P -->|"composes, per enabled component"| F
    F -.->|"only if spec.clusterName"| RC
    RC -.->|"unblocks once clusterType resolves"| R
    F --> R
    F --> I
    F --> U
    F -.->|"per instance.sources entry"| S
    F -.->|"only if sops.enabled"| SA
    R ==>|"crossplane.io/uses"| I
    I ==>|"crossplane.io/uses"| S

    classDef xr fill:#e8f0fe,stroke:#4285f4,color:#000
    classDef mr fill:#f1f3f4,stroke:#9aa0a6,color:#000
    classDef opt fill:#ffffff,stroke:#9aa0a6,stroke-dasharray:4 3,color:#000
    class P,C,F xr
    class R,I,U,CR mr
    class RC,S,SA,CRC opt
Loading

Blue is an XR (Crossplane composes it further), grey a managed resource, dashed-white conditional. Double arrows are ordering (crossplane.io/uses): operator → instance → sources.

Depth Resource Name Emitted by When
0 Platform yours you —
1 Cni {platform}-cni platform spec.cni.enabled (default false)
2 kubernetes.m…/Object → RemoteCluster {platform}-cni-observe-rc cni only with spec.clusterName
2 helm.m…/Release {platform}-cni-cilium cni once the gate opens
1 FluxInit {platform}-flux-init platform spec.fluxInit.enabled (default true)
2 kubernetes.m…/Object → RemoteCluster {platform}-flux-init-observe-rc flux-init only with spec.clusterName
2 helm.m…/Release {platform}-flux-init-flux-operator flux-init always
2 kubernetes.m…/Object → FluxInstance {platform}-flux-init-flux-instance flux-init always
2 protection…/Usage {platform}-flux-init-flux-instance-uses-operator flux-init always
2 kubernetes.m…/Object → OCIRepository/GitRepository {platform}-flux-init-source-{source} flux-init per sources entry
2 kubernetes.m…/Object → Secret {platform}-flux-init-sops-age flux-init sops.enabled + a key source

So a minimal Platform (no sources, no SOPS, no clusterName) composes four objects — the FluxInit child, and a Release, an Object and a Usage beneath it:

$ crossplane resource trace platform kind1 -n crossplane-system
NAME                                                       SYNCED   READY   STATUS
Platform/kind1 (crossplane-system)                         True     True    Available
└─ FluxInit/kind1-flux-init (crossplane-system)            True     True    Available
   ├─ Release/kind1-flux-init-flux-operator                True     True    Available
   ├─ Object/kind1-flux-init-flux-instance                 True     True    Available
   └─ Usage/kind1-flux-init-flux-instance-uses-operator    -        True    Available

With one app enabled (apps: {dapr: {}}), verified on kind1 2026-07-18 — note the source Object and the app Object both come from that single toggle:

$ crossplane resource trace platform kind1 -n crossplane-system
NAME                                                                          SYNCED   READY   STATUS
Platform/kind1 (crossplane-system)                                            True     True    Available
├─ FluxApps/kind1-flux-apps (crossplane-system)                               True     True    Available
│  └─ Object/kind1-flux-apps-app-dapr-control-plane (crossplane-system)       True     True    Available
└─ FluxInit/kind1-flux-init (crossplane-system)                               True     True    Available
   ├─ Release/kind1-flux-init-flux-operator (crossplane-system)               True     True    Available
   ├─ Object/kind1-flux-init-flux-instance (crossplane-system)                True     True    Available
   ├─ Object/kind1-flux-init-source-dapr (crossplane-system)                  True     True    Available
   └─ Usage/kind1-flux-init-flux-instance-uses-operator (crossplane-system)   -        True    Available

Teardown ordering

Delete the Platform and Crossplane removes the children in parallel, which can race: if the FluxInstance goes before the source Objects, Flux's CRDs are gone and provider-kubernetes can no longer observe an OCIRepository to finalize it, so those Objects hang on finalizer.managedresource.crossplane.io with

observe failed: cannot get object: no matches for kind "OCIRepository" in version "source.toolkit.fluxcd.io/v1"

Fixed in flux-init v0.3.0 (xplane-flux-init 0.3.0), which emits a Usage per source so teardown is ordered source → instance → operator. The note below applies to clusters still running flux-init < v0.3.0.

Clear a stuck Object with kubectl patch object.kubernetes.m.crossplane.io <name> -n <ns> --type=merge -p '{"metadata":{"finalizers":[]}}' — the underlying resource is already gone with the CRD. When tearing down by hand, delete FluxApps first (so Kustomizations prune while Flux still runs), then FluxInit.

On the target cluster that becomes the flux-operator Deployment plus the Flux controllers the FluxInstance installs.

Versions

What Version Where it comes from
platform Configuration v0.7.2 crossplane.yaml
xplane-platform KCL module 0.24.0 apis/composition.yaml (OCI, pulled at render time)
xplane-flux-catalog KCL module 0.16.0 dependency of xplane-platform — the app definitions
Crossplane >=v2.1.3 crossplane.yaml
cni Configuration >=v0.1.0 dependsOn — pulled automatically
xplane-cni KCL module 0.1.0 cni's Composition (OCI, pulled at render time)
flux-init Configuration >=v0.3.0 dependsOn — pulled automatically
xplane-flux-init KCL module 0.3.0 flux-init's Composition (OCI, pulled at render time)
flux-apps Configuration >=v0.1.2 dependsOn — pulled automatically
xplane-flux-apps KCL module 0.3.0 flux-apps' Composition (OCI, pulled at render time)
provider-helm >=v1.0.0,<v2.0.0 dependsOn
provider-kubernetes >=v1.2.0,<v2.0.0 dependsOn
function-kcl >=v0.12.0,<v0.13.0 dependsOn
function-environment-configs >=v0.7.0,<v0.8.0 dependsOn
function-auto-ready >=v0.6.5,<v0.7.0 dependsOn — not v0.7.x
flux-operator chart 0.55.0 flux-defaults EnvironmentConfig · override with spec.fluxInit.operatorChart.version
Flux distribution 2.x flux-defaults EnvironmentConfig · override with spec.fluxInit.instance.distribution

The two bottom rows are the only versions an XR normally sets; everything else is a package pin. >=v0.2.0 on flux-init is a floor, not a cap — clusterName targeting needs it.

The shared contract

status.shared is the point of this Configuration. The cluster identity is stated once on spec, resolved by the Composition, injected into every child XR, and published on status.shared:

Field Source
clusterName spec.clusterName
helmProviderConfigRef spec.helmProviderConfigRef, else derived {clusterName}-helm
kubernetesProviderConfigRef spec.kubernetesProviderConfigRef, else derived {clusterName}-kubernetes
observeProviderConfigRef spec.observeProviderConfigRef (default in-cluster)
namespace spec.namespace (default flux-system)
clusterType discovered — lifted up from the FluxInit child, which reads it off the target RemoteCluster

clusterType is the shape that matters as components are added: a fact discovered by one child, published once, consumed by the next — instead of each component re-observing the RemoteCluster itself.

Fields that have not resolved are omitted, not published as "" — clusterName on the explicit-refs path, and clusterType until the FluxInit child has observed the RemoteCluster (which it only does when clusterName is set). So if status.shared.clusterType is a safe test for "discovered", and a consumer never reads a value that was never resolved.

status.components carries per-component readiness and outputs; status.ready is true when every enabled component is Ready (vacuously true when none are enabled, matching what function-auto-ready reports on the Ready condition).

status:
  shared:
    clusterName: staging
    helmProviderConfigRef: staging-helm
    kubernetesProviderConfigRef: staging-kubernetes
    observeProviderConfigRef: in-cluster
    namespace: flux-system
    clusterType: k3s
  components:
    fluxInit:
      enabled: true
      ready: true
      operatorReady: true
      instanceReady: true
      sourcesReady: true
      sourceCount: 1
    fluxApps:
      enabled: true
      ready: true
      appCount: 1
      readyCount: 1
  componentCount: 2
  readyComponents: 2
  ready: true

Usage

One clusterName is the whole shared contract — the provider config refs derive from it and every component inherits it:

apiVersion: config.stuttgart-things.com/v1alpha1
kind: Platform
metadata:
  name: staging
  namespace: crossplane-system
spec:
  clusterName: staging
  fluxInit:
    enabled: true
    instance:
      sources:
        - name: fleet-infra
          kind: OCIRepository
          url: oci://ghcr.io/stuttgart-things/fleet-infra
          ref: latest
          path: clusters/staging

See examples/: xr-min.yaml (defaults only), xr.yaml (the copy-paste template), xr-max.yaml (every field), xr-blank-cluster.yaml (a cluster with no CNI yet).

Components

Component spec block Child XR Configuration
Networking spec.cni Cni cni
Flux bootstrap spec.fluxInit FluxInit flux-init
Apps spec.apps FluxApps flux-apps

Each component block mirrors the child XR's own spec (minus the shared identity, which is injected) and is passed through verbatim — operatorChart, instance, kustomize and sops all reach FluxInit unchanged. enabled: false omits the child entirely.

Networking is the exception, twice over

spec.cni defaults to enabled: false — the inverse of every other component. Most clusters already have a CNI, and installing a second one breaks them. It exists for clusters provisioned deliberately blank: this fleet's ansible-built kind clusters, which come up with NotReady nodes on purpose so the platform can own networking (see examples/xr-blank-cluster.yaml).

When it is enabled, it gates the other children. A cluster with no CNI schedules nothing, and a Helm install aimed at it does not fail fast — it times out and retries, which merely looks broken for several minutes. So FluxInit and FluxApps are not emitted until the Cni child reports ready.

A protection.crossplane.io Usage cannot express this. Usage orders deletion — it blocks removal of the of resource while the by exists — and has no effect on creation. Creation ordering has to be a render gate.

The gate is one-way: once a child exists it keeps being emitted even if the CNI blips not-Ready during a chart upgrade. Not emitting an existing child is what makes Crossplane delete it, so a re-closing gate would tear Flux down over a transient. The gate is about install ordering, not continuous dependency enforcement.

spec.cni.namespace is deliberately not wired to spec.namespace: that one is the Flux namespace, and a CNI belongs in kube-system (which the cni Configuration defaults to).

Apps

spec.apps is the reason the umbrella earns its keep. stuttgart-things/flux publishes one OCI artifact per app, so a Flux source name and an app are the same fact — deploying one by hand means adding an OCIRepository to a FluxInit and referencing it by name in a FluxApps, two objects joined by a string nothing validates until a Kustomization stalls.

Naming an app emits both:

spec:
  clusterName: kind1
  apps:
    dapr:
      components:
        template-execution:
          # needs GITHUB_TOKEN / BACKSTAGE_AUTH_TOKEN / REDIS_PASSWORD — point at
          # a Secret as here, or set `enabled: false`. Without one of the two the
          # XR is rejected, because Flux would substitute empty strings.
          substituteFrom:
            - kind: Secret
              name: dapr-backstage-template-execution-vars
Emitted on What
FluxInit child instance.sources: [{name: dapr, kind: OCIRepository, url: oci://…/flux/apps/dapr, ref: v1.18.1}]
FluxApps child dapr-control-plane + dapr-template-execution, each sourceRef: {kind: OCIRepository, name: dapr}, with dependsOn rewritten to the emitted names and timeout: 15m on the chart-installing one

App definitions come from the xplane-flux-catalog KCL module, which holds structural facts only — artifact URL, component paths, ordering, timeouts. Substitution values are environment-specific and belong on the XR (below), not in the catalog, which would otherwise drift from each app's README in stuttgart-things/flux.

Catalogued as of xplane-platform 0.21.0 (catalog 0.17.0). stuttgart-things/flux publishes apps/, infra/ and — since flux#196 widened the release workflow's find — cicd/, which is what made tekton catalogable at all; the rest of cicd/ (argo-cd, crossplane, komoplane, kro, …) is publishable now but not yet catalogued. These are the ones a Platform can name:

app needs note
cert-manager nothing selfsigned and approle-issuer are opt-in components
trust-manager cert-manager:install the catalog's only cross-artifact dependency — and it is one because the artifact really does need cert-manager's CRDs, not because the project is associated with it
openebs nothing the one entry that is complete as openebs: {enabled: true}
cilium CILIUM_GATEWAY_TLS_SECRET config-only (component config, not install); the other three required variables are discovered — see below
headlamp HOSTNAME, GATEWAY_NAME DOMAIN is discovered; needs a Gateway that already exists on the target
machinery GATEWAY_NAME DOMAIN is discovered. The service that watches Crossplane resources — not the bootstrap play of the same name
dapr a Secret for template-execution or disable that component
external-secrets nothing for install cluster-store-vault is opt-in, needs an eso entry in vaultIssuer.additionalAuths, and requires five variables the artifact defaults — every default names a different deployment, so a store taking them looks configured and reaches the wrong Vault. Two are discovered from that auth; three are decisions
nfs-csi NFS_SERVER_FQDN, NFS_SHARE_PATH facts about the network, not the cluster — nothing can discover them
sops-secrets-operator nothing turns an age-encrypted SopsSecret in git into a Secret. No cert-manager, despite upstream: this is stuttgart-things/sops-secrets-operator (group sops.stuttgart-things.com), whose artifact installs CRDs, RBAC and a Deployment and no webhook. How the age key reaches the cluster is deliberately not part of the app
tekton nothing for install dashboard is opt-in and needs TEKTON_DASHBOARD_HOSTNAME + GATEWAY_NAME; its domain is discovered
vault ISSUER_KIND, ISSUER_NAME, VAULT_INGRESS_HOSTNAME a Vault on this cluster, not the fleet's. VAULT_INGRESS_DOMAIN is discovered; httproute and autounseal are opt-in

machinery costs a single typed value. It used to demand a version too, because the artifact's own default was wrong (1.13.4 against published tags of v1.13.4, so the OCIRepository never resolved and the failure did not name the version as the cause). flux#193 fixed that and made the artifact ship its watch set as a file, so enabling the app is now enough — before, the service came up watching StoragePlatform and NetworkIntegration, a dashboard but not this fleet's.

Values marked discovered come from substitutionSources on the catalog Component: the module reads them out of this XR's own status.components and only when the XR does not state them. An explicit value on the XR always wins. That is why cilium's pool addresses and gateway domain, and headlamp's and machinery's DOMAIN, no longer appear on the XRs in this repo — they would only drift from the reservation that produced them.

openebs pins the flux artifact at v1.19.1 for a reason. The artifact pins the openebs chart separately as OPENEBS_VERSION (default 4.2.0), and the chart changes shape at 4.5: loki and alloy become dependencies, both defaulting to true, and localpv-provisioner — the thing behind openebs-hostpath — becomes conditional. Before flux#192 the artifact had no keys to turn any of that off, so raising OPENEBS_VERSION from an XR would have silently added a Loki StatefulSet, the MinIO StatefulSet backing it and an Alloy DaemonSet. Do not pin an older artifact tag.

Certificates from the vault issuer need a commonName

The fleet's PKI role (pki/sign/sthings-vsphere on vault.infra.sthings-vsphere) requires a common name. A Certificate against the vaultIssuer ClusterIssuer that sets only dnsNames fails at signing time, while the issuer itself stays Ready, because Ready only proves the Kubernetes-auth login:

Vault failed to sign certificate: ... POST .../v1/pki/sign/sthings-vsphere
Code: 400. Errors:
* the common_name field is required, or must be provided in a CSR with
  "use_csr_common_name" set to true, unless "require_cn" is set to false

Set spec.commonName to one of the dnsNames. Measured on rancher-join-test4 (#422). The Gateway wildcard certificates (wildcardCertificate here, or the cert-manager-cluster-ca AppSet) already set it.

A cluster that finds its own Vault

vaultIssuer.additionalAuths creates further Kubernetes-auth mounts beside cert-manager's. external-secrets is why it exists — it needs a mount and role of its own, and reusing cert-manager's would hand a secrets reader the right to issue certificates.

vaultIssuer:
  enabled: true
  pkiRole: sthings-vsphere
  additionalAuths:
    - name: eso
      boundServiceAccountNames: ["external-secrets"]
      boundServiceAccountNamespaces: ["external-secrets"]
      tokenPolicies: ["mgmt-1-secrets"]     # created elsewhere — see below
apps:
  external-secrets:
    components:
      cluster-store-vault:
        enabled: true
tokenPolicies, not policies, against infra.sthings-vsphere

additionalAuths[].policies asks the same OpenTofu plan to create the policy. That works only where the approle may write policies, and the fleet's bootstrap approle may not:

PUT https://vault.infra.sthings-vsphere.labul.sva.de/v1/sys/policies/acl/mgmt-test1-secrets
Code: 403 — permission denied

It has sudo on sys/auth — enough to create mounts — and nothing on sys/policies/acl/*.

The failure does not look like a permission problem. OpenTofu stops at the first error, and the role depends on the policy through token_policies, so the mount is created and the role is not. What you then see is external-secrets reporting

PUT /v1/auth/mgmt-test1-eso/login → 400: invalid role name "eso"

which sends you looking at role names and mount paths, two levels away from the cause. The real message sits gzip+base64-encoded inside the Workspace's Synced condition. Hit on mgmt-test1, 2026-08-16 (#285).

So point tokenPolicies at a policy created outside this Configuration — the way u26-rke2-1 does, whose u26-rke2-1-secrets comes from the Terraform under stuttgart-things/clusters/labul/vsphere/infra-sthings. Vault accepts a role naming a policy that does not exist; the token simply carries no permissions, silently, so create the policy before you rely on reading anything.

Nobody types a mount path. What Vault created lands on status.components.vaultIssuer.auths, keyed by name, and the catalog entry reads vaultIssuer.auths.eso.mountPath from there.

The two variables are required despite the artifact defaulting them, and that is the point: the defaults name one specific cluster's mount, so on any other cluster they would authenticate against the wrong Vault while looking configured. Required, they are either discovered or rejected by name.

The ServiceAccount an additional Vault auth binds

A Kubernetes-auth role binds a ServiceAccount by name, and Vault creates nothing. On homerun2-test1 external-secrets/eso came from hand-written Terraform in stuttgart-things/argocd — so a cluster built from an XR ended up with a mount and a role bound to an identity that did not exist, and the ClusterSecretStore failed at login exactly the way the missing certmanager ServiceAccount did in #435.

vaultIssuer:
  additionalAuths:
    - name: eso
      boundServiceAccountNames: [eso]
      boundServiceAccountNamespaces: [external-secrets]
      createServiceAccounts: true

composes every (namespace, name) pair the entry names, deduplicated. Opt-in per auth on purpose: cert-manager's auth binds the chart's own ServiceAccount, and composing a second one beside it would be wrong.

The namespace is adopted rather than owned (managementPolicies: [Observe, Create]): external-secrets normally arrives with its own Argo CD app, so creating it only when it is missing keeps the ServiceAccount out of a retry loop until that app shows up — and nothing is ever modified or deleted.

The cluster's own secrets in Vault

The values that belong to the cluster rather than to an app — the Grafana admin, the Alertmanager webhook token. Until now they were seeded by hand, survived no teardown and were reconciled by nothing (#438, decision 5.5).

clusterSecrets:
  enabled: true      # vaultAddr falls back to vaultIssuer.vaultAddr

composes an OpenTofu Workspace that writes observability/<clusterName>. Enabling it is sufficient: the defaults are exactly what infra/kube-prometheus-stack/secrets in stuttgart-things/argocd reads from the cluster's own entry — grafana-admin-user and a generated grafana-admin-password. Both generate and data replace the default set when given.

The Alertmanager webhook token is not generated (it was up to v0.7.1). It is the omni-pitcher's AUTH_TOKEN on platform-sthings, identical on every cluster — rancher-join-test5 synced a generated one cleanly, and every alert would have been a 401. It lives once in observability/_omni-pitcher (stuttgart-things/stuttgart-things#3006); a ClusterStack-built cluster reads it from there via the annotation observability-platform.stuttgart-things.com/alert-webhook-secret-key.

One mount observability is the only one the credential reaches — its policy is one path segment wide (observability/data/+). The app-owned sets (homerun2, schmetterpause) stay Terraform: a credential that can write those can rewrite an app's database password. Pointing mount elsewhere does not widen the policy, it produces a 403.
Teardown delete_all_versions, so the destroy removes the entry rather than adding a deletion marker — the next cluster of the same name does not read the old password.
Exposure The generated values live in the Workspace's tfstate, a Secret on the control plane. The same exposure VaultK8sAuth already carries for its AppRole credentials.
Character set Alphanumeric. The values pass through Helm values, a URL query and a file an Alertmanager config reads back, each with its own quoting rules; 32 alphanumeric characters carry more entropy than 16 with punctuation anyway.

The status says where they landed, so an ExternalSecret that reads nothing can be checked against what was written rather than against what the cluster annotation claims:

status:
  components:
    clusterSecrets:
      enabled: true
      ready: true
      mount: observability
      entry: rancher-join-test5

Overrides

apps:
  dapr:
    version: v1.17.0                             # else the catalog's defaultVersion
    substitute: {DAPR_NAMESPACE: dapr-system}    # applied to every component
    components:
      control-plane: {enabled: false}
      template-execution:
        substitute: {FLUX_SOURCE_API_VERSION: v1}   # merged over app-level, wins
        substituteFrom:
          - kind: Secret
            name: dapr-backstage-template-execution-vars

substituteFrom is component-scoped on purpose: it resolves at build time and a missing Secret fails the build, so an app-level one would break components that do not need it.

Dependencies between apps

A component may depend on one in another app — trust-manager cannot reconcile before cert-manager's CRDs exist:

spec:
  apps:
    cert-manager: {}
    trust-manager: {}      # catalog declares dependsOn: ["cert-manager:install"]

emits trust-manager-install with dependsOn: [{name: cert-manager-install}]. Enabling trust-manager alone is rejected, naming the fix rather than silently installing cert-manager for you:

unsatisfiable dependencies — trust-manager-install depends on cert-manager:install,
but app 'cert-manager' is not enabled — add it to spec.apps

Optional components

Catalog components marked optional are opt-in and not deployed unless named. cert-manager's selfsigned issuer needs CERT_MANAGER_SELFSIGNED_DOMAIN; defaulting it to on would make installing cert-manager require an unrelated variable.

apps:
  cert-manager:
    components:
      selfsigned:
        enabled: true
        substitute: {CERT_MANAGER_SELFSIGNED_DOMAIN: example.com}

Rules

Rule Where
apps enabled while fluxInit.enabled: false rejected by a CEL rule at apply time — fluxInit creates the sources apps reference
a component depending on a disabled sibling rejected at render, naming the offenders — it would otherwise sit in DependencyNotReady forever
unknown app name rejected by the catalog
a required substitution variable is not supplied, and no substitutionSources entry says where it could come from rejected at render — Flux replaces an undefined variable with an empty string rather than failing, so it would deploy silently broken. Satisfied by substitute keys, or skipped when the component carries a substituteFrom (build-time, not statically checkable)
a required substitution variable is not supplied, but a substitutionSources entry does the component is deferred, not rejected — see below
enabled: false prunes — the entry stops being emitted, and flux-apps' Objects use managementPolicies: ["*"], so the Kustomization and its workload are removed

Deferring, not aborting (since v0.3.15 / module 0.17.0)

A required variable nothing supplies is two different things, and treating them alike made some apps impossible to enable at all (#277):

  • no source declared — nothing will ever supply it: a typo, or a decision nobody made. Fatal, by name.
  • a source declared — the platform can discover it, just not yet. The status it reads is produced by this very Composition, so on the reconcile that enables both halves it is legitimately absent.

The second used to be fatal too, which deadlocked. Enabling vaultIssuer.additionalAuths[eso] and apps.external-secrets in one step aborted the render before it emitted the VaultK8sAuth the app was waiting for, so the value never appeared and the next reconcile aborted identically. And because a failed render emits nothing, it took every unrelated component with it. Only a second, manual apply escaped — which is not a state that converges on its own.

Now such a component is held back — alone, not with its siblings. external-secrets/install deploys the operator on the very reconcile external-secrets/cluster-store-vault waits through, and the store needs a CRD that operator owns anyway.

They are absent from appCount, so they are named on the status; without that an app enabled on the XR would simply not appear anywhere, indistinguishable from being ignored:

status:
  components:
    fluxApps:
      pendingCount: 1
      pendingSubstitutions:
        - "external-secrets-cluster-store-vault: VAULT_K8S_AUTH_MOUNT_PATH"

The list is expected to empty out on its own. One that stays put names both the variable and the component that wants it.

Since v0.4.0 the count also has a printer column, because a status field on a green object goes unread — readyCount == appCount stays true while a held-back component is missing, so the XR looks finished:

$ kubectl get platform
NAME                  READY   COMPONENTS   PENDING   CLUSTER
mgmt-test1-platform   true    4            1         mgmt-test1

ready is deliberately not flipped by a pending component. It means "what is there works", and the deferral exists precisely so a transient wait does not paint everything red. A PendingSubstitutions condition carries the same fact for tooling and kubectl describe.

Adding a component

  1. Add a spec.<component> block to apis/definition.yaml (with enabled, default true) and a status.components.<component> block.
  2. In apis/composition.yaml, emit the child XR under an if _<component>Enabled: guard, injecting the shared refs; read its status back out of ocds and add its readiness to _enabledReady.
  3. Add the wrapped Configuration to dependsOn in crossplane.yaml.

If a component needs a value another component discovers, put it on status.shared (as clusterType does) rather than re-deriving it.

Component schemas are mirrored, and must be kept in lockstep

spec.fluxInit.operatorChart and spec.fluxInit.instance are typed copies of the corresponding blocks in flux-init's XRD (kustomize and sops are x-kubernetes-preserve-unknown-fields passthroughs instead, because their shape is FluxInstance's, not ours). A field added to flux-init is therefore not usable through Platform until it is mirrored here.

That failure is loud, not silent — worth knowing which error you are looking at:

How you apply it Result
kubectl apply (default, strict) rejected: unknown field "spec.fluxInit.instance.<x>"
server-side apply (Flux, Argo CD) rejected: field not declared in schema
kubectl apply --validate=ignore silently pruned — the field never reaches the child

Mirroring the field into apis/definition.yaml is the fix; the Composition passes instance through verbatim, so no KCL change is needed. Do not "solve" this by making instance preserve-unknown: the field would then reach the child FluxInit, whose own schema rejects it when Crossplane server-side-applies it — turning a clear rejection on the object you wrote into a composition error one level down.

Cluster preconditions

Apply examples/rbac.yaml once per cluster — it is the complete grant for every flux component this umbrella composes (flux-init's FluxInstance + sources, flux-apps' Kustomizations), and it is required every time you use platform or flux-init against an in-cluster provider config.

It cannot be self-contained in a Composition, unlike the namespace precondition: provider-kubernetes has no create on clusterroles/clusterrolebindings and no escalate or bind verb, so a composed Object that tried to create the grant is denied. It must come from the layer that installs Crossplane. The file also pins the provider's ServiceAccount name via a DeploymentRuntimeConfig — by default that name carries the package-revision hash, which changes on provider upgrade and would silently break a binding pinned to it.

Beyond that, the preconditions are those of the wrapped Configurations — platform adds none of its own:

  • A Helm ClusterProviderConfig (helm.m.crossplane.io/v1beta1) named {clusterName}-helm, or whatever spec.helmProviderConfigRef says.
  • A Kubernetes ClusterProviderConfig (kubernetes.m.crossplane.io/v1alpha1) named {clusterName}-kubernetes.
  • With spec.clusterSecrets.enabled: a Secret named by credentialSecret (default vault-cluster-secrets-writer) in the XR's namespace on the management cluster, holding terraform.tfvars with vault_role_id + vault_secret_id of the cluster-secrets-writer AppRole (stuttgart-things/stuttgart-things#2994).
  • A flux-defaults EnvironmentConfig — consumed by the flux-init Composition, not by this one. See ../flux-init/examples/environment-config.yaml.

Notes

  • The XR kind is Platform, not Workspace: provider-opentofu already serves kind: Workspace (opentofu.m.upbound.io) on these clusters, so a second workspaces plural would make kubectl get workspaces ambiguous.
  • crossplane render on a Platform renders the child XRs but not their compositions — it stops at the FluxInit object. To check what Flux itself will emit, render ../flux-init with the child XR.