-
Notifications
You must be signed in to change notification settings - Fork 3
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
V2 upgrades without manager #1757
Conversation
This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID. Online Installer:
Airgap Installer (may take a few minutes before the airgap bundle is built):
Happy debugging! |
4925045
to
da76031
Compare
da76031
to
2fcf916
Compare
* remove TestInstallWithoutEmbed * use new install * check postupgrade override labels * fix extension upgrade messages * further improve wording * fix nil map issue when upgrading operator * f * Update pkg/extensions/upgrade.go * Update pkg/extensions/upgrade.go --------- Co-authored-by: Salah Al Saleh <sg.alsaleh@gmail.com>
* add comments to ignore deprecated BuiltinConfigs field * fix linting
* chore: no spinner if no terminal (#1778) * fix panic in TestHostPreflightCustomSpec * fix compile * require license for install2 * f * f * use single-node-install.sh in LAM e2e test * improve sudo test logging * ??? * see if it's just one thing failing in sudo test * use join2 command in 'node join'. Hide 'node' commands * improve how we are requiring the license flag for installation --------- Co-authored-by: Ethan Mosbaugh <ethan@replicated.com>
* feat(v2): fix e2e TestVersion * f * f
Short: fmt.Sprintf("Experimental installer for %s", name), | ||
Hidden: true, | ||
Use: "install", | ||
Short: fmt.Sprintf("Experimental installer for %s", name), |
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.
Fix this
@@ -214,6 +220,8 @@ func preRunInstall2(cmd *cobra.Command, flags *Install2CmdFlags) error { | |||
|
|||
flags.isAirgap = flags.airgapBundle != "" | |||
|
|||
flags.isAirgap = flags.airgapBundle != "" |
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.
this is duplicated
return nil | ||
} | ||
|
||
func handleExtensionInstall(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart) (finalErr error) { |
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.
func handleExtensionInstall(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart) (finalErr error) { | |
func handleExtensionInstall(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart) error { |
}) | ||
} | ||
|
||
func handleExtensionUpgrade(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart, needsUpgrade bool) (finalErr error) { |
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.
func handleExtensionUpgrade(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart, needsUpgrade bool) (finalErr error) { | |
func handleExtensionUpgrade(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart, needsUpgrade bool) error { |
}) | ||
} | ||
|
||
func handleExtensionUninstall(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart) (finalErr error) { |
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.
func handleExtensionUninstall(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart) (finalErr error) { | |
func handleExtensionUninstall(ctx context.Context, kcli client.Client, hcli helm.Client, in *ecv1beta1.Installation, ext ecv1beta1.Chart) error { |
for _, k := range keys { | ||
version := applierVersions[k] | ||
version := versionsMap[k] | ||
if !strings.HasPrefix(version, "v") { | ||
version = fmt.Sprintf("v%s", version) |
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.
are we sure we want to prepend a v to extensions versions?
continue | ||
} | ||
break | ||
return err |
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.
this masks the error. should return upgradeErr
for _, k := range keys { | ||
version := applierVersions[k] | ||
version := versionsMap[k] | ||
if !strings.HasPrefix(version, "v") { | ||
version = fmt.Sprintf("v%s", version) |
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.
are we sure we want to prepend a v to extensions versions?
|
||
func SetConditionStatus(ctx context.Context, cli client.Client, in *ecv1beta1.Installation, condition metav1.Condition) error { | ||
return retry.RetryOnConflict(retry.DefaultRetry, func() error { | ||
var copy ecv1beta1.Installation |
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.
Do we still need this to be a copy or can we use in
directly? This seems like a misuse of the controller runtime client.
err = reApplyInstallation(ctx, cli, in) | ||
if err != nil { | ||
return fmt.Errorf("unlock installation: %w", err) | ||
} | ||
|
||
err = support.CreateHostSupportBundle() | ||
if err != nil { | ||
logrus.Warnf("Failed to upgrade host support bundle: %v", err) | ||
logrus.Warnf("upgrade host support bundle: %v", err) |
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.
Should put this back as it was more readable before
logrus.Warnf("upgrade host support bundle: %v", err) | |
logrus.Warnf("Failed to upgrade host support bundle: %v", err) |
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.
This should also probably be slog
Force: false, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "upgrade admin console") | ||
return errors.Wrap(err, "upgrade") |
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.
return errors.Wrap(err, "upgrade") | |
return errors.Wrap(err, "helm upgrade") |
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.
i feel like "upgrade admin console" is more accurate here though
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.
i dont think so because that will be duplicated if you look up the stack. this is calling helm client upgrade so we should wrap it with exactly what it does
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.
looks like you comment was on old code. it only says upgrade
in the final version
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.
In my opinion we should wrap with the addon name as far up the stack as possible #1757 (comment)
}) | ||
if err != nil { | ||
return errors.Wrap(err, "install metrics operator") | ||
return errors.Wrap(err, "install") |
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.
return errors.Wrap(err, "install") | |
return errors.Wrap(err, "helm install") |
}) | ||
if err != nil { | ||
return errors.Wrap(err, "install admin console") | ||
return errors.Wrap(err, "install") |
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.
return errors.Wrap(err, "install") | |
return errors.Wrap(err, "helm install") |
Version: Metadata.Version, | ||
Values: string(values), | ||
TargetNS: namespace, | ||
ForceUpgrade: ptr.To(false), |
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.
This is set to false while it is set to true in pkg/addons2/embeddedclusteroperator/upgrade.go on line 37
_, err = hcli.Upgrade(ctx, helm.UpgradeOptions{
ReleaseName: releaseName,
ChartPath: e.ChartLocation(),
ChartVersion: e.ChartVersion(),
Values: values,
Namespace: namespace,
Labels: getBackupLabels(),
Force: true,
})
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.
oh interesting. we should probably change that to false.
Force: true, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "upgrade") |
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.
return errors.Wrap(err, "upgrade") | |
return errors.Wrap(err, "helm upgrade") |
Force: false, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "upgrade") |
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.
return errors.Wrap(err, "upgrade") | |
return errors.Wrap(err, "helm upgrade") |
Force: false, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "upgrade") |
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.
return errors.Wrap(err, "upgrade") | |
return errors.Wrap(err, "helm upgrade") |
Force: false, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "upgrade registry") | ||
return errors.Wrap(err, "upgrade") |
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.
return errors.Wrap(err, "upgrade") | |
return errors.Wrap(err, "helm upgrade") |
Force: false, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "upgrade") |
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.
return errors.Wrap(err, "upgrade") | |
return errors.Wrap(err, "helm upgrade") |
Namespace: namespace, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "install openebs") | ||
return errors.Wrap(err, "install") |
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.
return errors.Wrap(err, "install") | |
return errors.Wrap(err, "helm install") |
}) | ||
if err != nil { | ||
return errors.Wrap(err, "install registry") | ||
return errors.Wrap(err, "install") |
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.
return errors.Wrap(err, "install") | |
return errors.Wrap(err, "helm install") |
}) | ||
if err != nil { | ||
return errors.Wrap(err, "install seaweedfs") | ||
return errors.Wrap(err, "install") |
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.
return errors.Wrap(err, "install") | |
return errors.Wrap(err, "helm install") |
Namespace: namespace, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "install velero") | ||
return errors.Wrap(err, "install") |
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.
return errors.Wrap(err, "install") | |
return errors.Wrap(err, "helm install") |
Values: values, | ||
Namespace: namespace, | ||
Labels: getBackupLabels(), | ||
Force: true, |
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.
This is backwards
// only add tls secret value if the secret exists | ||
// this is for backwards compatibility when the registry was deployed without TLS | ||
var secret corev1.Secret | ||
if err := kcli.Get(ctx, k8stypes.NamespacedName{Namespace: namespace, Name: tlsSecretName}, &secret); err == nil { |
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.
we should return all errors other than not found error here
@@ -6,7 +6,7 @@ import ( | |||
"github.com/pkg/errors" | |||
"github.com/replicatedhq/embedded-cluster/pkg/release" | |||
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig" | |||
"gopkg.in/yaml.v3" | |||
"gopkg.in/yaml.v2" |
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.
why revert this?
} | ||
for _, addon := range addons { | ||
if err := upgradeAddOn(ctx, hcli, kcli, in, addon); err != nil { | ||
return err |
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.
return err | |
return errors.Wrap(err, "addon %s", addon.Name()) |
@@ -71,7 +72,7 @@ func createCredentialsSecret(ctx context.Context, kcli client.Client) error { | |||
}, | |||
Type: "Opaque", | |||
} | |||
if err := kcli.Create(ctx, &credentialsSecret); err != nil { | |||
if err := kcli.Create(ctx, &credentialsSecret); err != nil && !k8serrors.IsAlreadyExists(err) { |
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.
can we add a comment as to why we create an empty secret here
@@ -7,7 +7,7 @@ import ( | |||
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1" | |||
"github.com/replicatedhq/embedded-cluster/pkg/release" | |||
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig" | |||
"gopkg.in/yaml.v3" | |||
"gopkg.in/yaml.v2" |
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.
why revert?
loading.Infof("Installing %s", ext.Name) | ||
|
||
if err := install(ctx, hcli, ext); err != nil { | ||
return errors.Wrap(err, "install extension") |
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.
return errors.Wrap(err, "install extension") | |
return errors.Wrapf(err, "install extension %s", ext.Name) |
What this PR does / why we need it:
Which issue(s) this PR fixes:
Does this PR require a test?
Does this PR require a release note?
Does this PR require documentation?