Skip to content

feat(bootstrap): use oms to install k0s instead of PC-installer#487

Open
Jcing95 wants to merge 2 commits into
mainfrom
use-k0s-in-bootstrap
Open

feat(bootstrap): use oms to install k0s instead of PC-installer#487
Jcing95 wants to merge 2 commits into
mainfrom
use-k0s-in-bootstrap

Conversation

@Jcing95

@Jcing95 Jcing95 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

Make oms beta bootstrap-gcp create the k0s cluster as its own bootstrap step using
oms install k0s, instead of relying on the kubernetes step inside the
private-cloud-installer.

Why

Today the k0s cluster is created by the kubernetes step inside
oms install codesphere's private-cloud-installer.js. Decoupling cluster creation from
the 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 unblocks
a follow-up PR that will install OpenBao against the cluster before the app install.

Changes

  • New EnsureCodespherePackage step — factors the installer-package download/copy out of
    InstallCodesphere so the package is on the jumpbox before k0s; the filename is stored on
    the bootstrapper and reused by the later steps.
  • New InstallK0s step — runs oms 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.
  • Reordered 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's kubernetes step now that the
    bootstrap owns cluster creation. The post-cluster steps (set-up-cluster, codesphere,
    ms-backends) still run. The existing load-container-images skip for the GitHub registry
    type is preserved.

Behavior notes

  • Applies to every GCP bootstrap: k0s is always created by the standalone step and the
    installer always skips kubernetes.
  • oms install k0s on the jumpbox reaches the internal node IPs via the forwarded SSH agent
    (same mechanism the installer's internal k0sctl uses today).
  • OpenBao is out of scope for this PR.

Testing

  • Unit tests updated/added in internal/bootstrap/gcp/gcp_test.go covering the new
    package → k0s → codesphere sequence, the -s kubernetes[,load-container-images] skip arg,
    and k0s/package failure paths.
  • TODO before merge: end-to-end GCP bootstrap with --install-version — confirm oms install k0s
    brings all nodes Ready and oms install codesphere completes with --skipStep kubernetes.

@Jcing95 Jcing95 self-assigned this Jun 15, 2026
Signed-off-by: Jcing95 <23337729+Jcing95@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 kubernetes step; 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 codesphere with an empty -p value 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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants