-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add LTS 1.77.2 compatibility and enhance related functionalities #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
OliverTrautvetter
wants to merge
41
commits into
main
Choose a base branch
from
feat/bootstrap-support-lts-1.77.2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
8b77910
chore: try bootstrapping 1.77.2 with oms
joka134 b5cf9da
chore: add more postgres ms details
joka134 da348ed
chore(docs): Auto-update docs and licenses
joka134 95135cc
fix: omitempty
joka134 4d2534c
update(deps): update module k8s.io/endpointslice to v0.36.0 (#344)
CodesphereBot e459f6e
update(deps): update module k8s.io/externaljwt to v0.36.0 (#345)
CodesphereBot 3c403ec
update(deps): update module k8s.io/kms to v0.36.0 (#346)
CodesphereBot e6010f0
update(deps): update module github.com/google/go-github/v74 to v85 (#…
CodesphereBot 83cc48a
update(deps): update github.com/rook/rook/pkg/apis digest to b87c434 …
CodesphereBot 09fa6d3
update(deps): update module github.com/onsi/ginkgo/v2 to v2.28.2 (#350)
CodesphereBot db26737
feat: add command to create a test user for automated testing (#329)
joka134 8baf243
Merge remote-tracking branch 'origin/main' into HEAD
joka134 720b8c7
fix: enable critical components for pc
joka134 b5139e0
Merge branch 'main' into feat/bootstrap-support-lts-1.77.2
joka134 9d502dc
chore(docs): Auto-update docs and licenses
joka134 8897e02
chore(docs): Auto-update docs and licenses
joka134 81a5205
fix: clear ManagedServices in LTS 1.77.2 compat mode
OliverTrautvetter 3993470
feat: add LTS 1.77.2 compatibility support and related tests
OliverTrautvetter f2be9be
Merge branch 'main' into feat/bootstrap-support-lts-1.77.2
OliverTrautvetter 0e512c1
chore(docs): Auto-update docs and licenses
joka134 2e6ab35
fix: lint
OliverTrautvetter 89ce4fe
feat: handle HTTP 429 rate limit response in PortalClient
OliverTrautvetter 0afb316
feat: implement LTS 1.77.2 compatibility and add BuildOmsLinuxBinary …
OliverTrautvetter b19e7f3
feat: add support for LTS 1.77.2 compatibility and refactor related f…
OliverTrautvetter 1317d9a
feat: enhance download functionality with retry logic for stale files…
OliverTrautvetter 5cc3c45
fix: lint
OliverTrautvetter 8142975
Merge branch 'main' into feat/bootstrap-support-lts-1.77.2
OliverTrautvetter a576ef9
fix: tests
OliverTrautvetter ee60530
feat: add SSHAddress and SSHPort fields to K8sNode for enhanced confi…
OliverTrautvetter 5921182
test: update Dockerfile test to write content to temp file before reo…
OliverTrautvetter 61ad470
fix: use os.Pipe() in update_dockerfile tests to avoid EBADF on Linux
OliverTrautvetter 78626eb
Merge branch 'main' into feat/bootstrap-support-lts-1.77.2
OliverTrautvetter a13cb71
chore(docs): Auto-update docs and licenses
OliverTrautvetter 0c34f8d
fix: improve error handling and retry logic in DownloadBuild method
OliverTrautvetter 54a82cd
Merge remote-tracking branch 'origin/main' into feat/bootstrap-suppor…
OliverTrautvetter 72be25e
fix: reset download package
OliverTrautvetter 033e14e
fix: reset download package test
OliverTrautvetter 6d1d543
ref: remove commented-out schema definitions in applyCommonProperties
OliverTrautvetter 02b27bb
Merge branch 'main' into feat/bootstrap-support-lts-1.77.2
OliverTrautvetter 3482aad
feat: enhance PostgreSQL and S3 managed services with new configurati…
OliverTrautvetter 811f21f
feat: enhance LTS support with new config handling and Ceph master wa…
OliverTrautvetter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ oms beta bootstrap-gcp [flags] | |
| --datacenter-name string Datacenter name (default: dev) (default "dev") | ||
| --dns-project-id string GCP Project ID for Cloud DNS (optional) | ||
| --dns-zone-name string Cloud DNS Zone Name (optional) (default "oms-testing") | ||
| --experiments stringArray Experiments to enable in Codesphere installation (optional) (default [managed-services,headless-services,vcluster,custom-service-image,ms-in-ls,secret-management,sub-path-mount]) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why disable them by default? Aren't they required for new versions? |
||
| --experiments stringArray Experiments to enable in Codesphere installation (optional) (default [managed-services,custom-service-image,ms-in-ls,secret-management,sub-path-mount]) | ||
| --external-loki-endpoint string External Loki endpoint for Grafana Alloy log forwarding (optional) | ||
| --external-loki-secret string External Loki password stored in the generated vault (optional) | ||
| --external-loki-user string External Loki username for Grafana Alloy log forwarding (optional) | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,8 +62,6 @@ func GetDNSRecordNames(baseDomain string) []struct { | |
|
|
||
| var DefaultExperiments []string = []string{ | ||
| "managed-services", | ||
| "headless-services", | ||
| "vcluster", | ||
| "custom-service-image", | ||
| "ms-in-ls", | ||
| "secret-management", | ||
|
|
@@ -80,9 +78,10 @@ type GCPBootstrapper struct { | |
| // Environment | ||
| Env *CodesphereEnvironment | ||
| // SSH command runner | ||
| NodeClient node.NodeClient | ||
| PortalClient portal.Portal | ||
| GitHubClient github.GitHubClient | ||
| NodeClient node.NodeClient | ||
| PortalClient portal.Portal | ||
| GitHubClient github.GitHubClient | ||
| OmsBinaryBuilder func() (string, func(), error) | ||
| } | ||
|
|
||
| type CodesphereEnvironment struct { | ||
|
|
@@ -182,16 +181,17 @@ func NewGCPBootstrapper( | |
| gitHubClient github.GitHubClient, | ||
| ) (*GCPBootstrapper, error) { | ||
| return &GCPBootstrapper{ | ||
| ctx: ctx, | ||
| stlog: stlog, | ||
| fw: fw, | ||
| icg: icg, | ||
| GCPClient: gcpClient, | ||
| Env: CodesphereEnv, | ||
| NodeClient: sshRunner, | ||
| PortalClient: portalClient, | ||
| Time: time, | ||
| GitHubClient: gitHubClient, | ||
| ctx: ctx, | ||
| stlog: stlog, | ||
| fw: fw, | ||
| icg: icg, | ||
| GCPClient: gcpClient, | ||
| Env: CodesphereEnv, | ||
| NodeClient: sshRunner, | ||
| PortalClient: portalClient, | ||
| Time: time, | ||
| GitHubClient: gitHubClient, | ||
| OmsBinaryBuilder: BuildOmsLinuxBinary, | ||
| }, nil | ||
| } | ||
|
|
||
|
|
@@ -922,6 +922,16 @@ func (b *GCPBootstrapper) InstallCodesphere() error { | |
| return fmt.Errorf("failed to ensure Codesphere package on jumpbox: %w", err) | ||
| } | ||
|
|
||
| if ltsSpec := FindLTSSpec(b.Env.InstallVersion); ltsSpec != nil { | ||
| if ltsSpec.RequiresOmsBinaryUpdate { | ||
| if err := b.ensureNewOmsBinaryOnJumpbox(); err != nil { | ||
| return fmt.Errorf("failed to update OMS binary on jumpbox for %s: %w", b.Env.InstallVersion, err) | ||
| } | ||
| } | ||
| b.startLTSCephMasterWatcher() | ||
| defer b.stopLTSCephMasterWatcher() | ||
| } | ||
|
|
||
| err = b.runInstallCommand(fullPackageFilename) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to install Codesphere from jumpbox: %w", err) | ||
|
|
@@ -930,6 +940,61 @@ func (b *GCPBootstrapper) InstallCodesphere() error { | |
| return nil | ||
| } | ||
|
|
||
| // ensureNewOmsBinaryOnJumpbox copies a freshly-built linux/amd64 OMS binary to | ||
| // the jumpbox, replacing the old installed version. | ||
| func (b *GCPBootstrapper) ensureNewOmsBinaryOnJumpbox() error { | ||
| b.stlog.Logf("Updating OMS binary on jumpbox for %s compatibility...", b.Env.InstallVersion) | ||
|
|
||
| binaryPath, cleanup, err := b.OmsBinaryBuilder() | ||
| if err != nil { | ||
| return fmt.Errorf("failed to prepare OMS linux binary: %w", err) | ||
| } | ||
| defer cleanup() | ||
|
|
||
| const remoteTmpPath = "/tmp/oms-new" | ||
| if err := b.Env.Jumpbox.NodeClient.CopyFile(b.Env.Jumpbox, binaryPath, remoteTmpPath); err != nil { | ||
| return fmt.Errorf("failed to copy OMS binary to jumpbox: %w", err) | ||
| } | ||
|
|
||
| if err := b.Env.Jumpbox.RunSSHCommand("root", fmt.Sprintf("chmod +x %s && mv %s /usr/local/bin/oms", remoteTmpPath, remoteTmpPath)); err != nil { | ||
| return fmt.Errorf("failed to install OMS binary on jumpbox: %w", err) | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| // startLTSCephMasterWatcher starts a background process on the ceph master node that continuously | ||
| // re-adds the master to the Ceph orchestrator host inventory. This is required for LTS versions | ||
| // because the installer's configureHosts step applies a declarative host spec containing only the | ||
| // non-master nodes, which removes the master from the inventory. The watcher restores it within | ||
| // seconds, before the subsequent configureMonitors step runs. | ||
| func (b *GCPBootstrapper) startLTSCephMasterWatcher() { | ||
| if len(b.Env.CephNodes) == 0 || len(b.Env.InstallConfig.Ceph.Hosts) == 0 { | ||
| return | ||
| } | ||
| masterHost := b.Env.InstallConfig.Ceph.Hosts[0] | ||
| // Use cephadm shell (same as the installer) so the command runs inside the ceph container, | ||
| // bypassing any standalone-binary or keyring availability issues on the host. | ||
| // The FSID is auto-detected from /var/lib/ceph/; all output is logged for diagnostics. | ||
| cmd := fmt.Sprintf( | ||
| `nohup bash -c "while true; do FSID=\$(ls /var/lib/ceph/ 2>/dev/null | head -1); [ -n \"\$FSID\" ] && [ -x /usr/local/bin/cephadm ] && /usr/local/bin/cephadm shell --fsid \"\$FSID\" -- ceph orch host add %s %s 2>&1; sleep 3; done" > /tmp/ceph-host-watcher.log 2>&1 & echo $! > /tmp/ceph-host-watcher.pid`, | ||
| masterHost.Hostname, | ||
| masterHost.IPAddress, | ||
| ) | ||
| if err := b.Env.CephNodes[0].RunSSHCommand("root", cmd); err != nil { | ||
| b.stlog.Logf("Note: could not start ceph master host watcher on %s: %v", masterHost.Hostname, err) | ||
| } | ||
| } | ||
|
|
||
| // stopLTSCephMasterWatcher stops the background watcher started by startLTSCephMasterWatcher. | ||
| func (b *GCPBootstrapper) stopLTSCephMasterWatcher() { | ||
| if len(b.Env.CephNodes) == 0 || len(b.Env.InstallConfig.Ceph.Hosts) == 0 { | ||
| return | ||
| } | ||
| cmd := `kill $(cat /tmp/ceph-host-watcher.pid 2>/dev/null) 2>/dev/null; rm -f /tmp/ceph-host-watcher.pid /tmp/ceph-host-watcher.log` | ||
| _ = b.Env.CephNodes[0].RunSSHCommand("root", cmd) | ||
| } | ||
|
|
||
| func (b *GCPBootstrapper) ensureCodespherePackageOnJumpbox() (string, error) { | ||
| packageFilename := "installer.tar.gz" | ||
| if b.Env.RegistryType == RegistryTypeGitHub { | ||
|
|
@@ -959,7 +1024,13 @@ func (b *GCPBootstrapper) ensureCodespherePackageOnJumpbox() (string, error) { | |
| packageFilename, b.Env.InstallHash, b.Env.InstallVersion) | ||
| err := b.Env.Jumpbox.RunSSHCommand("root", downloadCmd) | ||
| if err != nil { | ||
| return "", fmt.Errorf("failed to download Codesphere package from jumpbox: %w", err) | ||
| // A stale partial file from a previous (different) build can cause MD5 verification to | ||
| // fail even after a successful byte-range resume. Delete it and retry from scratch. | ||
| b.stlog.Logf("Download failed; removing any stale partial file and retrying from scratch...") | ||
| cleanAndRetryCmd := fmt.Sprintf("rm -f %s && %s", fullPackageFilename, downloadCmd) | ||
| if retryErr := b.Env.Jumpbox.RunSSHCommand("root", cleanAndRetryCmd); retryErr != nil { | ||
| return "", fmt.Errorf("failed to download Codesphere package from jumpbox: %w", retryErr) | ||
| } | ||
|
Comment on lines
+1027
to
+1033
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after the discussion today: this should simply fail |
||
| } | ||
|
|
||
| return fullPackageFilename, nil | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this cause some issues? Why changing it in this PR?