Skip to content

Commit

Permalink
Add license token string to cluster spec
Browse files Browse the repository at this point in the history
  • Loading branch information
sp1999 committed Dec 25, 2024
1 parent 1b040bf commit 09ff82e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/crd/bases/anywhere.eks.amazonaws.com_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ spec:
type: array
kubernetesVersion:
type: string
licenseToken:
type: string
machineHealthCheck:
description: MachineHealthCheck allows to configure timeouts for machine
health checks. Machine Health Checks are responsible for remediating
Expand Down
9 changes: 9 additions & 0 deletions config/manifest/eksa-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4273,6 +4273,8 @@ spec:
type: array
kubernetesVersion:
type: string
licenseToken:
type: string
machineHealthCheck:
description: MachineHealthCheck allows to configure timeouts for machine
health checks. Machine Health Checks are responsible for remediating
Expand Down Expand Up @@ -5680,6 +5682,13 @@ spec:
bundle for users that configured their Prism Central with certificates
from non-publicly trusted CAs
type: string
ccmExcludeNodeIPs:
description: CcmExcludeIPs is the optional list of IP addresses that
should be excluded from the CCM IP pool for nodes. List should be
valid IP addresses and IP address ranges.
items:
type: string
type: array
credentialRef:
description: CredentialRef is the reference to the secret name that
contains the credentials for the Nutanix Prism Central. The namespace
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type ClusterSpec struct {
EksaVersion *EksaVersion `json:"eksaVersion,omitempty"`
MachineHealthCheck *MachineHealthCheck `json:"machineHealthCheck,omitempty"`
EtcdEncryption *[]EtcdEncryption `json:"etcdEncryption,omitempty"`
LicenseToken string `json:"licenseToken,omitempty"`
}

// EksaVersion is the semver identifying the release of eks-a used to populate the cluster components.
Expand Down Expand Up @@ -185,6 +186,9 @@ func (n *Cluster) Equal(o *Cluster) bool {
if !reflect.DeepEqual(n.Spec.EtcdEncryption, o.Spec.EtcdEncryption) {
return false
}
if n.Spec.LicenseToken != o.Spec.LicenseToken {
return false
}

return true
}
Expand Down
50 changes: 50 additions & 0 deletions pkg/api/v1alpha1/cluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,56 @@ func TestClusterEqualDifferentBundlesRef(t *testing.T) {
g.Expect(cluster1.Equal(cluster2)).To(BeFalse())
}

func TestClusterEqualLicenseToken(t *testing.T) {
testCases := []struct {
testName string
cluster1LicenseToken, cluster2LicenseToken string
want bool
}{
{
testName: "both empty",
cluster1LicenseToken: "",
cluster2LicenseToken: "",
want: true,
},
{
testName: "one empty, one exists",
cluster1LicenseToken: "",
cluster2LicenseToken: "test-token",
want: false,
},
{
testName: "both exists, diff",
cluster1LicenseToken: "test-token1",
cluster2LicenseToken: "test-token2",
want: false,
},
{
testName: "both exists, same",
cluster1LicenseToken: "test-token",
cluster2LicenseToken: "test-token",
want: true,
},
}
for _, tt := range testCases {
t.Run(tt.testName, func(t *testing.T) {
cluster1 := &v1alpha1.Cluster{
Spec: v1alpha1.ClusterSpec{
LicenseToken: tt.cluster1LicenseToken,
},
}
cluster2 := &v1alpha1.Cluster{
Spec: v1alpha1.ClusterSpec{
LicenseToken: tt.cluster2LicenseToken,
},
}

g := NewWithT(t)
g.Expect(cluster1.Equal(cluster2)).To(Equal(tt.want))
})
}
}

func TestControlPlaneConfigurationEqual(t *testing.T) {
var emptyTaints []corev1.Taint
taint1 := corev1.Taint{Key: "key1"}
Expand Down

0 comments on commit 09ff82e

Please sign in to comment.