Skip to content

fix(migrations): preserve legacy deployer intent after undeploy - #4076

Open
Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:test/fingerprint-comment-mtime
Open

Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:test/fingerprint-comment-mtime

Conversation

@Elvand-Lie

@Elvand-Lie Elvand-Lie commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4054

Legacy func.yaml files stored the selected deployer only under deploy.deployer. func delete clears that deployment state, so the next deploy fell back to the configured default instead of the deployer the function was using.

Add a 0.39.0 migration that recovers the missing top-level deployer intent from deploy.deployer. Explicit intent always wins, and observed state is left untouched.

Changes

  • Add migrateDeployerIntent at spec version 0.39.0 in pkg/functions/function_migrations.go
  • Add TestMigrateDeployerIntent for 0.38.0 and legacy 0.36.0 files, with explicit-intent and no-deployer controls
  • Add TestDelete_LegacyDeployerForRedeploy for CLI delete then redeploy with raw, KEDA and Knative, the global default, and flag and env overrides

Files already at 0.39.0 or later that only carry observed deployer state are outside this migration's scope.

/kind bug

Testing

go test -race ./pkg/functions/ ./cmd/ -count=1    # PASS

The recovery cases fail without the migration and pass with it; the control cases pass on both.

Release Note

Legacy functions retain their selected deployer after delete and redeploy instead of falling back to the configured default.

Docs


@knative-prow knative-prow Bot added the kind/cleanup Cleanup label Oct 11, 2026
@knative-prow knative-prow Bot added size/XS 🤖 PR changes 0-9 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Oct 11, 2026
@knative-prow

knative-prow Bot commented Oct 11, 2026

Copy link
Copy Markdown

Hi @Elvand-Lie. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Elvand-Lie Elvand-Lie changed the title test(functions): make funcignore comment test deterministic fix(migrations): preserve legacy deployer intent after undeploy Oct 11, 2026
@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. and removed size/XS 🤖 PR changes 0-9 lines, ignoring generated files. labels Oct 11, 2026
Legacy func.yaml files stored the chosen deployer only in observed
state. Deleting clears that state, causing redeploy to fall back to
the configured default. Recover missing top-level intent during
migration while preserving explicit intent and observed state.

Exercise real YAML loading and CLI delete, reload and redeploy for
legacy 0.36.0 and 0.38.0 files, all deployers, global defaults, and
flag and environment overrides. Keep plain redeploy as a control.

Fixes knative#4054

Assisted-by: OpenAI Codex and Claude Code
Signed-off-by: Elvand Lie Nababan <elvandlie@gmail.com>
@Elvand-Lie
Elvand-Lie force-pushed the test/fingerprint-comment-mtime branch from c1bc926 to d193619 Compare October 30, 2026 14:25
@knative-prow

knative-prow Bot commented Oct 30, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Elvand-Lie
Once this PR has been reviewed and has the lgtm label, please assign gauron99 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Elvand-Lie

Copy link
Copy Markdown
Contributor Author

Rebased onto main and dropped the fingerprint test change, since #4084 fixed that test upstream. This PR is now only the #4054 migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Cleanup needs-ok-to-test 🤖 Needs an org member to approve testing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Legacy deploy.deployer-only functions lose deployer intent on func delete then func deploy

1 participant