|
|
@@ -181,7 +181,7 @@ func GetControllerOfNoCopy(pod *Pod) *metav1.OwnerReference {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func transformNamespace(input *v1.Namespace) *Namespace {
|
|
|
+func TransformNamespace(input *v1.Namespace) *Namespace {
|
|
|
return &Namespace{
|
|
|
Name: input.Name,
|
|
|
Annotations: input.Annotations,
|
|
|
@@ -189,24 +189,24 @@ func transformNamespace(input *v1.Namespace) *Namespace {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformPodContainer(input v1.Container) Container {
|
|
|
+func TransformPodContainer(input v1.Container) Container {
|
|
|
return Container{
|
|
|
Name: input.Name,
|
|
|
Resources: input.Resources,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformPodStatus(input v1.PodStatus) PodStatus {
|
|
|
+func TransformPodStatus(input v1.PodStatus) PodStatus {
|
|
|
return PodStatus{
|
|
|
Phase: input.Phase,
|
|
|
ContainerStatuses: input.ContainerStatuses,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformPodSpec(input v1.PodSpec) PodSpec {
|
|
|
+func TransformPodSpec(input v1.PodSpec) PodSpec {
|
|
|
containers := make([]Container, len(input.Containers))
|
|
|
for i, container := range input.Containers {
|
|
|
- containers[i] = transformPodContainer(container)
|
|
|
+ containers[i] = TransformPodContainer(container)
|
|
|
}
|
|
|
return PodSpec{
|
|
|
NodeName: input.NodeName,
|
|
|
@@ -217,7 +217,7 @@ func transformPodSpec(input v1.PodSpec) PodSpec {
|
|
|
|
|
|
}
|
|
|
|
|
|
-func transformTimestamp(input *metav1.Time) *time.Time {
|
|
|
+func TransformTimestamp(input *metav1.Time) *time.Time {
|
|
|
if input == nil {
|
|
|
return nil
|
|
|
}
|
|
|
@@ -226,7 +226,7 @@ func transformTimestamp(input *metav1.Time) *time.Time {
|
|
|
return &t
|
|
|
}
|
|
|
|
|
|
-func transformPod(input *v1.Pod) *Pod {
|
|
|
+func TransformPod(input *v1.Pod) *Pod {
|
|
|
return &Pod{
|
|
|
UID: input.UID,
|
|
|
Name: input.Name,
|
|
|
@@ -234,13 +234,13 @@ func transformPod(input *v1.Pod) *Pod {
|
|
|
Labels: input.Labels,
|
|
|
Annotations: input.Annotations,
|
|
|
OwnerReferences: input.OwnerReferences,
|
|
|
- Spec: transformPodSpec(input.Spec),
|
|
|
- Status: transformPodStatus(input.Status),
|
|
|
- DeletionTimestamp: transformTimestamp(input.DeletionTimestamp),
|
|
|
+ Spec: TransformPodSpec(input.Spec),
|
|
|
+ Status: TransformPodStatus(input.Status),
|
|
|
+ DeletionTimestamp: TransformTimestamp(input.DeletionTimestamp),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformNode(input *v1.Node) *Node {
|
|
|
+func TransformNode(input *v1.Node) *Node {
|
|
|
return &Node{
|
|
|
Name: input.Name,
|
|
|
Labels: input.Labels,
|
|
|
@@ -250,7 +250,7 @@ func transformNode(input *v1.Node) *Node {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformService(input *v1.Service) *Service {
|
|
|
+func TransformService(input *v1.Service) *Service {
|
|
|
return &Service{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -260,7 +260,7 @@ func transformService(input *v1.Service) *Service {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformDaemonSet(input *appsv1.DaemonSet) *DaemonSet {
|
|
|
+func TransformDaemonSet(input *appsv1.DaemonSet) *DaemonSet {
|
|
|
return &DaemonSet{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -269,7 +269,7 @@ func transformDaemonSet(input *appsv1.DaemonSet) *DaemonSet {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformDeployment(input *appsv1.Deployment) *Deployment {
|
|
|
+func TransformDeployment(input *appsv1.Deployment) *Deployment {
|
|
|
return &Deployment{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -279,21 +279,21 @@ func transformDeployment(input *appsv1.Deployment) *Deployment {
|
|
|
SpecSelector: input.Spec.Selector,
|
|
|
SpecStrategy: input.Spec.Strategy,
|
|
|
StatusAvailableReplicas: input.Status.AvailableReplicas,
|
|
|
- PodSpec: transformPodSpec(input.Spec.Template.Spec),
|
|
|
+ PodSpec: TransformPodSpec(input.Spec.Template.Spec),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformStatefulSet(input *appsv1.StatefulSet) *StatefulSet {
|
|
|
+func TransformStatefulSet(input *appsv1.StatefulSet) *StatefulSet {
|
|
|
return &StatefulSet{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
SpecSelector: input.Spec.Selector,
|
|
|
SpecReplicas: input.Spec.Replicas,
|
|
|
- PodSpec: transformPodSpec(input.Spec.Template.Spec),
|
|
|
+ PodSpec: TransformPodSpec(input.Spec.Template.Spec),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformPersistentVolume(input *v1.PersistentVolume) *PersistentVolume {
|
|
|
+func TransformPersistentVolume(input *v1.PersistentVolume) *PersistentVolume {
|
|
|
return &PersistentVolume{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -304,7 +304,7 @@ func transformPersistentVolume(input *v1.PersistentVolume) *PersistentVolume {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformPersistentVolumeClaim(input *v1.PersistentVolumeClaim) *PersistentVolumeClaim {
|
|
|
+func TransformPersistentVolumeClaim(input *v1.PersistentVolumeClaim) *PersistentVolumeClaim {
|
|
|
return &PersistentVolumeClaim{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -314,7 +314,7 @@ func transformPersistentVolumeClaim(input *v1.PersistentVolumeClaim) *Persistent
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformStorageClass(input *stv1.StorageClass) *StorageClass {
|
|
|
+func TransformStorageClass(input *stv1.StorageClass) *StorageClass {
|
|
|
return &StorageClass{
|
|
|
Name: input.Name,
|
|
|
Annotations: input.Annotations,
|
|
|
@@ -326,7 +326,7 @@ func transformStorageClass(input *stv1.StorageClass) *StorageClass {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformJob(input *batchv1.Job) *Job {
|
|
|
+func TransformJob(input *batchv1.Job) *Job {
|
|
|
return &Job{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -334,7 +334,7 @@ func transformJob(input *batchv1.Job) *Job {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformReplicationController(input *v1.ReplicationController) *ReplicationController {
|
|
|
+func TransformReplicationController(input *v1.ReplicationController) *ReplicationController {
|
|
|
return &ReplicationController{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -342,7 +342,7 @@ func transformReplicationController(input *v1.ReplicationController) *Replicatio
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformPodDisruptionBudget(input *policyv1.PodDisruptionBudget) *PodDisruptionBudget {
|
|
|
+func TransformPodDisruptionBudget(input *policyv1.PodDisruptionBudget) *PodDisruptionBudget {
|
|
|
return &PodDisruptionBudget{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -351,7 +351,7 @@ func transformPodDisruptionBudget(input *policyv1.PodDisruptionBudget) *PodDisru
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transformReplicaSet(input *appsv1.ReplicaSet) *ReplicaSet {
|
|
|
+func TransformReplicaSet(input *appsv1.ReplicaSet) *ReplicaSet {
|
|
|
return &ReplicaSet{
|
|
|
Name: input.Name,
|
|
|
Namespace: input.Namespace,
|
|
|
@@ -538,7 +538,7 @@ func (kcc *KubernetesClusterCache) GetAllNamespaces() []*Namespace {
|
|
|
var namespaces []*Namespace
|
|
|
items := kcc.namespaceWatch.GetAll()
|
|
|
for _, ns := range items {
|
|
|
- namespaces = append(namespaces, transformNamespace(ns.(*v1.Namespace)))
|
|
|
+ namespaces = append(namespaces, TransformNamespace(ns.(*v1.Namespace)))
|
|
|
}
|
|
|
return namespaces
|
|
|
}
|
|
|
@@ -547,7 +547,7 @@ func (kcc *KubernetesClusterCache) GetAllNodes() []*Node {
|
|
|
var nodes []*Node
|
|
|
items := kcc.nodeWatch.GetAll()
|
|
|
for _, node := range items {
|
|
|
- nodes = append(nodes, transformNode(node.(*v1.Node)))
|
|
|
+ nodes = append(nodes, TransformNode(node.(*v1.Node)))
|
|
|
}
|
|
|
return nodes
|
|
|
}
|
|
|
@@ -556,7 +556,7 @@ func (kcc *KubernetesClusterCache) GetAllPods() []*Pod {
|
|
|
var pods []*Pod
|
|
|
items := kcc.podWatch.GetAll()
|
|
|
for _, pod := range items {
|
|
|
- pods = append(pods, transformPod(pod.(*v1.Pod)))
|
|
|
+ pods = append(pods, TransformPod(pod.(*v1.Pod)))
|
|
|
}
|
|
|
return pods
|
|
|
}
|
|
|
@@ -565,7 +565,7 @@ func (kcc *KubernetesClusterCache) GetAllServices() []*Service {
|
|
|
var services []*Service
|
|
|
items := kcc.serviceWatch.GetAll()
|
|
|
for _, service := range items {
|
|
|
- services = append(services, transformService(service.(*v1.Service)))
|
|
|
+ services = append(services, TransformService(service.(*v1.Service)))
|
|
|
}
|
|
|
return services
|
|
|
}
|
|
|
@@ -574,7 +574,7 @@ func (kcc *KubernetesClusterCache) GetAllDaemonSets() []*DaemonSet {
|
|
|
var daemonsets []*DaemonSet
|
|
|
items := kcc.daemonsetsWatch.GetAll()
|
|
|
for _, daemonset := range items {
|
|
|
- daemonsets = append(daemonsets, transformDaemonSet(daemonset.(*appsv1.DaemonSet)))
|
|
|
+ daemonsets = append(daemonsets, TransformDaemonSet(daemonset.(*appsv1.DaemonSet)))
|
|
|
}
|
|
|
return daemonsets
|
|
|
}
|
|
|
@@ -583,7 +583,7 @@ func (kcc *KubernetesClusterCache) GetAllDeployments() []*Deployment {
|
|
|
var deployments []*Deployment
|
|
|
items := kcc.deploymentsWatch.GetAll()
|
|
|
for _, deployment := range items {
|
|
|
- deployments = append(deployments, transformDeployment(deployment.(*appsv1.Deployment)))
|
|
|
+ deployments = append(deployments, TransformDeployment(deployment.(*appsv1.Deployment)))
|
|
|
}
|
|
|
return deployments
|
|
|
}
|
|
|
@@ -592,7 +592,7 @@ func (kcc *KubernetesClusterCache) GetAllStatefulSets() []*StatefulSet {
|
|
|
var statefulsets []*StatefulSet
|
|
|
items := kcc.statefulsetWatch.GetAll()
|
|
|
for _, statefulset := range items {
|
|
|
- statefulsets = append(statefulsets, transformStatefulSet(statefulset.(*appsv1.StatefulSet)))
|
|
|
+ statefulsets = append(statefulsets, TransformStatefulSet(statefulset.(*appsv1.StatefulSet)))
|
|
|
}
|
|
|
return statefulsets
|
|
|
}
|
|
|
@@ -601,7 +601,7 @@ func (kcc *KubernetesClusterCache) GetAllReplicaSets() []*ReplicaSet {
|
|
|
var replicasets []*ReplicaSet
|
|
|
items := kcc.replicasetWatch.GetAll()
|
|
|
for _, replicaset := range items {
|
|
|
- replicasets = append(replicasets, transformReplicaSet(replicaset.(*appsv1.ReplicaSet)))
|
|
|
+ replicasets = append(replicasets, TransformReplicaSet(replicaset.(*appsv1.ReplicaSet)))
|
|
|
}
|
|
|
return replicasets
|
|
|
}
|
|
|
@@ -610,7 +610,7 @@ func (kcc *KubernetesClusterCache) GetAllPersistentVolumes() []*PersistentVolume
|
|
|
var pvs []*PersistentVolume
|
|
|
items := kcc.pvWatch.GetAll()
|
|
|
for _, pv := range items {
|
|
|
- pvs = append(pvs, transformPersistentVolume(pv.(*v1.PersistentVolume)))
|
|
|
+ pvs = append(pvs, TransformPersistentVolume(pv.(*v1.PersistentVolume)))
|
|
|
}
|
|
|
return pvs
|
|
|
}
|
|
|
@@ -619,7 +619,7 @@ func (kcc *KubernetesClusterCache) GetAllPersistentVolumeClaims() []*PersistentV
|
|
|
var pvcs []*PersistentVolumeClaim
|
|
|
items := kcc.pvcWatch.GetAll()
|
|
|
for _, pvc := range items {
|
|
|
- pvcs = append(pvcs, transformPersistentVolumeClaim(pvc.(*v1.PersistentVolumeClaim)))
|
|
|
+ pvcs = append(pvcs, TransformPersistentVolumeClaim(pvc.(*v1.PersistentVolumeClaim)))
|
|
|
}
|
|
|
return pvcs
|
|
|
}
|
|
|
@@ -628,7 +628,7 @@ func (kcc *KubernetesClusterCache) GetAllStorageClasses() []*StorageClass {
|
|
|
var storageClasses []*StorageClass
|
|
|
items := kcc.storageClassWatch.GetAll()
|
|
|
for _, stc := range items {
|
|
|
- storageClasses = append(storageClasses, transformStorageClass(stc.(*stv1.StorageClass)))
|
|
|
+ storageClasses = append(storageClasses, TransformStorageClass(stc.(*stv1.StorageClass)))
|
|
|
}
|
|
|
return storageClasses
|
|
|
}
|
|
|
@@ -637,7 +637,7 @@ func (kcc *KubernetesClusterCache) GetAllJobs() []*Job {
|
|
|
var jobs []*Job
|
|
|
items := kcc.jobsWatch.GetAll()
|
|
|
for _, job := range items {
|
|
|
- jobs = append(jobs, transformJob(job.(*batchv1.Job)))
|
|
|
+ jobs = append(jobs, TransformJob(job.(*batchv1.Job)))
|
|
|
}
|
|
|
return jobs
|
|
|
}
|
|
|
@@ -646,7 +646,7 @@ func (kcc *KubernetesClusterCache) GetAllPodDisruptionBudgets() []*PodDisruption
|
|
|
var pdbs []*PodDisruptionBudget
|
|
|
items := kcc.pdbWatch.GetAll()
|
|
|
for _, pdb := range items {
|
|
|
- pdbs = append(pdbs, transformPodDisruptionBudget(pdb.(*policyv1.PodDisruptionBudget)))
|
|
|
+ pdbs = append(pdbs, TransformPodDisruptionBudget(pdb.(*policyv1.PodDisruptionBudget)))
|
|
|
}
|
|
|
return pdbs
|
|
|
}
|
|
|
@@ -655,7 +655,7 @@ func (kcc *KubernetesClusterCache) GetAllReplicationControllers() []*Replication
|
|
|
var rcs []*ReplicationController
|
|
|
items := kcc.replicationControllerWatch.GetAll()
|
|
|
for _, rc := range items {
|
|
|
- rcs = append(rcs, transformReplicationController(rc.(*v1.ReplicationController)))
|
|
|
+ rcs = append(rcs, TransformReplicationController(rc.(*v1.ReplicationController)))
|
|
|
}
|
|
|
return rcs
|
|
|
}
|