fix: handle --restore flag in platform driver create path#3563
fix: handle --restore flag in platform driver create path#3563pascalbreuninger wants to merge 1 commit intomainfrom
Conversation
Fixes ENGPROV-118. The CreatePlatform function never checked options.Restore, silently ignoring the --restore flag when using --driver platform. This adds a Restore() call after the vCluster instance is created and ready, matching the behavior of the helm driver code path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6164321651
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if options.Restore != "" { | ||
| log.Infof("Restore vCluster %s...", virtualClusterName) | ||
| err = Restore(ctx, []string{virtualClusterName, options.Restore}, globalFlags, &snapshot.Options{}, &pod.Options{}, false, false, log) |
There was a problem hiding this comment.
Use new-vcluster restore mode for fresh platform creates
When --restore is used during a fresh platform create, CreatePlatform always calls Restore(..., newVCluster=false, ...), so the restore pod omits --new-vcluster (see restore_helm.go where the flag is only added when newVCluster is true). That means the restore runs in “restore into existing cluster” mode, which keeps mappings and cluster-specific objects that are supposed to be skipped for a brand-new cluster. This can lead to stale mappings/certs being restored or restore failures in new clusters. The Helm create path passes newVCluster=true after a fresh install, so platform should mirror that behavior when the vcluster was just created.
Useful? React with 👍 / 👎.
Summary
The
--restoreflag was silently ignored when creating a vCluster with--driver platform. This adds restore handling to the platform driver create path, matching the helm driver behavior.Root Cause
CreatePlatform()inpkg/cli/create_platform.gonever checkedoptions.Restoreand never calledRestore(), while the helm driver path did.Fix
Added a check for
options.Restoreafter vCluster creation inCreatePlatform(). When set, it callsRestore()with the snapshot path, matching the helm driver behavior.Testing
TestCreatePlatform_RestoreNotIgnored_ENGPROV118that verifiesCreatePlatformhandles the restore flag./pkg/cli/...tests passReproduction
See reproduction steps in ENGPROV-118
Linear
Fixes ENGPROV-118