-
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
base: main
Are you sure you want to change the base?
Changes from all commits
8b77910
b5cf9da
da348ed
95135cc
4d2534c
e459f6e
3c403ec
e6010f0
83cc48a
09fa6d3
db26737
8baf243
720b8c7
b5139e0
9d502dc
8897e02
81a5205
3993470
f2be9be
0e512c1
2e6ab35
89ce4fe
0afb316
b19e7f3
1317d9a
5cc3c45
8142975
a576ef9
ee60530
5921182
61ad470
78626eb
a13cb71
0c34f8d
54a82cd
72be25e
033e14e
6d1d543
02b27bb
3482aad
811f21f
45a9e77
79d78a5
01d0847
864cf04
0fc97de
24c846c
858fd98
c2e2e72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,9 +80,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 { | ||
|
|
@@ -189,16 +190,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 | ||
| } | ||
|
|
||
|
|
@@ -964,6 +966,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() | ||
|
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. Which LTS versions need this? Is this fixed on current master?
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. If yes, we can have a flag for the lts version if this needs to be executed |
||
| defer b.stopLTSCephMasterWatcher() | ||
| } | ||
|
|
||
| err = b.runInstallCommand(fullPackageFilename) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to install Codesphere from jumpbox: %w", err) | ||
|
|
@@ -972,6 +984,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() { | ||
|
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. So we are fighting a bug in the 1.77.2 LTS release here? 🙈 |
||
| 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 { | ||
|
|
@@ -999,8 +1066,7 @@ func (b *GCPBootstrapper) ensureCodespherePackageOnJumpbox() (string, error) { | |
| b.stlog.Logf("Downloading Codesphere package...") | ||
| downloadCmd := fmt.Sprintf("oms download package -f %s -H %s %s", | ||
| packageFilename, b.Env.InstallHash, b.Env.InstallVersion) | ||
| err := b.Env.Jumpbox.RunSSHCommand("root", downloadCmd) | ||
| if err != nil { | ||
| if err := b.Env.Jumpbox.RunSSHCommand("root", downloadCmd); err != nil { | ||
| return "", fmt.Errorf("failed to download Codesphere package from jumpbox: %w", err) | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.