Skip to content

fix(dryrun): resolve Target from label not Config name#448

Open
alexandernorth wants to merge 3 commits into
mainfrom
bugfix/fix-dryrun-failure
Open

fix(dryrun): resolve Target from label not Config name#448
alexandernorth wants to merge 3 commits into
mainfrom
bugfix/fix-dryrun-failure

Conversation

@alexandernorth
Copy link
Copy Markdown
Contributor

@alexandernorth alexandernorth commented May 20, 2026

Summary

--dry-run=server against a Config whose name differs from its target's name failed with:

Internal error occurred: Target.config.sdcio.dev "<config namespace.name>" not found

The dry-run path in ConfigStoreHandler.prepareConfigAndTarget discarded the
NamespacedName returned by config.GetTargetKey(labels) and looked up the
Target using the Config's own key instead. The same wrong key was then
propagated as the DatastoreName in the TransactionSet RPC.

Non-dry-run applies were unaffected because the API server only persists the
Config and the actual target resolution happens later in the reconcilers,
which correctly read config.sdcio.dev/targetName / targetNamespace from
the labels.

Changes

  • Use the label-derived targetKey for the Target lookup in
    prepareConfigAndTarget.
  • Drop the unused key types.NamespacedName parameter from
    RunDryRunTransaction; derive DatastoreName from the resolved *Target
    using storebackend.KeyFromNSN(...).String(), matching the convention used
    by every other call site (pkg/reconcilers/rollout/transaction.go,
    apis/config/target_helpers.go, pkg/reconcilers/targetdatastore/reconciler.go,
    etc.). The previous types.NamespacedName.String() ("ns/name") did not match
    the format the datastore is registered under ("ns.name").

@alexandernorth alexandernorth requested a review from a team as a code owner May 20, 2026 15:02
@github-project-automation github-project-automation Bot moved this to Backlog in SDC project May 20, 2026
@alexandernorth alexandernorth moved this from Backlog to In review in SDC project May 20, 2026
Copy link
Copy Markdown
Contributor

@henderiw henderiw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the most consistent code is if you do this

targetKey := storebackend.KeyFromNSN(target.GetNamespacedName())

iso key -> this would change only 1 place in the dryRun File

Copy link
Copy Markdown
Contributor

@severindellsperger severindellsperger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Maybe address my comment.

Comment thread apis/config/handlers/confighandler.go Outdated
@alexandernorth
Copy link
Copy Markdown
Contributor Author

the most consistent code is if you do this

targetKey := storebackend.KeyFromNSN(target.GetNamespacedName())

iso key -> this would change only 1 place in the dryRun File

Ok, I adjusted the code to match this

@alexandernorth alexandernorth added the safe to test Apply this label for PRs to kick off CI integration testing label May 21, 2026
@henderiw
Copy link
Copy Markdown
Contributor

LGTM

@alexandernorth alexandernorth force-pushed the bugfix/fix-dryrun-failure branch from b5847bd to c50847f Compare May 22, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Apply this label for PRs to kick off CI integration testing

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants