Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Resolve a couple TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Kralik committed Feb 22, 2024
1 parent c652985 commit 52a8044
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func NewInstall(c Config, l *zap.SugaredLogger) (*Install, error) {

// Run runs the operators installation process.
func (o *Install) Run(ctx context.Context) error {
// 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.
if err := o.populateConfig(); err != nil {
return err
}
Expand Down Expand Up @@ -323,7 +327,6 @@ func (o *Install) provisionEverest(ctx context.Context, v *goversion.Version) er
return err
}
} else {
// TODO: revisit - we shall probably not restart but offer upgrade.
o.l.Info("Restarting Everest")
if err := o.kubeClient.RestartEverest(ctx, everestOperatorName, SystemNamespace); err != nil {
return err
Expand All @@ -333,7 +336,6 @@ func (o *Install) provisionEverest(ctx context.Context, v *goversion.Version) er
}
}

// TODO: get from Everest, not cli.
o.l.Info("Updating cluster role bindings for everest-admin")
if err := o.kubeClient.UpdateClusterRoleBinding(ctx, everestServiceAccountClusterRoleBinding, o.config.NamespacesList()); err != nil {
return err
Expand Down
5 changes: 2 additions & 3 deletions pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,16 +1016,15 @@ func (k *Kubernetes) getManifestData(ctx context.Context, version *goversion.Ver
}

// DeleteEverest downloads the manifest file and deletes it from provisioned k8s cluster.
// TODO: how do we need to change this after upgrade changes.
func (k *Kubernetes) DeleteEverest(ctx context.Context, namespace string, version *goversion.Version) error {
data, err := k.getManifestData(ctx, version)
if err != nil {
return errors.Join(err, errors.New("failed downloading everest monitoring file"))
return errors.Join(err, errors.New("failed downloading Everest manifest file"))
}

err = k.client.DeleteManifestFile(data, namespace)
if err != nil {
return errors.Join(err, errors.New("failed deleting manifest file"))
return errors.Join(err, errors.New("failed deleting Everest based on a manifest file"))
}
return nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/uninstall/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ This will uninstall Everest and all its components from the cluster.`
if err != nil {
return err
}
// TODO: How do we ensure we delete all resources based on the correct Everest version?
if err := u.kubeClient.DeleteEverest(ctx, install.SystemNamespace, v); err != nil {
return err
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ func (u *Upgrade) Run(ctx context.Context) error {
return err
}

// TODO: figure out catalog version
u.l.Infof("Upgrading Percona Catalog to %s", upgradeEverestTo)
if err := u.kubeClient.InstallPerconaCatalog(ctx, upgradeEverestTo); err != nil {
// We cannot use the latest version of catalog yet since
// at the time of writing, each catalog version supports only one Everest version.
u.l.Infof("Upgrading Percona Catalog to %s", recVer.Catalog)
if err := u.kubeClient.InstallPerconaCatalog(ctx, recVer.Catalog); err != nil {
return err
}

Expand Down Expand Up @@ -276,7 +277,7 @@ func (u *Upgrade) upgradeOLM(ctx context.Context, minimumVersion *goversion.Vers
}

u.l.Info("Upgrading OLM to version %s", minimumVersion)
// TODO: actually upgrade OLM operator instead of installation/skip.
// TODO: shall we actually upgrade OLM operator instead of installation/skip?
if err := u.kubeClient.InstallOLMOperator(ctx, true); err != nil {
return errors.Join(err, errors.New("could not upgrade OLM"))
}
Expand Down

0 comments on commit 52a8044

Please sign in to comment.