@@ -32,25 +32,25 @@ import (
32
32
33
33
// Cluster the definition of a cluster.
34
34
type Cluster struct {
35
- ObjectMeta types.ObjectMeta `json:"objectMeta"`
36
- TypeMeta types.TypeMeta `json:"typeMeta"`
37
- Ready metav1.ConditionStatus `json:"ready"`
38
- KubernetesVersion string `json:"kubernetesVersion,omitempty"`
39
- SyncMode v1alpha1.ClusterSyncMode `json:"syncMode"`
40
- NodeSummary * v1alpha1.NodeSummary `json:"nodeSummary,omitempty"`
41
- AllocatedResources ClusterAllocatedResources `json:"allocatedResources"`
35
+ ObjectMeta types.ObjectMeta `json:"objectMeta"`
36
+ TypeMeta types.TypeMeta `json:"typeMeta"`
37
+ Ready metav1.ConditionStatus `json:"ready"`
38
+ KubernetesVersion string `json:"kubernetesVersion,omitempty"`
39
+ SyncMode v1alpha1.ClusterSyncMode `json:"syncMode"`
40
+ NodeSummary * v1alpha1.NodeSummary `json:"nodeSummary,omitempty"`
41
+ AllocatedResources AllocatedResources `json:"allocatedResources"`
42
42
}
43
43
44
- // ClusterList contains a list of clusters.
45
- type ClusterList struct {
44
+ // List contains a list of clusters.
45
+ type List struct {
46
46
ListMeta types.ListMeta `json:"listMeta"`
47
47
Clusters []Cluster `json:"clusters"`
48
48
// List of non-critical errors, that occurred during resource retrieval.
49
49
Errors []error `json:"errors"`
50
50
}
51
51
52
52
// GetClusterList returns a list of all Nodes in the cluster.
53
- func GetClusterList (client karmadaclientset.Interface , dsQuery * dataselect.DataSelectQuery ) (* ClusterList , error ) {
53
+ func GetClusterList (client karmadaclientset.Interface , dsQuery * dataselect.Query ) (* List , error ) {
54
54
clusters , err := client .ClusterV1alpha1 ().Clusters ().List (context .TODO (), helpers .ListEverything )
55
55
nonCriticalErrors , criticalError := errors .ExtractErrors (err )
56
56
if criticalError != nil {
@@ -59,8 +59,8 @@ func GetClusterList(client karmadaclientset.Interface, dsQuery *dataselect.DataS
59
59
return toClusterList (client , clusters .Items , nonCriticalErrors , dsQuery ), nil
60
60
}
61
61
62
- func toClusterList (_ karmadaclientset.Interface , clusters []v1alpha1.Cluster , nonCriticalErrors []error , dsQuery * dataselect.DataSelectQuery ) * ClusterList {
63
- clusterList := & ClusterList {
62
+ func toClusterList (_ karmadaclientset.Interface , clusters []v1alpha1.Cluster , nonCriticalErrors []error , dsQuery * dataselect.Query ) * List {
63
+ clusterList := & List {
64
64
Clusters : make ([]Cluster , 0 ),
65
65
ListMeta : types.ListMeta {TotalItems : len (clusters )},
66
66
Errors : nonCriticalErrors ,
@@ -78,7 +78,7 @@ func toClusterList(_ karmadaclientset.Interface, clusters []v1alpha1.Cluster, no
78
78
}
79
79
80
80
func toCluster (cluster * v1alpha1.Cluster ) Cluster {
81
- allocatedResources , err := getclusterAllocatedResources (cluster )
81
+ allocatedResources , err := getAllocatedResources (cluster )
82
82
if err != nil {
83
83
log .Printf ("Couldn't get allocated resources of %s cluster: %s\n " , cluster .Name , err )
84
84
}
0 commit comments