Skip to content
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

Add license token string to cluster spec #9112

Merged
merged 1 commit into from
Dec 30, 2024
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
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
Loading