summaryrefslogtreecommitdiffstats
path: root/src/monitor/pkg
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-08-12 15:33:12 -0700
committerEric Multanen <eric.w.multanen@intel.com>2020-08-31 15:50:06 -0700
commit645c6a331cd00043fcf9f567f5f261a9db070918 (patch)
tree3298b48aca4d93d22680960bd2a27290799b5732 /src/monitor/pkg
parentce99856834a225f6f68b6eda725ae7122a2f8185 (diff)
Enhance the status query API
This patch enhances the status query API. - The ResourceBundleState CRD is modified to just use the k8s Pod structure instead of a customized struct. - Status queries can either present results showing the rsync status of the composite app and resources or from information received from the cluster via the ResourceBundleState CR - Query parameters are provided to the API call to customize the query and response - Support for querying status of cluster network intents is added Issue-ID: MULTICLOUD-1042 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Icca4cdd901e2f2b446414fade256fc24d87594cd
Diffstat (limited to 'src/monitor/pkg')
-rw-r--r--src/monitor/pkg/apis/k8splugin/v1alpha1/types.go2
-rw-r--r--src/monitor/pkg/apis/k8splugin/v1alpha1/zz_generated.deepcopy.go4
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/configMap_controller.go1
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/controller.go14
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/daemonSet_controller.go1
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/deployment_controller.go1
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/ingress_controller.go1
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/job_controller.go1
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/pod_controller.go6
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/secret_controller.go1
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/service_controller.go1
-rw-r--r--src/monitor/pkg/controller/resourcebundlestate/statefulSet_controller.go1
12 files changed, 26 insertions, 8 deletions
diff --git a/src/monitor/pkg/apis/k8splugin/v1alpha1/types.go b/src/monitor/pkg/apis/k8splugin/v1alpha1/types.go
index 064591fc..6476f0db 100644
--- a/src/monitor/pkg/apis/k8splugin/v1alpha1/types.go
+++ b/src/monitor/pkg/apis/k8splugin/v1alpha1/types.go
@@ -33,7 +33,7 @@ type ResourceBundleStateSpec struct {
type ResourceBundleStatus struct {
Ready bool `json:"ready" protobuf:"varint,1,opt,name=ready"`
ResourceCount int32 `json:"resourceCount" protobuf:"varint,2,opt,name=resourceCount"`
- PodStatuses []PodStatus `json:"podStatuses" protobuf:"varint,3,opt,name=podStatuses"`
+ PodStatuses []corev1.Pod `json:"podStatuses" protobuf:"varint,3,opt,name=podStatuses"`
ServiceStatuses []corev1.Service `json:"serviceStatuses" protobuf:"varint,4,opt,name=serviceStatuses"`
ConfigMapStatuses []corev1.ConfigMap `json:"configMapStatuses" protobuf:"varint,5,opt,name=configMapStatuses"`
DeploymentStatuses []appsv1.Deployment `json:"deploymentStatuses" protobuf:"varint,6,opt,name=deploymentStatuses"`
diff --git a/src/monitor/pkg/apis/k8splugin/v1alpha1/zz_generated.deepcopy.go b/src/monitor/pkg/apis/k8splugin/v1alpha1/zz_generated.deepcopy.go
index d25db361..ff974aae 100644
--- a/src/monitor/pkg/apis/k8splugin/v1alpha1/zz_generated.deepcopy.go
+++ b/src/monitor/pkg/apis/k8splugin/v1alpha1/zz_generated.deepcopy.go
@@ -13,6 +13,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
+/*
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodStatus) DeepCopyInto(out *PodStatus) {
*out = *in
@@ -30,6 +31,7 @@ func (in *PodStatus) DeepCopy() *PodStatus {
in.DeepCopyInto(out)
return out
}
+*/
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceBundleState) DeepCopyInto(out *ResourceBundleState) {
@@ -118,7 +120,7 @@ func (in *ResourceBundleStatus) DeepCopyInto(out *ResourceBundleStatus) {
*out = *in
if in.PodStatuses != nil {
in, out := &in.PodStatuses, &out.PodStatuses
- *out = make([]PodStatus, len(*in))
+ *out = make([]corev1.Pod, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
diff --git a/src/monitor/pkg/controller/resourcebundlestate/configMap_controller.go b/src/monitor/pkg/controller/resourcebundlestate/configMap_controller.go
index f93355af..ed9283cc 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/configMap_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/configMap_controller.go
@@ -166,6 +166,7 @@ func (r *configMapReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState, c
// Add it to CR
cr.Status.ConfigMapStatuses = append(cr.Status.ConfigMapStatuses, corev1.ConfigMap{
+ TypeMeta: cm.TypeMeta,
ObjectMeta: cm.ObjectMeta,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/controller.go b/src/monitor/pkg/controller/resourcebundlestate/controller.go
index 7206116b..faee5892 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/controller.go
@@ -145,6 +145,7 @@ func (r *reconciler) updateServices(rbstate *v1alpha1.ResourceBundleState,
for _, svc := range serviceList.Items {
resStatus := corev1.Service{
+ TypeMeta: svc.TypeMeta,
ObjectMeta: svc.ObjectMeta,
Status: svc.Status,
}
@@ -165,12 +166,12 @@ func (r *reconciler) updatePods(rbstate *v1alpha1.ResourceBundleState,
return err
}
- rbstate.Status.PodStatuses = []v1alpha1.PodStatus{}
+ rbstate.Status.PodStatuses = []corev1.Pod{}
for _, pod := range podList.Items {
- resStatus := v1alpha1.PodStatus{
+ resStatus := corev1.Pod{
+ TypeMeta: pod.TypeMeta,
ObjectMeta: pod.ObjectMeta,
- Ready: false,
Status: pod.Status,
}
rbstate.Status.PodStatuses = append(rbstate.Status.PodStatuses, resStatus)
@@ -194,6 +195,7 @@ func (r *reconciler) updateConfigMaps(rbstate *v1alpha1.ResourceBundleState,
for _, cm := range configMapList.Items {
resStatus := corev1.ConfigMap{
+ TypeMeta: cm.TypeMeta,
ObjectMeta: cm.ObjectMeta,
}
rbstate.Status.ConfigMapStatuses = append(rbstate.Status.ConfigMapStatuses, resStatus)
@@ -217,6 +219,7 @@ func (r *reconciler) updateDeployments(rbstate *v1alpha1.ResourceBundleState,
for _, dep := range deploymentList.Items {
resStatus := appsv1.Deployment{
+ TypeMeta: dep.TypeMeta,
ObjectMeta: dep.ObjectMeta,
Status: dep.Status,
}
@@ -241,6 +244,7 @@ func (r *reconciler) updateSecrets(rbstate *v1alpha1.ResourceBundleState,
for _, sec := range secretList.Items {
resStatus := corev1.Secret{
+ TypeMeta: sec.TypeMeta,
ObjectMeta: sec.ObjectMeta,
}
rbstate.Status.SecretStatuses = append(rbstate.Status.SecretStatuses, resStatus)
@@ -264,6 +268,7 @@ func (r *reconciler) updateDaemonSets(rbstate *v1alpha1.ResourceBundleState,
for _, ds := range daemonSetList.Items {
resStatus := appsv1.DaemonSet{
+ TypeMeta: ds.TypeMeta,
ObjectMeta: ds.ObjectMeta,
Status: ds.Status,
}
@@ -288,6 +293,7 @@ func (r *reconciler) updateIngresses(rbstate *v1alpha1.ResourceBundleState,
for _, ing := range ingressList.Items {
resStatus := v1beta1.Ingress{
+ TypeMeta: ing.TypeMeta,
ObjectMeta: ing.ObjectMeta,
Status: ing.Status,
}
@@ -312,6 +318,7 @@ func (r *reconciler) updateJobs(rbstate *v1alpha1.ResourceBundleState,
for _, job := range jobList.Items {
resStatus := v1.Job{
+ TypeMeta: job.TypeMeta,
ObjectMeta: job.ObjectMeta,
Status: job.Status,
}
@@ -336,6 +343,7 @@ func (r *reconciler) updateStatefulSets(rbstate *v1alpha1.ResourceBundleState,
for _, sfs := range statefulSetList.Items {
resStatus := appsv1.StatefulSet{
+ TypeMeta: sfs.TypeMeta,
ObjectMeta: sfs.ObjectMeta,
Status: sfs.Status,
}
diff --git a/src/monitor/pkg/controller/resourcebundlestate/daemonSet_controller.go b/src/monitor/pkg/controller/resourcebundlestate/daemonSet_controller.go
index 3ccb40ce..1f46f05c 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/daemonSet_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/daemonSet_controller.go
@@ -168,6 +168,7 @@ func (r *daemonSetReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState, d
// Add it to CR
cr.Status.DaemonSetStatuses = append(cr.Status.DaemonSetStatuses, appsv1.DaemonSet{
+ TypeMeta: ds.TypeMeta,
ObjectMeta: ds.ObjectMeta,
Status: ds.Status,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/deployment_controller.go b/src/monitor/pkg/controller/resourcebundlestate/deployment_controller.go
index c563ed77..99ca2f40 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/deployment_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/deployment_controller.go
@@ -168,6 +168,7 @@ func (r *deploymentReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState,
// Add it to CR
cr.Status.DeploymentStatuses = append(cr.Status.DeploymentStatuses, appsv1.Deployment{
+ TypeMeta: dep.TypeMeta,
ObjectMeta: dep.ObjectMeta,
Status: dep.Status,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/ingress_controller.go b/src/monitor/pkg/controller/resourcebundlestate/ingress_controller.go
index 603536b3..f6113686 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/ingress_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/ingress_controller.go
@@ -168,6 +168,7 @@ func (r *ingressReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState, ing
// Add it to CR
cr.Status.IngressStatuses = append(cr.Status.IngressStatuses, v1beta1.Ingress{
+ TypeMeta: ing.TypeMeta,
ObjectMeta: ing.ObjectMeta,
Status: ing.Status,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/job_controller.go b/src/monitor/pkg/controller/resourcebundlestate/job_controller.go
index cd76e66f..63bd9535 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/job_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/job_controller.go
@@ -168,6 +168,7 @@ func (r *jobReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState, job *v1
// Add it to CR
cr.Status.JobStatuses = append(cr.Status.JobStatuses, v1.Job{
+ TypeMeta: job.TypeMeta,
ObjectMeta: job.ObjectMeta,
Status: job.Status,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/pod_controller.go b/src/monitor/pkg/controller/resourcebundlestate/pod_controller.go
index 65a324db..0f7ce47e 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/pod_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/pod_controller.go
@@ -136,7 +136,7 @@ func (r *podReconciler) deleteFromSingleCR(cr *v1alpha1.ResourceBundleState, nam
if rstatus.Name == name {
//Delete that status from the array
cr.Status.PodStatuses[i] = cr.Status.PodStatuses[length-1]
- cr.Status.PodStatuses[length-1] = v1alpha1.PodStatus{}
+ cr.Status.PodStatuses[length-1] = corev1.Pod{}
cr.Status.PodStatuses = cr.Status.PodStatuses[:length-1]
return nil
}
@@ -167,9 +167,9 @@ func (r *podReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState, pod *co
cr.Status.ResourceCount++
// Add it to CR
- cr.Status.PodStatuses = append(cr.Status.PodStatuses, v1alpha1.PodStatus{
+ cr.Status.PodStatuses = append(cr.Status.PodStatuses, corev1.Pod{
+ TypeMeta: pod.TypeMeta,
ObjectMeta: pod.ObjectMeta,
- Ready: false,
Status: pod.Status,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/secret_controller.go b/src/monitor/pkg/controller/resourcebundlestate/secret_controller.go
index fe70d53f..0540b687 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/secret_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/secret_controller.go
@@ -166,6 +166,7 @@ func (r *secretReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState, sec
// Add it to CR
cr.Status.SecretStatuses = append(cr.Status.SecretStatuses, corev1.Secret{
+ TypeMeta: sec.TypeMeta,
ObjectMeta: sec.ObjectMeta,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/service_controller.go b/src/monitor/pkg/controller/resourcebundlestate/service_controller.go
index d1bb2fd6..80bde3b6 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/service_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/service_controller.go
@@ -168,6 +168,7 @@ func (r *serviceReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState, svc
// Add it to CR
cr.Status.ServiceStatuses = append(cr.Status.ServiceStatuses, corev1.Service{
+ TypeMeta: svc.TypeMeta,
ObjectMeta: svc.ObjectMeta,
Status: svc.Status,
})
diff --git a/src/monitor/pkg/controller/resourcebundlestate/statefulSet_controller.go b/src/monitor/pkg/controller/resourcebundlestate/statefulSet_controller.go
index ebe61dba..c6183d08 100644
--- a/src/monitor/pkg/controller/resourcebundlestate/statefulSet_controller.go
+++ b/src/monitor/pkg/controller/resourcebundlestate/statefulSet_controller.go
@@ -168,6 +168,7 @@ func (r *statefulSetReconciler) updateSingleCR(cr *v1alpha1.ResourceBundleState,
// Add it to CR
cr.Status.StatefulSetStatuses = append(cr.Status.StatefulSetStatuses, appsv1.StatefulSet{
+ TypeMeta: sfs.TypeMeta,
ObjectMeta: sfs.ObjectMeta,
Status: sfs.Status,
})