Add support for additional license fields in template context#5420
Open
Add support for additional license fields in template context#5420
Conversation
- Add camelCase support for isDisasterRecoverySupported - Add isKotsInstallEnabled license field support - Add isEmbeddedClusterDownloadEnabled license field support - Add isSupportBundleEnabled field (maps to IsSupportBundleUploadSupported) - Add isNewKotsUiEnabled license field support - Add comprehensive test coverage for all new license fields These additions allow KOTS configs to access more license field values through the LicenseFieldValue template function.
| return strconv.FormatBool(ctx.License.Spec.IsSnapshotSupported) | ||
| case "IsDisasterRecoverySupported": | ||
| return strconv.FormatBool(ctx.License.Spec.IsDisasterRecoverySupported) | ||
| case "isDisasterRecoverySupported": |
Contributor
There was a problem hiding this comment.
looks like a duplicate of what's above?
Author
There was a problem hiding this comment.
Specifically this is a normal camelCase option, leaving the other one there for backwards compatibility in case users are currently using the Is vs is
| return util.ReplicatedAppEndpoint(ctx.License) | ||
| case "licenseID", "licenseId": | ||
| return ctx.License.Spec.LicenseID | ||
| case "isKotsInstallEnabled": |
Contributor
There was a problem hiding this comment.
Author
There was a problem hiding this comment.
Oh interesting, do I go ahead and add it in there? The field is currently on our license.yamls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for additional license fields in the KOTS template context, enabling KOTS configs to access more license field values through the
LicenseFieldValuetemplate function.Changes Made
New License Fields Added:
isDisasterRecoverySupported- camelCase version of the existing fieldisKotsInstallEnabled- enables access to KOTS install permissionisEmbeddedClusterDownloadEnabled- enables access to embedded cluster download permissionTesting
Use Case
This enables KOTS configuration files to display license capabilities:
Backward Compatibility
Resolves the need for accessing additional license field values in KOTS configuration templates.
Relavent shortcut:
https://app.shortcut.com/replicated/story/126762/add-support-for-additional-license-fields-in-template-context