Skip to content

Commit

Permalink
PRODENG-2724 v1.3 and mcr-only fix (#501)
Browse files Browse the repository at this point in the history
* PRODENG-2724 v1.3 and mcr-only fix

- 1.3->1.4 migration no longer adds a default MKE block, but now emits a
  warning instead saying that it will be considered an MCR-Only cluster
- corrected another possible panic on MCR upgrade

ALSO

- new linting issues (new version of linter) in versioning
- version code was printing wrong error

Signed-off-by: James Nesbitt <[email protected]>
  • Loading branch information
james-nesbitt authored Aug 14, 2024
1 parent fbaac31 commit a79a6b0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pkg/config/migration/v13/v13.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ func Migrate(plain map[string]interface{}) error {
}
}
} else {
spec["mke"] = map[string]string{"version": "3.4.0"}
log.Debugf("migration defaulted MKE version to %s as an explicit version is required on the v1.4 api", mke["version"])
log.Warn("v1.3 api is missing MKE configuration, which used to get added for you, but now results in an MCR only install")
}

if msr, ok := spec["msr"].(map[interface{}]interface{}); ok {
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/migration/v13/v13_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ spec:
- role: msr
ssh:
address: 10.0.0.3
mke:
version: 3.4.0
msr:
version: 2.9.0
`)
Expand Down
2 changes: 1 addition & 1 deletion pkg/product/mke/phase/upgrade_mcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (p *UpgradeMCR) upgradeMCRs() error {
return fmt.Errorf("upgrade MCR failed. %w", err)
}
}
if p.Config.Spec.MKE.Metadata.Installed {
if p.Config.Spec.MKE != nil && p.Config.Spec.MKE.Metadata.Installed {
err := p.Config.Spec.CheckMKEHealthLocal(managers)
if err != nil {
return fmt.Errorf("checkMKEHealthLocal failed. %w", err)
Expand Down
6 changes: 3 additions & 3 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func latestTag(timeout time.Duration) string {
}

baseMsg := "getting launchpad tag list"
log.Debugf(baseMsg)
log.Debug(baseMsg)
resp, err := client.Get(fmt.Sprintf("https://api.github.com/repos/%s/tags?per_page=20&page=1", GitHubRepo))
if err != nil {
log.Debugf("%s failed: %s", baseMsg, err.Error())
Expand Down Expand Up @@ -149,7 +149,7 @@ func GetLatest(timeout time.Duration) *LaunchpadRelease {
}

baseMsg := fmt.Sprintf("getting launchpad release information for version %s", tag)
log.Debugf(baseMsg)
log.Debug(baseMsg)
resp, err := client.Get(fmt.Sprintf("https://api.github.com/repos/%s/releases/tags/%s", GitHubRepo, tag))
if err != nil {
log.Debugf("%s failed: %s", baseMsg, err.Error())
Expand All @@ -165,7 +165,7 @@ func GetLatest(timeout time.Duration) *LaunchpadRelease {
}
body, readErr := io.ReadAll(resp.Body)
if readErr != nil {
log.Debugf("%s failed to read body: %s", baseMsg, err.Error())
log.Debugf("%s failed to read body: %s", baseMsg, readErr.Error())
return nil // ignore reading errors
}

Expand Down

0 comments on commit a79a6b0

Please sign in to comment.