chore: stop using the deprecated fields of the cluster structure (#25745)

Signed-off-by: Patroklos Papapetrou <ppapapetrou76@gmail.com>
This commit is contained in:
Papapetrou Patroklos
2026-01-06 18:15:52 +02:00
committed by GitHub
parent 4aa2ba4715
commit 5959693845
10 changed files with 67 additions and 63 deletions

View File

@@ -2287,8 +2287,6 @@ func (c *Cluster) Sanitized() *Cluster {
Labels: c.Labels,
Annotations: c.Annotations,
ClusterResources: c.ClusterResources,
ConnectionState: c.ConnectionState,
ServerVersion: c.ServerVersion,
Info: c.Info,
RefreshRequestedAt: c.RefreshRequestedAt,
Config: ClusterConfig{

View File

@@ -4791,23 +4791,28 @@ func TestSyncWindow_Hash(t *testing.T) {
func TestSanitized(t *testing.T) {
now := metav1.Now()
cluster := &Cluster{
ID: "123",
Server: "https://example.com",
Name: "example",
ServerVersion: "v1.0.0",
Namespaces: []string{"default", "kube-system"},
Project: "default",
ID: "123",
Server: "https://example.com",
Name: "example",
Info: ClusterInfo{
ConnectionState: ConnectionState{
Status: ConnectionStatusSuccessful,
Message: "Connection successful",
ModifiedAt: &now,
},
ServerVersion: "v1.0.0",
CacheInfo: ClusterCacheInfo{},
ApplicationsCount: 0,
APIVersions: nil,
},
Namespaces: []string{"default", "kube-system"},
Project: "default",
Labels: map[string]string{
"env": "production",
},
Annotations: map[string]string{
"annotation-key": "annotation-value",
},
ConnectionState: ConnectionState{
Status: ConnectionStatusSuccessful,
Message: "Connection successful",
ModifiedAt: &now,
},
Config: ClusterConfig{
Username: "admin",
Password: "password123",
@@ -4822,19 +4827,24 @@ func TestSanitized(t *testing.T) {
}
assert.Equal(t, &Cluster{
ID: "123",
Server: "https://example.com",
Name: "example",
ServerVersion: "v1.0.0",
Namespaces: []string{"default", "kube-system"},
Project: "default",
Labels: map[string]string{"env": "production"},
Annotations: map[string]string{"annotation-key": "annotation-value"},
ConnectionState: ConnectionState{
Status: ConnectionStatusSuccessful,
Message: "Connection successful",
ModifiedAt: &now,
ID: "123",
Server: "https://example.com",
Name: "example",
Info: ClusterInfo{
ConnectionState: ConnectionState{
Status: ConnectionStatusSuccessful,
Message: "Connection successful",
ModifiedAt: &now,
},
ServerVersion: "v1.0.0",
CacheInfo: ClusterCacheInfo{},
ApplicationsCount: 0,
APIVersions: nil,
},
Namespaces: []string{"default", "kube-system"},
Project: "default",
Labels: map[string]string{"env": "production"},
Annotations: map[string]string{"annotation-key": "annotation-value"},
Config: ClusterConfig{
TLSClientConfig: TLSClientConfig{
Insecure: true,