Skip to content
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

Add up enterprise commands and refactor helm installer #116

Merged
merged 16 commits into from
Sep 9, 2021

Conversation

hasheddan
Copy link
Contributor

Description of your changes

From a user-facing perspective, this PR adds support for up enterprise ... commands, but in order to enable that, it refactors the helm installer to be more general and adds a drop-in helm pull client that can pull charts from an OCI registry. The more flexible helm installer means that we can continue to use it for other charts we may want to install in the future, and we can add features for our existing installation targets (uxp and enterprise) without needing to special case them. There are likely some additional ergonomic improvements that can be made to the installer, and I imagine there will be some additional tweaks over time.

I am finishing up writing some unit tests for registryPuller, but this PR is otherwise good to go. See testing steps below.

Fixes #112

I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

I have extensively tested each of the following scenarios:

  • Installing Crossplane then upgrading to compatible UXP version
$ helm install crossplane --namespace crossplane-system crossplane-stable/crossplane
<observe healthy install>
$ up uxp upgrade v1.4.0-up.1 -n crossplane-system
<observe healthy install>
  • Install latest stable UXP version, then upgrade to newer unstable version, then uninstall
$ up uxp install
<observe healthy install>
$ up uxp upgrade --unstable 1.5.0-rc.0.up.1.4.g2823565
<observe healthy upgrade>
$ up uxp uninstall
<observe all components removed>
  • Install enterprise version, overriding with hidden repo arg, then upgrade to newer version, then uninstall
$ up enterprise install --repo registry.upbound.io/enterprise-dev v0.0.0-110.gcc7d34d --set withCertManager=false
License ID: <REDACTED>
Token: 
<observe healthy install -- i.e. all components are there but images fail to be pulled because I did not create image pull secret>
$ up enterprise upgrade --repo registry.upbound.io/enterprise-dev v0.0.0-112.g63a2b32 --set withCertManager=false
License ID: <REDACTED>
Token: 
<observe healthy upgrade -- i.e. all components are there but images fail to be pulled because I did not create image pull secret>
$ up enterprise uninstall
<observe all components removed>

Moves the UXP installer to an agnostic install package and does some
minor refactoring to refer to the Installer interface as a Manager. This
is more reflective of the purpose, as the install.Manager is actually
responsible for installing, uninstalling, and managing installations.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates all UXP commands to consume the refactored and moved install
package. All changes are cosmetic -- import paths are updated and
install.Manager is used instead of of install.Installer.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
These install parameters will be used across multiple commands moving
forward and so they are moved to the package which knows how to handle
them.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds a helm pull client that is capable of fetching a helm chart in an
OCI artifact from a registry. Other components of the Helm install
manager are agnostic to the fact that the registry puller replaces the
default helm pull client.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates the helm install manager to be less coupled to installing UXP.
This is accomplished by allowing a caller to specify an alternate chart
rather an assuming Crossplane is the alternate. It also adds new options
for providing user / pass authentication and ability to specify chart is
hosted in an OCI registry. Instead of switching on an unstable flag,
caller is now required to pass the repoURL, meaning that using the
stable or unstable chart URL is now decided outside of the helm install
manager. This decouples the unstable behavior from helm's --devel flag,
which we always set given that we do not want to restrict the versions a
user can pull by tag, but rather by channel (url).

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates helm installer tests to accomodate for the fact that the
alternate chart that can be used is now configurable.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Updates uxp commands to manually provide the appropriate repo URL and
the alternate chart that is to be used. Alternate chart is always
Crossplane, and the repo URL is decided by setting the --unstable flag.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds the up enterprise install command, which prompts a user for license
ID and token then uses the new helm manager to download enterprise chart
from OCI registry, save it in the cache, then install it in the cluster.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds the up enterprise upgrade command, which behaves similarly to up
enterprise install, but it requires that the enterprise chart is already
installed before attempting upgrade. Users are also prompted for license
ID and token in this command, though if the chart is already present in
the cache then they could be supplied as empty.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
up enterprise uninstall uninstalls the enterprise chart from the
currently pointed to cluster.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds the enterprise subcommands to the root command.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Switches to using a nolint directive instead of an anonymous function
when closing the compressed image layer reader. The nolint directive is
more verbose about the decision not to check the error.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Removes unused errBoom variable in parser tests.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Allows for the accepted media type to be set in the registry puller to
make testing using go-containerregistry random.Image easier.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Fixes registry puller to use the configured filesystem abstraction
rather than a hardcoded OS filesystem.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds unit tests for the helm registry puller.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
@hasheddan hasheddan merged commit 9728ca6 into upbound:main Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support OCI artifacts in Helm installer
3 participants