ADR-0044: The Git origin of an OCI source is declared, and the artifact is only a cross-check¶
- Status: Accepted
- Date: 2026-11-23
Context¶
Issue #935. The source mapping of ADR-0012 follows a Flux Kustomization to its GitRepository and refuses every other source: the request ends NeedsIntervention with UnsupportedSource. Many clusters deliver through OCI artifacts instead. CI builds an artifact from a Git repository (flux push artifact) and pushes it to a registry, and Flux pulls it through an OCIRepository. The desired state still lives in Git, but an OCIRepository says where the artifact is, not which repository, branch and path it was built from. Those clusters get diagnoses and issues, never a pull request.
Today's code, so the change is read against it:
- A Kustomization whose
spec.sourceRef.kindis notGitRepositorystops the mapping withUnsupportedSource(checkKustomizationininternal/gitops/sourcemap/fluxrules/flux.go; the reason isReasonUnsupportedSourceinfluxrules/result.go). - Flux objects are read as unstructured objects, and only the fields the rules name are used (the comment on
KustomizationGVKandGitRepositoryGVKinfluxrules/flux.go). - A
GitRepositorypasses only when it sets none ofsuspend,ignore,recurseSubmodulesorsparseCheckout(gitRepositoryOptionsinfluxrules/flux.go), and tracks one branch (CheckGitRepository); the Kustomization must have applied the revision the source last fetched (checkRevisioninfluxrules/flux.go,fluxstatus.AppliedFetchedininternal/fluxstatus/fluxstatus.go). - The source URL must equal exactly one repository of the settings, that repository must be the policy's
gitOps.repositoryRef, and the branch must equal itstargetBranch(matchRepositoryininternal/gitops/sourcemap/sourcemap.go). The URL is never put in a message (the comment onmatchRepository). - The base commit of the pull request is the head of that branch, read from the Git provider at mapping time (
git.BranchHeadinResolver.declarationandBaseCommitinResolver.scan,sourcemap.go). The freshness check runs the mapping again with the settings' repositories and compares repository, branch, path and build directory, not the base commit (Checker.checkSourceininternal/policy/freshness/freshness.go). - The executor's cluster-wide role has
getonkustomizationsandgitrepositoriesand nothing onocirepositories(config/rbac/executor/role.yaml, from the+kubebuilder:rbacmarkers ininternal/controller/cache.go; the chart'sdist/chart/templates/rbac/executor-role.clusterrole.yaml). - After the merge, the delivery check reads a commit out of the Kustomization's
lastAppliedRevisiononly when its source is aGitRepository(statusOfininternal/providers/delivery/flux/flux.go, which fillsAppliedRef,AppliedCommit,AttemptedRefandAttemptedCommitfor that source only). The unit isAppliedwhen that commit equals the merge commit, or descends from it by the ancestry answer (DeliveryStatus.OutcomeandDeliveryStatus.Verifyininternal/providers/delivery.go). delivered(internal/controller/rollout.go) reads the target and asks the Flux adapter twice, and reportsappliedonly when both answers areAppliedfor the same commit. Both checks after the merge call it, the one with--verify-outcomes(deliveryStep,internal/controller/phases.go) and the one without (waitForDelivery,rollout.go). In the first, an applied answer records the applied time (recordApplied,internal/controller/merge.go), the target's generation and template hash and the applied commit (the block afterrecordAppliedindeliveryStep), and the request moves toVerifyingwith its deadline measured from the applied time (enterVerifying,phases.go).- Until then the request waits: it is requeued at the poll interval inside the delivery window, one hour from the move to
Mergedplus the time writes were paused (deliveryStep,phases.go;deliveryWindowanddeliveryWindowEnd,rollout.go). Past the window a read that worked and showed no applied commit ends the request by its last outcome:FailedwithDeliveryFailedwhen the merge commit itself failed to apply,InconclusivewithDeliveryBlockedwhen a later commit that holds it failed,DeliverySuspendedfor a suspended unit, otherwiseInconclusivewithDeliveryNotObserved(deliveryStepcallingendDelivery,phases.go). This is the path with--verify-outcomes. Without it, the rollout check ends at the window withRolledOutFalseandDeliveryNotObservedwhatever the outcome (waitForDeliverycallingdeliveryNotObserved,rollout.go), which takes only the target, not the delivery. A read that kept failing endsInconclusivewithDeliveryNotCheckedonce the window and its grace of ten minutes have passed (deliveryStepcallingendDeliveryNotChecked;finalGrace,rollout.go). - A read of a Flux object that the API server refuses (403 or 401) comes back from the adapter as
providers.ErrForbidden(readErrorinflux.go).lastingCausedoes not list it (phases.go), so it is retried with backoff like any failed read (deliveryRetry,phases.go) and shows no cause on the request (deliveryReadFailed,phases.go). - Once the request is
Verifying, the verification reads the live field and ends the requestInconclusivewithValueChangedat once when it differs from the desired value (verifyStepcallingconfigured,phases.go). The text says "a later commit or change overwrote it, so this change never ran as merged" (thewhytext ofconfigured,phases.go). Verifier.Verify(flux.go) is the executor's path;StatusReader.Status(flux.go) is the read the analyzer's delivery status tool uses, and stays as it is.
The last two points matter most. For an OCI source the Kustomization applies <tag>@sha256:<digest> of the artifact (upstream: the revision of an OCIRepository artifact is the tag and the digest of the OCI artifact, source-controller spec, "Artifact"). It names no Git commit, and the cluster applies an artifact CI built after the merge, never the merge commit itself.
This ADR widens a read (the executor reads OCIRepository objects) and the places a pull request can come from (a workload delivered through a declared artifact). ADR-0021 says an amendment never widens on its own authority, so it is decided here and ADR-0012 gets only a pointer after acceptance. ADR-0043 is the model: say what is widened, say what never happens, state the limits.
What the upstream Flux API gives¶
Read from the current upstream documentation and source on 2026-11-19, not from memory (the repository vendors no Flux types, so there is no pinned version to read; the code reads source.toolkit.fluxcd.io/v1, internal/fluxstatus/fluxstatus.go):
OCIRepositorystatus carriesstatus.artifactwithrevision,digest,url,size,lastUpdateTimeandmetadata, a map of strings "such as OCI annotations".- When the artifact was created with
flux push artifact,metadataholdsorg.opencontainers.image.created,org.opencontainers.image.source("the URL of the Git repository containing the source files") andorg.opencontainers.image.revision("the Git branch and commit SHA1 of the source files"). The Flux CLI requires--sourceand--revisionand documents--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"(cmd/flux/push_artifact.goin fluxcd/flux2). The CLI strips credentials from the source it records. An artifact pushed by another tool, or with another--revision, can carry any value or none. - The status has no field that says which Git repository, branch or path the content came from, other than those annotations. Registry access would be needed for anything else, and the executor has none.
spec.ignore,spec.layerSelector,spec.suspend,spec.verifyandspec.secretReforspec.serviceAccountNameexist in the spec. Source-controller leaves out what its default exclusion rules and any.sourceignorefile match when it archives the pulled contents, andspec.ignoreoverrides the defaults (source-controller spec, "Ignore"). CI has its own filter:flux push artifacttakes--ignore-paths(defaultexcludeOCI) and--add-ignore-paths(cmd/flux/push_artifact.goin fluxcd/flux2). A file either step leaves out is not in the artifact, whatever Git holds.OCIRepositoryis served atsource.toolkit.fluxcd.io/v1from source-controller 1.6.0, which came with Flux 2.6 (its changelog: "TheOCIRepositoryAPI has been promoted fromv1beta2tov1(GA)", release date 2025-05-27; read 2026-11-23). Before that it was served atv1beta2only, and the executor readsv1(OCIRepositoryGVKis to sit next toGitRepositoryGVKinfluxrules/flux.go).spec.verifyisOCIRepositoryVerification(api/v1/ociverification_types.go:23-48in fluxcd/source-controller atmain):provider(cosignornotation),secretRef(cosign public keys or the notation trust policy),matchOIDCIdentity(a list ofOIDCIdentityMatch, cosign keyless only,issuerandsubjectas Go regular expressions,ociverification_types.go:70-83) andtrustedRootSecretRef(a Sigstoretrusted_root.json, for a self-hosted Sigstore). Flux reports the result in the conditionSourceVerified:Truewhen the signature verified,Falsewith reasonVerificationErroron a failure, which the controller retries with backoff. The condition exists only whilespec.verifyis set and carries theobservedGenerationof the spec it judged (api/v1/condition_types.go:35-40,:74-76).- The signature covers the artifact's digest, and the digest covers the manifest, so the annotations of a verified artifact are what the signer pushed. The status holds the verdict, not the identity that matched.
Decision¶
This is option 3 of the issue, with two changes: the declaration has no branch field (decision 6 of 2026-11-19), and the artifact must be verified by Flux unless the origin says otherwise.
1. The declaration¶
RemediationSettings gets a new list, spec.ociSources, next to spec.repositories:
spec:
repositories:
- name: fleet
url: https://github.com/example/fleet
targetBranch: main
provider: GitHub
github: { ... }
ociSources:
- name: apps # Name, the list key
ociRepository:
namespace: flux-system # DNS label
name: apps # DNS subdomain
repositoryRef: fleet # Name of an entry in spec.repositories
path: clusters/prod # GitDirPath, default "."
verification: Required # Required (default) or NotRequired
ociRepositoryis the Flux object, by namespace and name. A pair appears at most once (a CEL rule, as the URL rule ofrepositories).repositoryRefmust name an entry ofspec.repositories(a CEL rule on the spec). The mapping checks it again and never relies on admission alone.pathis the directory of the repository that the artifact's root corresponds to,.when CI packs the repository root (flux push artifact --path=./clusters/prodispath: clusters/prod). The build directory of a request is the Kustomization'sspec.pathput under this path, in two steps (section 2, step 7).- There is no branch field. The branch is the
targetBranchof the entryrepositoryRefnames, as for aGitRepository(ADR-0012 step 2). A second field could only repeat that value or disagree with it. The issue lists the branch among the fields; this is a deliberate departure. verificationisRequiredunless the entry saysNotRequired.NotRequiredmakes the mapping accept anOCIRepositorywithoutspec.verify. Its risk is in the field's documentation and in limit (a). It is a decision of whoever writesRemediationSettings, per origin, and nothing in the artifact or the cluster can turn it on.- At most 16 entries, as
repositories. Fields of theRemediationSettingsstatus are never read for any decision, as before.
2. What the mapping does for a Kustomization whose sourceRef.kind is OCIRepository¶
In this order, each stop being NeedsIntervention unless said otherwise. A read that fails is returned for retry and is never one of these stops (the rule of Resolver.get, sourcemap.go); the one exception is a refused read (step 2).
- No
ociSourcesentry names that namespace and name: stop, reasonOCIOriginNotDeclared. The message names the object and the field to declare. - Read the
OCIRepository(get, by the Kustomization'sspec.sourceRef, the namespace defaulting to the Kustomization's as for aGitRepository,checkKustomizationinfluxrules/flux.go). Not found:SourceNotFound. A cluster whose Flux does not serveOCIRepositoryatv1(before Flux 2.6) answers thegetwith a no-match error, whichResolver.get(sourcemap.go) turns into the not-found stop, so the message says the object does not exist while it does. The build gives this case its own message, naming the kind and the version the executor reads, with the same reason (limit (k)). A 403 or 401 on the read (the grant of section 3 is off):OCISourceNotReadable, since a retry could never succeed and would run without end and without a signal. - The object must not set
spec.suspend,spec.ignoreorspec.layerSelector: reasonSourceOptions, as for thegitRepositoryOptionsoffluxrules/flux.go. Each can make the artifact differ from the files in Git.spec.refmust not setdigest,semverorsemverFilter(the fields ofOCIRepositoryRefbesidestag,api/v1/ocirepository_types.goin fluxcd/source-controller atmain, read 2026-11-23): reasonSourceNotBranch, the one the Git rule gives aGitRepositorywhosespec.refsets a field that takes precedence over the branch (gitRefBranchandgitRefOthers,fluxrules/flux.go). A digest pins one artifact and a semver range picks a tag by version, so neither follows the next artifact the pipeline pushes, which section 5 needs to see the merge arrive. Atag, or nospec.ref(upstream: the tag "defaults to latest"), passes. The executor cannot tell a tag the pipeline moves from one it never moves (limit (m)). The message names the field, as the Git rule's does, and the build widens the doc comment ofReasonSourceNotBranch(fluxrules/result.go) to the OCI case. - It must be Ready for its current generation (
SourceNotReady), verified, and applied: - Verified.
spec.verifymust be set, and the conditionSourceVerifiedmust beTruewith anobservedGenerationequal to the object's generation. A keyless cosign verification (provider: cosignand nosecretRef) must also name at least one identity:matchOIDCIdentitymust have an entry. Otherwise:OCISourceUnverified. The reason for the identity rule is upstream: with no entry source-controller passes an empty identity list to cosign (ocirepository_controller.goin fluxcd/source-controller atmain, the keyless branch of the verification), and cosign checks identities only when the list is not empty (pkg/cosign/verify.goin sigstore/cosign, thelen(co.Identities) > 0test; both read 2026-11-23). A certificate that public Sigstore issued to any GitHub or Google account then verifies andSourceVerifiedisTrue, soRequiredwould mean nothing. The executor reads whetherspec.verifyis set, the condition,provider, whethersecretRefis set and whethermatchOIDCIdentityis empty, nothing else of it: no key, no identity pattern (it does not judge whether a pattern is narrow; a pattern such as.*passes, limit (a)), no registry call. A failed verification is a stop, not a wait: Flux retries it with backoff, and a person re-triggers the request when it verifies. Withverification: NotRequiredthis bullet is skipped and the cross-check of step 6 is the only guard (limit (a)). - The Kustomization's
status.lastAppliedRevisionmust equalstatus.artifact.revision(RevisionMismatch; the equality is of two strings from the cluster, asfluxstatus.AppliedFetched, with no tag parsing, since the OCI revision is not a Git revision). - The artifact must carry
org.opencontainers.image.sourceandorg.opencontainers.image.revisioninstatus.artifact.metadata, and the revision must parse as<ref>@sha1:<40 hex>or<ref>@sha256:<64 hex>(fluxstatus.ParseRevision,internal/fluxstatus/fluxstatus.go). Otherwise:OCIOriginUnrecorded. Only a SHA-1 commit can be checked in step 6 while GitHub is the only ancestry provider; a SHA-256 one endsOCIOriginUnrecordedthere. - The cross-check against the declaration:
- The annotated source must equal the URL of the declared repository, or equal it with
.gitappended (the formgit config --get remote.origin.urlgives). For aGitHubrepository the owner and repository names are compared with ASCII case folded, because GitHub treats them as case-insensitive and the settings hold them in lower case (theXValidationrule onGitRepositoryinapi/v1alpha1/remediationsettings_types.go); the scheme and host must still match exactly. No other rewriting: notssh://, notgit@host:. - The ref must be the target branch. The ref of the annotated revision must equal the repository's
targetBranchbyte for byte. Refused withOCIOriginMismatch: a tag (an artifact published from a tag records the tag), another spelling of the branch such asrefs/heads/<branch>, another branch. There is no list of accepted refs and no field to add one: a declared list would need its own threat note. A pipeline that publishes from tags is refused for now, and the message says that the ref differs, without showing it. - The annotated commit must be the head of that branch or one of its ancestors (
AncestryChecker.IsAncestor,internal/providers/delivery.go, implemented for GitHub byProvider.IsAncestorininternal/providers/github/ancestry.go, a read through the Git App the mapping already opens inResolver.declaration,sourcemap.go). The call is made as the operationread the ancestry of the artifact's commit. It starts withread, so it joins the bounded Git read wait (gitReadFailuretakes anysourcemap.RefusedErrorand asourcemap.TransientErrorwhose operation starts withread,listoropen repository,gitReadFailureininternal/controller/gitread.go). The error classes are named, and each has its own test. They are decided before the error reaches the resolver'stransient()(transientinsourcemap/errors.go), which keeps a refusal as aRefusedErrorand turns every other error into a retry:ErrInvalidCommit(the GitHub adapter compares SHA-1 only and refuses a SHA-256 or malformed ID for good,Provider.IsAncestor):OCIOriginUnrecorded, the commit cannot be compared.ErrNotFound(a 404 or 410 of the compare call,statusErrorininternal/providers/github/client.go):OCIOriginMismatch, the repository does not have the commit.ErrForbidden(403) andErrRejected(422) (statusError): a refusal. It stops the request as a refusal of any other Git read does: the resolver returns aRefusedError(transient,errors.go) and the controller reads its class withrefusal(internal/controller/pullrequest.go), with the reasonsGitForbiddenandGitRejected. NoOCIOrigin*reason, no retry.- Every other error (a network error, a rate limit, a 5xx): a retry, inside the bounded Git read wait. A failed read is never a verdict.
- Any difference: stop, reason
OCIOriginMismatch, no Git write. The message names which comparison differed and shows no URL. TheOCIRepositoryis recorded with the other Flux objects the mapping reads (d.seeninResolver.Resolve,sourcemap.go) and read again after the Git scan, so an artifact pushed during the scan makes the mapping a retry. It is part ofResult.Observedtoo. At the merge the freshness check maps the target again (Checker.checkSource,freshness.go), which reads theOCIRepositoryas it is then and runs the same mapping, steps 1 to 7, on the current object and artifact, not only this cross-check: if it still resolves to the plan's repository, branch, path and build directory, the plan is fresh; a mapping that now stops (a verification removed, for one) or resolves elsewhere makes it stale withSourceChanged(Checker.checkSource). AnOCIRepositorythat changes during that check makes it a retry (Checker.recheckInputs,freshness.go). - The build directory is made in two steps, never as one join. First
spec.pathis checked as for a Git source, withrepopath.Join(".", spec.path)(Resolver.scan,sourcemap.go), which refuses a leading..and returns the clean path inside the artifact root. Then that result is put under the declaredpath.repopath.Join(declared, spec.path)is never called: it resolves..inside the declared prefix (Join("clusters/prod", "../../other")returns"other"), while Flux's kustomize-controller clampsspec.pathinside the artifact root, so the mapping would scan and patchother/outside the declared path. Aspec.pathof../xor../../xendsInvalidPath, as for a Git source. - Then the rules of ADR-0012 go on as for a Git source: exactly one settings repository (the declared one), the policy's
repositoryRef, thetargetBranch, the build directory, the declaration found by the scan in it, the live value equal to the value in Git,allowedPaths. The base commit is the head of the branch, as today.
Reason names are the proposal; the builder may change a spelling in the code review, not the cases.
What a verified source proves¶
An OCIRepository is cluster input (invariant 4). It is written by whoever the cluster's RBAC lets create or update the object, and spec.verify is whatever that writer put in it. A verified source therefore means one thing: Flux accepted a signature from a signer that the writer of the OCIRepository chose. It does not mean the artifact was built from the declared repository, for any provider (cosign with a key, cosign keyless, Notation):
- a key or an identity proves who signed, not which repository the files came from;
- the executor cannot read a signer's identity, only the verdict, and does not try to (see "Tie a keyless signature to the declared repository" under Alternatives).
Verification is kept as the default for defence in depth and nothing more: with a key, a Notation trust policy or a list of identities, it stops an artifact that nobody the writer trusts signed from supplying annotations, and a forger needs a signer the writer accepts as well as a registry write. A keyless cosign setup with no identity list accepts any Sigstore identity, which is why step 4 refuses it. What bounds a forged artifact is the value check against Git, the render check and the review of the pull request.
3. What is read, written and granted, and what never is¶
| Read | Written | Granted | Never | |
|---|---|---|---|---|
| Executor, cluster | get on ocirepositories of the group source.toolkit.fluxcd.io: the spec fields above, whether spec.verify is set and, for it, provider, whether secretRef is set and whether matchOIDCIdentity is empty, status.artifact.revision and status.artifact.metadata, the conditions Ready and SourceVerified |
nothing new | one new get rule in its own ClusterRole, opt-in (below) |
list, watch, any write on the object; Secrets, ServiceAccounts, or the object's secretRef, serviceAccountName and the spec.verify secret or identity patterns followed or judged; a signature, a key or a certificate read or checked by the executor itself; the artifact's tarball or status.artifact.url (an HTTP call to source-controller); the registry, with or without credentials |
| Executor, Git | the head of the declared branch, the ancestry of the annotated commit, files in the declared path, through the GitHub App of that repository | the pull request, in a repository of the settings, as today | no new App permission | any repository not in spec.repositories; a path or branch taken from an annotation |
| Settings | the declaration is written by whoever may write RemediationSettings, a cluster administrator |
read from the status | ||
| Analyzer, verifier | nothing | ocirepositories. The OCIRepository read and the comparison with the plan's repository live only on the executor's path (Verifier.Verify, not StatusReader.Status, flux.go); the analyzer's delivery status tool (get_delivery_status) is unchanged |
The grant is opt-in. The chart gets the value executor.ociSources.enabled, default false, which renders a separate ClusterRole and ClusterRoleBinding with the one rule; kustomize gets the same as a separate component, as the analyzer's module grants (analyzer.modules in dist/chart/values.yaml, config/rbac/analyzer/modules/flux/kustomization.yaml). The default install stays as narrow as today. The rules are pinned by the RBAC test tables (test/rbac/rbac_test.go, the rows of gitrepositories are the model: executor get on ocirepositories allowed; executor list, watch and every write refused; analyzer and verifier refused on every verb) and by the chart tests (test/chart/chart_test.go, the table that holds the gitrepositories rows): the ClusterRole and its binding render only with the value on, and the default render has no rule on ocirepositories for any identity. With the value off and an entry declared, the mapping ends with OCISourceNotReadable, and the lookup page tells the operator to turn it on.
4. How the invariants hold¶
- Model output is never authorization. The declaration is settings written by an administrator, and the annotations are compared, not obeyed. Nothing from the artifact reaches the policy or the model. The plan digest covers repository, branch, path and build directory (the
source.*fields ininternal/policy/digest/digest.go,source.buildPathamong them), and the freshness check compares them with the mapping it runs again (Checker.checkSource,freshness.go), so a declaration edited between the plan and the merge makes the plan stale (SourceChanged). This does not work yet: the call inChecker.checkSourcepasses onlysettings.Spec.Repositories. The build addsOCISourcestosourcemap.Inputand has freshness passsettings.Spec.OCISources. Without it every OCI request would go stale at the merge (it fails closed, so it is not a hole, but it is a failure). - Closed catalog. No new action, parameter or patcher. The action still changes one declared field of one manifest in Git.
- Git only. The only write is the pull request the executor opens today, in a repository of
spec.repositories, to the entry'stargetBranch, in a fileallowedPathsallows. The pipeline that builds the artifact is never touched. - Cluster input is untrusted. The
OCIRepositoryand the two annotations are input from whoever can write them. The annotations are only compared for equality with values the administrator declared, and a difference stops the request. They are never used as a repository, a ref, a path or a URL, never put in a message in full, and never shown to the model. Branch and commit are parsed with the parser that also parses Git revisions. Verification is a check on what the writer of the object chose, not on the origin (section 2, "What a verified source proves"). - Idempotent. The mapping adds no state. A restart maps again and gets the same answer or, after a new artifact, a fresh one.
- Separate identities. One new
getfor the executor only, cluster-wide like itsgitrepositoriesrule (opt-in, off by default). The analyzer and the verifier get nothing. No registry credential, no Secret read, no new App permission. AGENTS.md invariant 6 is amended in the pull request that builds this, to list the grant and its chart value.
5. The merge commit, the delivery check and the verification¶
Three commits are in play:
- The base commit of the pull request is the head of the declared branch when the request is mapped. It is not the artifact's commit. The artifact may be older than the head, so the mapping checks that the artifact's commit is the head or an ancestor of it, and relies on the existing value check (live value equals the value in Git at the head). A change between the artifact's commit and the head that touches the field makes the values differ and stops with
ValueMismatch; one that does not is harmless. - The merge commit is recorded in the merge receipt as today (
MergeReceiptinapi/v1alpha1/remediationrequest_types.go, ADR-0030 section 1). Nothing about the receipt depends on the source kind. - The applied commit for an OCI unit is the commit in the revision annotation of the artifact the Kustomization applied. The adapter computes it only when
lastAppliedRevisionequals the currentstatus.artifact.revisionof theOCIRepositorythe Kustomization names, only when the annotated source names the plan's repository, and only when theOCIRepositorypasses, as it is at that read, the verification check of step 4:spec.verifyset,SourceVerifiedTruefor the current generation, and a keyless cosign verification with at least onematchOIDCIdentityentry (skipped for an origin withverification: NotRequired;Verifier.Verifyinflux.gotakes the unit, the merge commit and the branch today, so the build passes it the plan's repository and the origin'sverificationvalue). An unverified source reads asPending, like any other read that shows no applied commit, so a source whose verification was removed or stopped passing after the merge cannot report the change as applied (invariant 4). It fillsAppliedRefandAppliedCommitfrom the annotation, as it does fromlastAppliedRevisionfor aGitRepository(statusOf,flux.go). The attempted commit follows the same rule.AttemptedRefandAttemptedCommitare filled from the same annotation whenstatus.lastAttemptedRevisionequals the currentstatus.artifact.revision(and the annotated source names the plan's repository, and the source passes the same verification check).statusOffills them today for aGitRepositorysource only, andDeliveryStatus.OutcomeendsFailedonly whenAttemptedCommitis the merge commit, so without this a failed apply of the merge's artifact could never endDeliveryFailedorDeliveryBlockedon the path with--verify-outcomes(endDelivery,phases.go; the path without it has no such ending). Then the existing comparison runs unchanged (DeliveryStatus.OutcomeandVerify,delivery.go, ADR-0030 section 2). Otherwise the status isPending: the executor never reads an older artifact's metadata (it is gone from the status) and never reads the registry. A failed attempt of an artifact that was replaced before it was read is not seen (limit (l)).
What protects the outcome is not the annotation. An artifact that names the merge commit early would make the delivery look applied before the merged change has arrived. Today that would let recordApplied and the move to Verifying happen, and the verification would read the old value and end Inconclusive with ValueChanged at once (verifyStep, phases.go), with a text that says a later commit overwrote the field (configured, phases.go), which is false there. The change that arrives later would never be verified.
For an OCI unit nothing is recorded as applied until the live value matches. In delivered, after the second answer is Applied (in delivered, rollout.go), an OCI unit counts as applied only when the target the function just read holds the desired value, by the comparison the verification uses (configured, phases.go). It reads nothing new. What differs from today:
- While the value differs,
deliveredreturns not applied, as it does forPending. The request staysWaitingForDeliveryand is requeued at the poll interval inside the window (deliveryStep,waitForDelivery), so a value that arrives late is seen. Nothing is recorded: no applied time, no generation, no template hash, no applied commit, andVerifyingis not entered (deliveryStep,enterVerifying). This holds with and without--verify-outcomes, since both calldelivered. - The request shows what any waiting delivery shows: phase
WaitingForDelivery,DeliveredUnknownwith the reasonDeliveryPending, andstatus.deadlineat the end of the window (enterDelivery,phases.go). It shows no reason of its own: the wait is the delivery wait. - When the value matches, the applied time and the other fields are recorded in that write, the request moves to
Verifying, and the verification reads the field again. A later difference then is a real later change, soValueChangedand its text (configured,phases.go) stay true. Nothing in the verification or its deadline changes, and no second wait exists. - When the window has passed with the value still different and no read failing, the request ends as a delivery that was not seen, on each path as it does today:
- With
--verify-outcomes,endDelivery(phases.go) picks the ending from the last outcome:Failedfor the merge commit endsFailedwithDeliveryFailed,Failedfor a later commit endsInconclusivewithDeliveryBlocked, a suspended unitDeliverySuspended, anything elseInconclusivewithDeliveryNotObserved. These three other endings exist only on this path. - Without it, the rollout check ends with
RolledOutFalseandDeliveryNotObservedwhatever the outcome (waitForDeliverycallingdeliveryNotObserved,rollout.go).deliveryNotObservedtakes the target only today; the build passes it the delivery (d), so it can see the last outcome. - The built-in
DeliveryNotObservedmessage says the Kustomization was not seen applying the commit, which is not what happened here. So for an OCI unit whose last delivery outcome wasApplied(d.outcome, inendDeliveryand indeliveryNotObserved), the message says instead that an artifact naming the merge commit was applied and the field never held the desired value within the window. With any other outcome the existing messages stand. - The change is not verified and the ending is final.
- If
configuredcannot read the field (it returns an error), that is a failed read: retried, and past the window and its graceDeliveryNotChecked(deliveryStep), never a verdict on the value. - The window is the existing one:
deliveryWindowEnd(rollout.go) from the executor's own time of the move toMerged(MergeReceipt.MergedAt, set with the move toMergedininternal/controller/limits.go), plus the time writes were paused. Both ends of the comparison are the executor's clock, so no two clocks are compared. CI must build and Flux must pull within the hour (limit (d)). - A Git unit is unchanged.
The rollout status says where "applied" came from. The rollout status (status.rollout) gets a field appliedFrom, an enum recorded in the write that records appliedRevision (in deliveryStep; the same for the check without --verify-outcomes, in waitForDelivery):
GitRevision: the applied commit is the one in the Kustomization'slastAppliedRevision, aGitRepositorysource (today's only case);OCIAnnotation: the applied commit is the one in the revision annotation of the artifact the Kustomization applied.
It is shown to the reader and read by no decision. Absent on a request recorded before the field existed. ADR-0030 gets a one-line pointer after acceptance, as ADR-0012 does.
A forbidden read of the OCIRepository during the delivery check (the opt-in grant is off, or was removed) is retried like any failed delivery read today (deliveryRetry, phases.go) and ends DeliveryNotChecked when the window and its grace have passed (deliveryStep). The one thing this ADR adds is that the cause is shown while it retries. The adapter marks the refused OCIRepository read as a lasting cause (providers.ErrForbidden from readError in flux.go is shared with the Kustomization read, so the build gives this read its own error, which names the grant), and lastingCause gets one case for it (phases.go). deliveryReadFailed then writes it into Delivered Unknown, and the final message names it (deliveryStep). The grant can be turned on meanwhile: each retry reads the object again. No new end path and no early end. Only Verifier.Verify makes this read; StatusReader.Status is unchanged and gets no grant on the kind.
6. Behaviour at the edges¶
| Case | End state | Reason | Why |
|---|---|---|---|
No declaration for the OCIRepository |
NeedsIntervention, no Git write |
OCIOriginNotDeclared |
the repository and path cannot be known from the cluster; the message says what to declare |
| Declared, source, ref or commit not in the branch differs from the declaration | NeedsIntervention, no Git write |
OCIOriginMismatch |
the declaration and the artifact disagree about where the files live; a person decides which is right. A tag ref is refused the same way |
| Declared, artifact has no source or revision annotation, or one that does not parse | NeedsIntervention, no Git write |
OCIOriginUnrecorded |
see below |
Declared, the executor may not read ocirepositories (at the mapping) |
NeedsIntervention, no Git write |
OCISourceNotReadable |
permanent until the grant exists |
The delivery check may not read the OCIRepository (403 or 401) |
retried; shows the cause on Delivered; ends Inconclusive when the window and its grace pass |
DeliveryNotChecked |
the existing path for a failed read (deliveryStep); the grant can be turned on meanwhile |
spec.verify unset, SourceVerified not True for the current generation, or a keyless cosign verification with no matchOIDCIdentity entry (and verification is Required) |
NeedsIntervention, no Git write |
OCISourceUnverified |
Flux did not accept the artifact, or accepted any Sigstore identity |
| An applied artifact, live value differs, window not passed (OCI unit) | stays WaitingForDelivery, requeued |
Delivered Unknown, DeliveryPending |
the artifact may claim the merge commit early; nothing is recorded as applied |
| An applied artifact, live value differs, window passed (OCI unit) | Inconclusive |
DeliveryNotObserved |
final; the change was not seen to arrive |
Object missing, not Ready, suspended, with ignore or layerSelector, applied revision differs |
as for a GitRepository |
SourceNotFound, SourceNotReady, SourceOptions, RevisionMismatch |
the same rules, same reasons, same waits for a reconciling Kustomization |
Ancestry call (operation read the ancestry of the artifact's commit): SHA-256 or malformed commit (ErrInvalidCommit), or commit unknown to the host (ErrNotFound) |
NeedsIntervention, no Git write |
OCIOriginUnrecorded, OCIOriginMismatch |
permanent answers, never retried |
Ancestry call: 403 or 422 (ErrForbidden, ErrRejected) |
stops as any refused Git read | GitForbidden, GitRejected |
a refusal is final (transient in sourcemap/errors.go, refusal in pullrequest.go) |
| Any other read or ancestry call fails (network, rate limit, 5xx) | retried inside the bounded Git read wait, no stop | none | a failed read is never a verdict; the operation starts with read, so gitReadFailure counts it (gitReadFailure, gitread.go) |
The Kustomization failed to apply the artifact of the merge commit (lastAttemptedRevision equals the current, verified artifact revision, OCI unit), window passed |
as for a GitRepository. With --verify-outcomes: Failed when the artifact's commit is the merge commit, Inconclusive when it is a later commit that holds it. Without it: RolledOut False |
DeliveryFailed, DeliveryBlocked (endDelivery, phases.go); without --verify-outcomes DeliveryNotObserved with the built-in text (deliveryNotObserved, rollout.go) |
the adapter fills AttemptedRef and AttemptedCommit from the annotation (section 5); the OCI message of DeliveryNotObserved is used only after an Applied outcome, so not here |
An OCIRepository whose spec.ref sets digest, semver or semverFilter |
NeedsIntervention, no Git write |
SourceNotBranch |
it does not follow the pipeline's next artifact; the Git rule refuses the same pins |
Delivery read after the merge: the current artifact fails the verification check of step 4 (verification: Required) |
read as Pending; past the window as any unseen delivery |
DeliveryPending, then DeliveryNotObserved |
a source whose verification was removed after the merge cannot report the change as applied |
Other source kinds (Bucket, ExternalArtifact, HelmChart) |
NeedsIntervention |
UnsupportedSource |
unchanged |
An artifact without annotations is refused, not accepted on the declaration alone. With the declaration alone the executor would have no evidence that the artifact has anything to do with the declared repository, so a wrong declaration (a mistyped path, a repository CI no longer builds from) would open pull requests that deliver nothing. It also could not tell a delivered merge from an undelivered one, since the artifact's revision names no commit: every request would wait the full hour and end DeliveryNotObserved. A pipeline records the annotations by adding --source and --revision to flux push artifact, which the CLI requires anyway.
Consequences¶
Clusters that deliver through OCI artifacts can get pull requests. The cost is an explicit declaration per OCIRepository, an artifact pipeline that records its source from the target branch and is verified by Flux, and one more opt-in grant.
Known limits:
- (a) A verified source proves that Flux accepted a signer the writer of the
OCIRepositorychose, not that the artifact was built from the declared repository (section 2, "What a verified source proves"). Whoever holds the accepted key or identity can sign annotations that match any declaration; withverification: NotRequired, anyone who can write to the registry can set them. Step 4 refuses a keyless cosign setup with an empty identity list, but it counts entries and does not read patterns: a list whose pattern matches every identity (.*) passes and accepts any Sigstore identity, so forRequiredto mean something the patterns must name the pipeline. Step 4 only establishes that a verification is set and reported, not which keys or identities it accepts, so a key swapped or an identity pattern widened by whoever writes the object is not seen. In every case the annotations are a cross-check against mistakes and drift, not authentication. - (b) CI may change the files between Git and the artifact (a substitution step, a generated overlay). The mapping compares only the one field it will change. So is a file CI leaves out with
--ignore-pathsor--add-ignore-paths, or that source-controller leaves out: a declaration in such a file is found in Git by the scan and does not exist in what the cluster applies. - © The commit an OCI unit shows as applied comes from an annotation, cluster-side input, where for Git it comes from Flux. The wait of section 5 limits what that can do: nothing is recorded as applied until the live value matches, so an early claim cannot start the verification on the old value. What remains: a live value that matches the desired one for another reason while the merged change is still in transit records the request as applied, and a later overwrite by an older artifact ends it
ValueChanged. That reason is a person who set the value by hand, or whoever can produce an artifact theOCIRepositoryaccepts at the delivery read: the delivery read applies the verification check of step 4 to the current artifact (section 5), so anOCIRepositorywhosespec.verifywas removed, or whose verification fails, after the merge reports nothing as applied. That check counts identity entries and reads no key or pattern, so it does not see asecretRefpointed at another key or a pattern widened to.*. So the producer is the signer theOCIRepositoryaccepts at that read, any signer when the identity list is wide (limit (a)), or any registry writer underverification: NotRequired. That producer can push an artifact that holds the desired value and names the merge commit before CI builds the real one, sodeliveredrecords the applied time, the request moves toVerifyingand the verifier can reportClearedfor a value that never came from the merged commit. The value is the desired one, so a wrong value does not clear; what is wrong is the attribution: the outcome is credited to the pull request although the merged change did not cause it. For an OCI unit,appliedFromOCIAnnotationtherefore means the outcome is only as trustworthy as the signer theOCIRepositoryaccepts when the change is read as applied, and the verification page says so where it explainsappliedFrom. A change that never arrives costs the whole window and endsDeliveryNotObservedinstead of an earlier end. A forged annotation can also delay or deny that end. - (d) The artifact is built after the merge, so the one-hour window includes the CI run and Flux's poll interval. A slower pipeline ends
DeliveryNotObservedwith the change possibly delivered later. - (e) The delivery is read only while the applied artifact is the current one. Two artifacts in quick succession can leave no moment where the merge commit's artifact is both applied and current. The later one descends from the merge commit and counts. A Kustomization that applied an artifact that is then replaced and never applies another one shows
Pending. - (f) The source annotation is compared as a string. A pipeline that records an
ssh://orgit@form never matches until it records the HTTPS form. Case is folded for GitHub names only. - (g) A wrong
paththat still finds one declaration with the right live value opens a pull request in the wrong directory. The render check runs on the build directory the path implies, so it fails when that directory does not build to the same objects; it does not prove the path is the right one. - (h)
kubectl shadewright doctorand the analyzer'sget_delivery_statuscompare only with aGitRepository(CompareSourceinfluxrules/flux.go). They keep reporting an OCI source as not compared until a follow-up teaches them, and the analyzer's Flux grant is not widened here. - (i) The list the mapping copies (
fluxExcludesininternal/gitops/repopath/generate.go) is source-controller's list for aGitRepository. Source-controller's OCI exclusions and theexcludeOCIdefault offlux push artifactare separate lists upstream. The builder compares them with the copied one before it reuses it for an OCI source; a difference is a bug in the build, not a decision. - (j) A declared
OCIRepositorywhosespec.urlis later pointed at another artifact keeps its declaration. The annotations are still compared on every mapping, so another origin endsOCIOriginMismatch, but a pipeline that copies the annotations and is accepted byspec.verifypasses. The trust inspec.url,spec.refandspec.verifyrests with whoever may write theOCIRepositoryobject. - (k) The executor reads
OCIRepositoryatsource.toolkit.fluxcd.io/v1, served from Flux 2.6 (source-controller 1.6.0, section "What the upstream Flux API gives"). On an older Flux thegetreturns a no-match error, the mapping endsSourceNotFoundand the message says the object does not exist. The build words that case as "the kind is not served at v1". This follows the standing rule: Flux kinds are read atv1only and beta versions are not read (docs/design/2-architecture.md, section 2.5.2, "beta versions are not read"; the compatibility page's Flux row says the same).v1beta2is not read, so an OCI source needs Flux 2.6 while the rest of the mapping works from Flux 2.3; the design line and the compatibility page say so when this is built (build item 5). - (m) A
spec.ref.tagthat the pipeline never moves passes step 3: the executor cannot tell a moving tag from a fixed one without the registry. The merged change then never arrives in the cluster, and the request endsDeliveryNotObservedafter the window. The cost is one pull request, merged for nothing, that a person has to undo or follow up, and the hour of the window. - (l) The attempted commit is read only while the failed artifact is the current one (limit (e) for the applied one). A failed apply of the merge's artifact that is replaced by another artifact that has not been tried yet shows
Pending, and the request can endDeliveryNotObservedinstead ofDeliveryFailed.
Alternatives considered¶
- Option 1, the declaration alone. Explicit, and no trust in the artifact. But nothing ties the artifact to the declared repository, and the delivery check could not work: the revision of the artifact is no commit, so every request would end
DeliveryNotObservedor need a second mechanism to tell a delivered merge. Refused for the reasons of section 6. - Option 2, the annotations alone. The annotations do not say the path, so the path would have to be guessed. They are also set by whoever writes to the registry, so a registry writer would choose where a pull request goes, within the repositories of the settings. That is invariant 4 turned around: input from outside decides a destination. Adding a verification requirement on top is adopted (section 2, step 4) as defence in depth only.
- Tie a keyless signature to the declared repository (an identity rule). An earlier draft required, for keyless cosign on GitHub, that
matchOIDCIdentitybe an exact literal naming the declared repository. Rejected, for two reasons. The signing identity of a GitHub workflow names the called workflow (job_workflow_refis "for jobs using a reusable workflow, the ref path to the reusable workflow", GitHub's OIDC reference, read 2026-11-19), so a run in another repository that calls a reusable workflow of the declared one gets the same subject. AndtrustedRootSecretReflets the writer of theOCIRepositorysupply a trusted root that can mint any subject. The rule would claim a tie it does not provide, and it needs the executor to parse patterns written by someone else. - A
GitRepositorykept next to theOCIRepository, used only for the mapping. The mapper could then reuse every Git rule. But the Kustomization does not deliver from thatGitRepository, so itslastAppliedRevisionand Ready say nothing about it, and nothing would tie it to the artifact that is applied. The cluster would also fetch a repository only to give the executor a URL, with credentials for it. It trades a declaration in the settings for an object in the cluster that proves less. - Require the
OCIRepositoryobject to be delivered from Git. Not adopted here, and left for an ADR of its own. It would putspec.url,spec.refandspec.verifythrough review in Git, but two reasons keep it out. First, for an object whose author controls it, the requirement can be met in two ways unless it also names the delivering Kustomization: a path in any listed repository, and a Kustomization in another namespace that points at another reviewed directory. Second, checking it at the delivery read needs a read of Git files that the verifier does not have. - Declaring a branch, or a list of refs. See section 1 and section 2, step 6: a branch field can only repeat or contradict
targetBranch, and a list of refs needs its own threat note. - Reading the artifact's content from source-controller. It would let the mapping read the files that Flux applies. It needs a network path and a grant to source-controller's artifact server, widens the executor's reach much further, and gives content that is again from the cluster side. Not taken.
What is to be built¶
- API:
spec.ociSourceswith its CEL rules (includingverification, defaultRequired), generated manifests and CRD docs; the settings reference page; the rollout status fieldappliedFrom(GitRevision,OCIAnnotation). - Mapping:
fluxrulesrules for anOCIRepositorysource, the new reasons (among themOCISourceUnverified), the declaration, the verification check (step 4) and the ancestry check insourcemap, thespec.refrule of step 3 (SourceNotBranch, with the doc comment ofReasonSourceNotBranchwidened), the ref rule of step 6, the freshness check with the new input (sourcemap.Input.OCISources, passed fromsettings.Spec.OCISources), with theOCIRepositoryrecorded inObserved, read again after the scan and rechecked by freshness; the reasons added to the metrics list (denialReasonsininternal/controller/metrics.go) and to the explain table (cmd/kubectl-shadewright/explain.go). - Delivery:
AppliedRef,AppliedCommit,AttemptedRefandAttemptedCommitfrom the annotation of the current artifact (lastAppliedRevisionandlastAttemptedRevisioneach equal to its revision), the plan repository check, the verification check of step 4 and (with the plan's repository and the origin'sverificationpassed toVerifier.Verify),Pendingotherwise; the OCI message ofDeliveryNotObservedonly after anAppliedoutcome, inendDeliveryand indeliveryNotObserved, which is given the delivery; the read of theOCIRepositoryonly inVerifier.Verify; the lasting cause of a refused read; indelivered, an OCI unit applied only while the live value matches, with the OCI message at the end of the window;appliedFromrecorded. - RBAC: the opt-in ClusterRole in the chart and as a kustomize component, with the RBAC and chart test tables of section 3; AGENTS.md invariant 6 and the design document updated with the grant; the threat model (
docs/threat-model.md) gets the grant and the new actors the decision relies on, which its trusted computing base and actor lists do not name today: the writer of anOCIRepository(who chooses the source, the verification and its signer; limits (a) and (j)), the registry writer (limit (a) withverification: NotRequired), the accepted signer (limits (a) and ©) and the CI pipeline that builds the artifact (limit (b)). Each gets its Can and Cannot lines from those limits, and the executor's entry lists theOCIRepositoryread. - Docs: the reasons page (
docs/reasons.md), the delivery table ofdocs/troubleshooting.md(itsUnsupportedSourcerow says "Use a Git source"), the how-it-works source mapping page, a how-to for declaring an OCI source and forflux push artifact --source --revision; the settings reference and the how-to say that a keyless cosign verification needsmatchOIDCIdentityand that the patterns must name the pipeline; the page that explainsappliedFromsays what limit © says; the Flux line of the design (docs/design/2-architecture.md, section 2.5.2, today "Flux 2.3 and later; beta versions are not read") and the Flux row ofdocs/reference/compatibility.mdsay that an OCI source needs Flux 2.6 (limit (k)). - Tests that fail without the change: one per reason, the 403 case, the retry cases, a forged annotation that names another repository, and a lab run with an artifact pipeline. Also, each failing without its change:
- Path: a
spec.pathof../xand of../../xunder a declared path endsInvalidPath(it fails againstJoin(declared, spec.path)); a mixed-case annotation of a GitHub repository matches; theOCIRepositorychangingresourceVersionmid-scan is a retry. - Verification: a keyless cosign verification (no
secretRef) with an emptymatchOIDCIdentityendsOCISourceUnverifiedalthoughSourceVerifiedisTrue, and maps with one entry; a cosign verification with asecretRefand an empty list maps; anOCIRepositorywithoutspec.verify, one withSourceVerifiedFalse(VerificationError) and one whose condition has an oldobservedGenerationeach endOCISourceUnverified; withverification: NotRequiredthe first maps. A key-based and a Notation verification map. spec.ref: anOCIRepositorywithspec.ref.digest, one withspec.ref.semverand one withspec.ref.semverFiltereach endSourceNotBranch; one withspec.ref.tagand one withoutspec.refmap.- Ref: an annotation with a tag, with
refs/heads/<branch>and with another branch each endOCIOriginMismatch. - Ancestry, one test per class:
ErrInvalidCommitgivesOCIOriginUnrecorded;ErrNotFoundgivesOCIOriginMismatch; a 403 and a 422 stop withGitForbiddenandGitRejected; a 5xx, a rate limit and a network error retry, and a failed attempt counts toward the bounded Git read wait. - Freshness: an artifact replaced between the plan and the merge by one that matches the declaration leaves the plan fresh; one that does not makes it stale with
SourceChanged; one replaced while the check runs makes it a retry; an OCI request stays fresh across an unrelated merge and goes stale when the declaration'spathorrepositoryRefchanges (envtest);spec.verifyremoved from theOCIRepository, orSourceVerifiedsetFalsefor its current generation, between the plan and the merge makes the plan stale withSourceChanged(the whole mapping runs again, so step 4 stops it). - Delivery: a 403 on the
OCIRepositoryis retried, shows its cause onDeliveredand endsDeliveryNotCheckedwhen the window and grace pass, where a 403 on aGitRepositoryshows no cause as today; the analyzer's delivery status tool reads noOCIRepositoryand the analyzer has no grant on the kind. - Failed apply, per path. The adapter: a Kustomization with a failing condition whose
lastAttemptedRevisionis the current, verified artifact, annotated with the merge commit, gives the outcomeFailed(it givesPendingagainst the adapter ofmain); with alastAttemptedRevisionof an older artifact, or an unverified current one,Pending. With--verify-outcomes, at the end of the window: the merge commit endsFailedwithDeliveryFailed, a later commit that descends from itInconclusivewithDeliveryBlocked, each with its existing message, never the OCI one. Without--verify-outcomes: the same states end withRolledOutFalse,DeliveryNotObservedand the built-in text, never the OCI one. - Delivery verification: an
OCIRepositorywhosespec.verifyis removed, or whoseSourceVerifiedturnsFalse, after the merge while its artifact names the merge commit reads asPending, records nothing as applied and endsDeliveryNotObservedat the end of the window; withverification: NotRequiredit records applied. - Early artifact: an OCI unit whose Kustomization reports the merge commit applied while the field holds the old value records nothing and stays
WaitingForDelivery; it records the applied time and moves toVerifyingwhen the value arrives; when the window passes it endsInconclusivewithDeliveryNotObservedand the OCI message with--verify-outcomes, andRolledOutFalsewithDeliveryNotObservedand the OCI message without it; a Git unit in the same state still records applied at once.appliedFromisGitRevisionfor the Git unit andOCIAnnotationfor the OCI unit. - RBAC: the executor
getonocirepositoriesonly, with the value on; no rule for any identity with it off; nothing for the analyzer and the verifier either way.
Amendments¶
None.