Skip to content

Conversation

@0xJMart
Copy link
Member

@0xJMart 0xJMart commented Jul 15, 2025

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 LicenseFieldValue template function.

Changes Made

New License Fields Added:

  • isDisasterRecoverySupported - camelCase version of the existing field
  • isKotsInstallEnabled - enables access to KOTS install permission
  • isEmbeddedClusterDownloadEnabled - enables access to embedded cluster download permission

Testing

  • Added comprehensive test coverage for all new license fields
  • Tests cover both true and false boolean cases
  • Ensures proper string conversion for template rendering

Use Case

This enables KOTS configuration files to display license capabilities:

- name: dr_support
  title: DR
  type: text
  value: "{{repl LicenseFieldValue \"isDisasterRecoverySupported\"}}"
  readonly: true

Backward Compatibility

  • All existing license field template functions remain unchanged
  • New fields are additive and don't affect existing functionality
  • Falls back to custom entitlements if fields aren't found

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

- 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.
@CLAassistant
Copy link

CLAassistant commented Jul 15, 2025

CLA assistant check
All committers have signed the CLA.

@0xJMart 0xJMart added the type::feature New feature or request label Jul 15, 2025
return strconv.FormatBool(ctx.License.Spec.IsSnapshotSupported)
case "IsDisasterRecoverySupported":
return strconv.FormatBool(ctx.License.Spec.IsDisasterRecoverySupported)
case "isDisasterRecoverySupported":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a duplicate of what's above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting, do I go ahead and add it in there? The field is currently on our license.yamls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type::feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants