Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/template/license_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
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 strconv.FormatBool(ctx.License.Spec.IsDisasterRecoverySupported)
case "isGitOpsSupported":
return strconv.FormatBool(ctx.License.Spec.IsGitOpsSupported)
case "isSupportBundleUploadSupported":
Expand Down Expand Up @@ -76,6 +78,10 @@
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.

return strconv.FormatBool(ctx.License.Spec.IsKotsInstallEnabled)

Check failure on line 82 in pkg/template/license_context.go

View workflow job for this annotation

GitHub Actions / vet-kots

ctx.License.Spec.IsKotsInstallEnabled undefined (type "github.com/replicatedhq/kotskinds/apis/kots/v1beta1".LicenseSpec has no field or method IsKotsInstallEnabled)

Check failure on line 82 in pkg/template/license_context.go

View workflow job for this annotation

GitHub Actions / ci-test-kots

ctx.License.Spec.IsKotsInstallEnabled undefined (type "github.com/replicatedhq/kotskinds/apis/kots/v1beta1".LicenseSpec has no field or method IsKotsInstallEnabled)

Check failure on line 82 in pkg/template/license_context.go

View workflow job for this annotation

GitHub Actions / build-kots

ctx.License.Spec.IsKotsInstallEnabled undefined (type "github.com/replicatedhq/kotskinds/apis/kots/v1beta1".LicenseSpec has no field or method IsKotsInstallEnabled)
case "isEmbeddedClusterDownloadEnabled":
return strconv.FormatBool(ctx.License.Spec.IsEmbeddedClusterDownloadEnabled)
default:
entitlement, ok := ctx.License.Spec.Entitlements[name]
if ok {
Expand Down
50 changes: 50 additions & 0 deletions pkg/template/license_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,56 @@ func TestLicenseCtx_licenseFieldValue(t *testing.T) {
fieldName: "signature",
want: "abcdef0123456789",
},
{
name: "built-in isDisasterRecoverySupported (camelCase)",
License: &kotsv1beta1.License{
Spec: kotsv1beta1.LicenseSpec{
IsDisasterRecoverySupported: true,
},
},
fieldName: "isDisasterRecoverySupported",
want: "true",
},
{
name: "built-in isKotsInstallEnabled",
License: &kotsv1beta1.License{
Spec: kotsv1beta1.LicenseSpec{
IsKotsInstallEnabled: true,
},
},
fieldName: "isKotsInstallEnabled",
want: "true",
},
{
name: "built-in isEmbeddedClusterDownloadEnabled",
License: &kotsv1beta1.License{
Spec: kotsv1beta1.LicenseSpec{
IsEmbeddedClusterDownloadEnabled: true,
},
},
fieldName: "isEmbeddedClusterDownloadEnabled",
want: "true",
},
{
name: "built-in isKotsInstallEnabled false",
License: &kotsv1beta1.License{
Spec: kotsv1beta1.LicenseSpec{
IsKotsInstallEnabled: false,
},
},
fieldName: "isKotsInstallEnabled",
want: "false",
},
{
name: "built-in isEmbeddedClusterDownloadEnabled false",
License: &kotsv1beta1.License{
Spec: kotsv1beta1.LicenseSpec{
IsEmbeddedClusterDownloadEnabled: false,
},
},
fieldName: "isEmbeddedClusterDownloadEnabled",
want: "false",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
Loading