-
Notifications
You must be signed in to change notification settings - Fork 5
EVEREST-793: upgrade command #297
base: main
Are you sure you want to change the base?
Conversation
viper.BindEnv("kubeconfig") //nolint:errcheck,gosec | ||
viper.BindPFlag("kubeconfig", cmd.Flags().Lookup("kubeconfig")) //nolint:errcheck,gosec | ||
viper.BindPFlag("namespaces", cmd.Flags().Lookup("namespaces")) //nolint:errcheck,gosec | ||
viper.BindPFlag("version-metadata-url", cmd.Flags().Lookup("version-metadata-url")) //nolint:errcheck,gosec |
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'm thinking if we really need this as a cli flag. It's not something the end user would want to configure. Should we have it in build flags then?
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.
The purpose of this flag is to enable:
- QA/devs to test custom upgrade scenarios
- Air-gapped environments to be able to point to an internal version metadata service
func parseConfig() (*upgrade.Config, error) { | ||
c := &upgrade.Config{} | ||
func parseUpgradeConfig() (*upgrade.UpgradeConfig, error) { | ||
c := &upgrade.UpgradeConfig{} |
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.
will there config types other than the upgrade
in this package so we need to specify the type? upgrade.UpgradeConfig
looks redundant which doesn't follow best practices
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.
Yes, there could be, as we have with other commands.
pkg/upgrade/upgrade_test.go
Outdated
wantErr bool | ||
wantErrIs 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.
looks like err error
should be enough here. if no error wanted the field remains 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.
updated
if err != nil { | ||
return nil, errors.Join(err, errors.New("could not parse version metadata URL")) | ||
} | ||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, p.JoinPath("metadata/v1/everest").String(), 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.
is this an existing path? if it's under consideration still, I would suggest "everest/v1"
so we had version-service-url/product-name/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.
This is defined by the version service.
It follows the current structure which is versions/v1/{product}
o.l.Info("Installing Operator Lifecycle Manager") | ||
// TODO: do we upgrade OLM if the version is too old? |
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 think we should. Another question is how we define if it's too old. Should it be also some kind of mapping for every everest version to have a list of supported OLM versions? Or just hardcoded versions like - Everest 0.8.0 works with the olm X.Y.Z. Once the Everest version is upgraded, olm should be upgraded (if needed) to the version that this version of everest works with.
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.
Per discussion, OLM upgrade will be postponed.
replace github.com/Percona-Lab/percona-version-service => ../percona-version-service | ||
|
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.
Leaving a comment so we don't forget about this.
// TODO: we shall probably split this into "install" and "add namespaces" | ||
// Otherwise the logic is hard to maintain - we need to make sure not to, | ||
// for example, install a different version of operators per namespace, if | ||
// we are always installing the "latest" 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.
I already proposed this to Peter and he agreed with the approach as long as users aren't forced to run 2 commands in the initial installation. He wants users to be able to run a single command and have everything set up for them.
In subsequent runs of the install command we can even check and return without doing anything, just saying "Everest is already installed". Adding extra namespaces can be done in a separate command like you suggested.
@@ -236,6 +287,7 @@ func (o *Install) provisionMonitoringStack(ctx context.Context) error { | |||
} | |||
|
|||
l.Info("Preparing k8s cluster for monitoring") | |||
// TODO: shall we grab VM operator version from metadata? |
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 don't think so. This info lives in the catalog.
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.
The catalog is moving towards having all available versions listed. How do we know which version to use if it's not coming from the metadata service?
if err := o.provisionDBNamespaces(ctx, recVer); err != nil { | ||
return err | ||
} | ||
|
||
if err := o.provisionEverest(ctx); err != nil { | ||
if err := o.provisionEverestOperator(ctx, recVer); 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.
I'm not sure we should get these version from the metadata, this info is part of the catalog.
I thought that the metadata would be used primarily for the everest version itself, the operators' version already exist as part of the catalog, shouldn't we be using that instead?
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.
The catalog is moving towards having all available versions listed. How do we know which version to use if it's not coming from the metadata service?
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.
The catalog is moving towards having all available versions listed.
We agreed on having just 2 versions of operator for a given everest version, right? Since we release a new catalog version with each everest version we would only ever have 2 versions of the operators in the catalog, correct?
// We cannot use the latest version of catalog yet since | ||
// at the time of writing, each catalog version supports only one Everest 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.
Just trying to understand this better. When we update the catalog itself, this doesn't have any side-effects directly right? The subscription would pick up the new versions from the new catalog and would create new install plans that would be waiting approval.
I agree that the most correct way would be to have 2 everest operator versions in the new catalog but is there really any problems with having just one now?
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.
When upgrading catalog, we need to use a specific version to be able to upgrade. Otherwise the catalog will not offer correct versions for Everest.
Once the catalog includes all versions of operators, we can always update to the latest one.
CHANGE DESCRIPTION
Problem:
EVEREST-793
Support for
everestctl upgrade
command.Upgrades to the next minor version based on metadata from a version service.
CHECKLIST
Jira
Tests