feat(bootstrap): use oms to install k0s instead of PC-installer#487
Open
Jcing95 wants to merge 2 commits into
Open
feat(bootstrap): use oms to install k0s instead of PC-installer#487Jcing95 wants to merge 2 commits into
Jcing95 wants to merge 2 commits into
Conversation
Signed-off-by: Jcing95 <23337729+Jcing95@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the GCP bootstrap flow so oms beta bootstrap-gcp provisions the k0s cluster via a dedicated oms install k0s step, instead of relying on the installer package’s internal kubernetes step, making cluster creation explicit and reusable.
Changes:
- Added a separate “ensure installer package” step that downloads/copies the Codesphere package onto the jumpbox and stores the resulting filename for reuse.
- Added a standalone “Install k0s” bootstrap step and reordered the install sequence to run k0s before installing Codesphere.
- Updated skip-step argument generation to always skip the installer’s
kubernetesstep; updated unit tests accordingly.
Reviewed changes
Copilot reviewed 2 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/bootstrap/gcp/gcp.go | Adds EnsureCodespherePackage + InstallK0s, reorders bootstrap install flow, always skips installer kubernetes step. |
| internal/bootstrap/gcp/gcp_test.go | Updates tests to cover the new package → k0s → codesphere sequence and failure paths. |
| internal/bootstrap/gcp/mocks.go | Updates generated mocks to use any in expecter signatures. |
| internal/util/mocks.go | Updates generated mocks to use any (including variadic helpers). |
| internal/system/mocks.go | Updates generated mocks to use any. |
| internal/portal/mocks.go | Updates generated mocks to use any. |
| internal/installer/node/mocks.go | Updates generated mocks to use any. |
| internal/installer/mocks.go | Updates generated mocks to use any. |
| internal/github/mocks.go | Updates generated mocks to use any. |
| internal/codesphere/mocks.go | Updates generated mocks to use any. |
Files not reviewed (8)
- internal/bootstrap/gcp/mocks.go: Generated file
- internal/codesphere/mocks.go: Generated file
- internal/github/mocks.go: Generated file
- internal/installer/mocks.go: Generated file
- internal/installer/node/mocks.go: Generated file
- internal/portal/mocks.go: Generated file
- internal/system/mocks.go: Generated file
- internal/util/mocks.go: Generated file
Comments suppressed due to low confidence (1)
internal/bootstrap/gcp/gcp.go:1004
- InstallCodesphere now assumes EnsureCodespherePackage has already run and populated b.packageFilename. Adding an explicit check will prevent running
oms install codespherewith an empty-pvalue when the method is called out of sequence (e.g., from another caller/test), and will produce a clearer error.
func (b *GCPBootstrapper) InstallCodesphere() error {
err := b.runInstallCommand(b.packageFilename)
if err != nil {
return fmt.Errorf("failed to install Codesphere from jumpbox: %w", err)
}
return nil
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+990
to
+995
| func (b *GCPBootstrapper) InstallK0s() error { | ||
| b.stlog.Logf("Installing k0s cluster...") | ||
| installCmd := fmt.Sprintf("oms install k0s --install-config %s --package %s", | ||
| remoteInstallConfigPath, b.packageFilename) | ||
| return b.Env.Jumpbox.RunSSHCommand("root", installCmd) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Make
oms beta bootstrap-gcpcreate the k0s cluster as its own bootstrap step usingoms install k0s, instead of relying on thekubernetesstep inside theprivate-cloud-installer.
Why
Today the k0s cluster is created by the
kubernetesstep insideoms install codesphere'sprivate-cloud-installer.js. Decoupling cluster creation fromthe Codesphere app install gives the bootstrap a single, explicit, reusable cluster-creation
step (mirroring how the local bootstrapper already separates cluster creation from the
post-cluster component steps
setUpCluster/codesphere/msBackends). It also unblocksa follow-up PR that will install OpenBao against the cluster before the app install.
Changes
EnsureCodespherePackagestep — factors the installer-package download/copy out ofInstallCodesphereso the package is on the jumpbox before k0s; the filename is stored onthe bootstrapper and reused by the later steps.
InstallK0sstep — runsoms install k0s --install-config /etc/codesphere/config.yaml --package <pkg>on the jumpbox. k0sctl uploads the package's bundled k0s binary, so the k0s version stays
aligned with the Codesphere package.
Bootstrap()install block to: Ensure Codesphere package → Install k0s →Install Codesphere → Run k0s config script (still gated on
--install-version/--install-local).generateSkipStepsArg()always skips the installer'skubernetesstep now that thebootstrap owns cluster creation. The post-cluster steps (
set-up-cluster,codesphere,ms-backends) still run. The existingload-container-imagesskip for the GitHub registrytype is preserved.
Behavior notes
installer always skips
kubernetes.oms install k0son the jumpbox reaches the internal node IPs via the forwarded SSH agent(same mechanism the installer's internal k0sctl uses today).
Testing
internal/bootstrap/gcp/gcp_test.gocovering the newpackage → k0s → codesphere sequence, the
-s kubernetes[,load-container-images]skip arg,and k0s/package failure paths.
--install-version— confirmoms install k0sbrings all nodes Ready and
oms install codespherecompletes with--skipStep kubernetes.