replicatedhq / kots

KOTS provides the framework, tools and integrations that enable the delivery and management of 3rd-party Kubernetes applications, a.k.a. Kubernetes Off-The-Shelf (KOTS) Software.
https://kots.io
Apache License 2.0
902 stars 90 forks source link

Improved messaging when requested channel slug not allowed by license #4842

Closed pandemicsyn closed 2 months ago

pandemicsyn commented 3 months ago

What this PR does / why we need it:

This improves the messaging when a requested channel slug is not allowed by a license, and explicitly inform's when we fall back to the "stable" channel. Theres up to 3 new log entries emitted:

  1. No channel specified in upstream URI, falling back to channel "stable". to explicitly signal we used the fallback
  2. Verifying if channel slug "beta" allowed by license to explicitly signal what slug we're looking for
  3. To install/pull an allowed channel, use one of the following: appSlug/channelSlug to indicate which would be allowed if there supplied channel slug was not allowed

Which issue(s) this PR fixes:

Fixes https://app.shortcut.com/replicated/story/110998/improved-messaging-when-requested-channel-slug-not-allowed-by-license

Special notes for your reviewer:

Sample usage without a channel slug:

$ kots install e2app --license-file ~/Downloads/testcustomer.yaml -n e2eapp
  • No channel specified in upstream URI, falling back to channel "stable".
  • Checking for license update ✓
  • Verifying if channel slug "stable" is allowed by the license ✗
    • To install an allowed channel, use one of the following: e2eapp/beta, e2eapp/automated-1, e2eapp/unstable, e2eapp/alternate
Error: failed to verify and update license: channel slug "stable" is not allowed by latest license

$ kots install e2app -n e2eapp
  • No channel specified in upstream URI, falling back to channel "stable".
  • Deploying Admin Console
    • Creating namespace ✓
    • Waiting for datastore to be ready ✓
Enter a new password for the admin console (6+ characters):

Sample usage with a channel slug thats not allowed:

$ kots install e2app/notreal --license-file ~/Downloads/testcustomer.yaml -n e2eapp
  • Checking for license update ✓
  • Verifying if channel slug "notreal" is allowed by the license ✗
    • To install an allowed channel, use one of the following: e2eapp/beta, e2eapp/automated-1, e2eapp/unstable, e2eapp/alternate
Error: failed to verify and update license: channel slug "notreal" is not allowed by latest license

Sample usage with a channel slug that IS allowed:

$ kots install e2app/beta --license-file ~/Downloads/testcustomer.yaml -n e2eapp
  • Checking for license update ✓
  • Verifying if channel slug "beta" is allowed by the license ✓
  • Deploying Admin Console
    • Creating namespace ✓
    • Waiting for datastore to be ready ✓

Steps to reproduce

Does this PR introduce a user-facing change?

- Improved messaging when requested channel slug not allowed by license

Does this PR require documentation?

pandemicsyn commented 2 months ago

@sgalsaleh updated output:

# airgap & vanilla failure
➜ bin/kots install e2app --license-file ~/Downloads/testcustomer.yaml --shared-password password -n e2eapp --airgap
  • No channel specified in upstream URI, falling back to channel slug 'stable'.
  • Channel slug "stable" is not allowed by license. Please use one of the following: e2eapp/beta, e2eapp/automated-1, e2eapp/unstable, e2eapp/alternate
Error: failed to verify and update license: channel slug "stable" is not allowed by license
➜ bin/kots install e2app --license-file ~/Downloads/testcustomer.yaml --shared-password password -n e2eapp
  • No channel specified in upstream URI, falling back to channel slug 'stable'.
  • Checking for license update ✓
  • Channel slug "stable" is not allowed by license. Please use one of the following: e2eapp/beta, e2eapp/automated-1, e2eapp/unstable, e2eapp/alternate
Error: failed to verify and update license: channel slug "stable" is not allowed by latest license

# airgap and vanilla success
➜ bin/kots install e2app/unstable --license-file ~/Downloads/testcustomer.yaml --shared-password password -n e2eapp --airgap=true
  • Deploying Admin Console
    • Creating namespace ✓
    • Waiting for datastore to be ready ⠸^C
  • Cleaning up
➜ bin/kots install e2app/unstable --license-file ~/Downloads/testcustomer.yaml --shared-password password -n e2eapp
  • Checking for license update ✓
  • Deploying Admin Console
    • Creating namespace ✓
    • Waiting for datastore to be ready ⠇^C
  • Cleaning up