Skip to content

Remove default logic for IsEmbeddedClusterMultinodeEnabled #23

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

Merged
Merged
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
24 changes: 0 additions & 24 deletions apis/kots/v1beta1/license_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,30 +135,6 @@ type LicenseSpec struct {
Entitlements map[string]EntitlementField `json:"entitlements,omitempty"`
}

func (l *LicenseSpec) UnmarshalJSON(data []byte) error {
type Alias LicenseSpec
als := &struct {
IsEmbeddedClusterMultinodeEnabled *bool `json:"isEmbeddedClusterMultinodeEnabled,omitempty"`
*Alias
}{
Alias: (*Alias)(l),
}

if err := json.Unmarshal(data, &als); err != nil {
return err
}

if als.IsEmbeddedClusterMultinodeEnabled != nil {
l.IsEmbeddedClusterMultinodeEnabled = *als.IsEmbeddedClusterMultinodeEnabled
} else {
// default to true for old licenses that don't have the field as
// that was the default behavior prior to adding this field
l.IsEmbeddedClusterMultinodeEnabled = true
}

return nil
}

// LicenseStatus defines the observed state of License
type LicenseStatus struct {
}
Expand Down
4 changes: 2 additions & 2 deletions apis/kots/v1beta1/v1beta1tests/license_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ func Test_IsEmbeddedClusterMultinodeEnabled(t *testing.T) {
expected bool
}{
{
name: "field is missing, should default to true",
name: "field is missing, should default to false",
jsonData: `{
"licenseID": "test-id",
"appSlug": "test-app",
"signature": "IA=="
}`,
expected: true,
expected: false,
},
{
name: "field is explicitly set to false",
Expand Down