Kaynağa Gözat

group statements

Signed-off-by: r2k1 <yokree@gmail.com>
r2k1 2 yıl önce
ebeveyn
işleme
5f72d062f5
1 değiştirilmiş dosya ile 81 ekleme ve 82 silme
  1. 81 82
      pkg/clustercache/clustercache.go

+ 81 - 82
pkg/clustercache/clustercache.go

@@ -23,14 +23,6 @@ type Namespace struct {
 	Annotations map[string]string
 }
 
-func transformNamespace(input *v1.Namespace) *Namespace {
-	return &Namespace{
-		Name:        input.Name,
-		Annotations: input.Annotations,
-		Labels:      input.Labels,
-	}
-}
-
 type Pod struct {
 	UID             types.UID
 	Name            string
@@ -58,6 +50,87 @@ type Container struct {
 	Resources v1.ResourceRequirements
 }
 
+type Node struct {
+	Name           string
+	Labels         map[string]string
+	Annotations    map[string]string
+	Status         v1.NodeStatus
+	SpecProviderID string
+}
+
+type Service struct {
+	Name      string
+	Namespace string
+	Selector  map[string]string
+	Type      v1.ServiceType
+	Status    v1.ServiceStatus
+}
+
+type DaemonSet struct {
+	Name           string
+	Namespace      string
+	Labels         map[string]string
+	SpecContainers []v1.Container
+}
+
+type Deployment struct {
+	Name                    string
+	Namespace               string
+	Labels                  map[string]string
+	MatchLabels             map[string]string
+	SpecSelector            *metav1.LabelSelector
+	SpecReplicas            *int32
+	StatusAvailableReplicas int32
+}
+
+type StatefulSet struct {
+	Name         string
+	Namespace    string
+	SpecSelector *metav1.LabelSelector
+}
+
+type PersistentVolumeClaim struct {
+	Name        string
+	Namespace   string
+	Spec        v1.PersistentVolumeClaimSpec
+	Annotations map[string]string
+}
+
+type StorageClass struct {
+	Name        string
+	Annotations map[string]string
+	Parameters  map[string]string
+	Provisioner string
+}
+
+type Job struct {
+	Name      string
+	Namespace string
+	Status    batchv1.JobStatus
+}
+
+type PersistentVolume struct {
+	Name        string
+	Namespace   string
+	Labels      map[string]string
+	Annotations map[string]string
+	Spec        v1.PersistentVolumeSpec
+	Status      v1.PersistentVolumeStatus
+}
+
+type ReplicationController struct{}
+
+type PodDisruptionBudget struct{}
+type ReplicaSet struct{}
+
+func transformNamespace(input *v1.Namespace) *Namespace {
+	return &Namespace{
+		Name:        input.Name,
+		Annotations: input.Annotations,
+		Labels:      input.Labels,
+	}
+}
+
 func transformPodContainer(input v1.Container) Container {
 	return Container{
 		Name:      input.Name,
@@ -98,14 +171,6 @@ func transformPod(input *v1.Pod) *Pod {
 	}
 }
 
-type Node struct {
-	Name           string
-	Labels         map[string]string
-	Annotations    map[string]string
-	Status         v1.NodeStatus
-	SpecProviderID string
-}
-
 func transformNode(input *v1.Node) *Node {
 	return &Node{
 		Name:           input.Name,
@@ -116,14 +181,6 @@ func transformNode(input *v1.Node) *Node {
 	}
 }
 
-type Service struct {
-	Name      string
-	Namespace string
-	Selector  map[string]string
-	Type      v1.ServiceType
-	Status    v1.ServiceStatus
-}
-
 func transformService(input *v1.Service) *Service {
 	return &Service{
 		Name:      input.Name,
@@ -134,13 +191,6 @@ func transformService(input *v1.Service) *Service {
 	}
 }
 
-type DaemonSet struct {
-	Name           string
-	Namespace      string
-	Labels         map[string]string
-	SpecContainers []v1.Container
-}
-
 func transformDaemonSet(input *appsv1.DaemonSet) *DaemonSet {
 	return &DaemonSet{
 		Name:           input.Name,
@@ -150,16 +200,6 @@ func transformDaemonSet(input *appsv1.DaemonSet) *DaemonSet {
 	}
 }
 
-type Deployment struct {
-	Name                    string
-	Namespace               string
-	Labels                  map[string]string
-	MatchLabels             map[string]string
-	SpecSelector            *metav1.LabelSelector
-	SpecReplicas            *int32
-	StatusAvailableReplicas int32
-}
-
 func transformDeployment(input *appsv1.Deployment) *Deployment {
 	return &Deployment{
 		Name:                    input.Name,
@@ -172,12 +212,6 @@ func transformDeployment(input *appsv1.Deployment) *Deployment {
 	}
 }
 
-type StatefulSet struct {
-	Name         string
-	Namespace    string
-	SpecSelector *metav1.LabelSelector
-}
-
 func transformStatefulSet(input *appsv1.StatefulSet) *StatefulSet {
 	return &StatefulSet{
 		Name:         input.Name,
@@ -186,15 +220,6 @@ func transformStatefulSet(input *appsv1.StatefulSet) *StatefulSet {
 	}
 }
 
-type PersistentVolume struct {
-	Name        string
-	Namespace   string
-	Labels      map[string]string
-	Annotations map[string]string
-	Spec        v1.PersistentVolumeSpec
-	Status      v1.PersistentVolumeStatus
-}
-
 func transformPersistentVolume(input *v1.PersistentVolume) *PersistentVolume {
 	return &PersistentVolume{
 		Name:        input.Name,
@@ -206,13 +231,6 @@ func transformPersistentVolume(input *v1.PersistentVolume) *PersistentVolume {
 	}
 }
 
-type PersistentVolumeClaim struct {
-	Name        string
-	Namespace   string
-	Spec        v1.PersistentVolumeClaimSpec
-	Annotations map[string]string
-}
-
 func transformPersistentVolumeClaim(input *v1.PersistentVolumeClaim) *PersistentVolumeClaim {
 	return &PersistentVolumeClaim{
 		Name:        input.Name,
@@ -222,13 +240,6 @@ func transformPersistentVolumeClaim(input *v1.PersistentVolumeClaim) *Persistent
 	}
 }
 
-type StorageClass struct {
-	Name        string
-	Annotations map[string]string
-	Parameters  map[string]string
-	Provisioner string
-}
-
 func transformStorageClass(input *stv1.StorageClass) *StorageClass {
 	return &StorageClass{
 		Name:        input.Name,
@@ -238,12 +249,6 @@ func transformStorageClass(input *stv1.StorageClass) *StorageClass {
 	}
 }
 
-type Job struct {
-	Name      string
-	Namespace string
-	Status    batchv1.JobStatus
-}
-
 func transformJob(input *batchv1.Job) *Job {
 	return &Job{
 		Name:      input.Name,
@@ -252,20 +257,14 @@ func transformJob(input *batchv1.Job) *Job {
 	}
 }
 
-type ReplicationController struct{}
-
 func transformReplicationController(input *v1.ReplicationController) *ReplicationController {
 	return &ReplicationController{}
 }
 
-type PodDisruptionBudget struct{}
-
 func transformPodDisruptionBudget(input *policyv1.PodDisruptionBudget) *PodDisruptionBudget {
 	return &PodDisruptionBudget{}
 }
 
-type ReplicaSet struct{}
-
 func transformReplicaSet(input *appsv1.ReplicaSet) *ReplicaSet {
 	return &ReplicaSet{}
 }