Skip to content

Commit 4199ab0

Browse files
Merge pull request #494 from vyzigold/move_dashboards_to_api
[OSPRH-10380] Move dashboards to use go API
2 parents 85d3b6f + a1cec81 commit 4199ab0

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

controllers/metricstorage_controller.go

+6-22
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import (
6666
monv1 "github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring/v1"
6767
monv1alpha1 "github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring/v1alpha1"
6868
obov1 "github.com/rhobs/observability-operator/pkg/apis/monitoring/v1alpha1"
69+
obsui "github.com/rhobs/observability-operator/pkg/apis/uiplugin/v1alpha1"
6970
)
7071

7172
// fields to index to reconcile when change
@@ -634,30 +635,13 @@ func (r *MetricStorageReconciler) createScrapeConfigs(
634635

635636
func (r *MetricStorageReconciler) createDashboardObjects(ctx context.Context, instance *telemetryv1.MetricStorage, eventHandler handler.EventHandler) (ctrl.Result, error) {
636637
Log := r.GetLogger(ctx)
637-
// Deploy dashboard UI plugin from OBO
638-
// TODO: Use the following instead of Unstructured{} after COO 0.2.0
639-
// =====
640-
// uiPluginObj := &obsui.ObservabilityUIPlugin{
641-
// ObjectMeta: metav1.ObjectMeta{
642-
// Name: "dashboards",
643-
// },
644-
// }
645-
// =====
646-
uiPluginObj := &unstructured.Unstructured{}
647-
uiPluginObj.SetUnstructuredContent(map[string]interface{}{
648-
"spec": map[string]interface{}{
649-
"type": "Dashboards",
638+
uiPluginObj := &obsui.UIPlugin{
639+
ObjectMeta: metav1.ObjectMeta{
640+
Name: "dashboards",
650641
},
651-
})
652-
uiPluginObj.SetGroupVersionKind(schema.GroupVersionKind{
653-
Group: "observability.openshift.io",
654-
Version: "v1alpha1",
655-
Kind: "UIPlugin",
656-
})
657-
uiPluginObj.SetName("dashboards")
658-
// =====
642+
}
659643
op, err := controllerutil.CreateOrPatch(ctx, r.Client, uiPluginObj, func() error {
660-
// uiPluginObj.Spec.Type = "Dashboards" // After we update to COO 0.2.0 as dependency
644+
uiPluginObj.Spec.Type = "Dashboards"
661645
return nil
662646
})
663647
if err != nil {

main.go

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
monv1 "github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring/v1"
5050
monv1alpha1 "github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring/v1alpha1"
5151
obov1 "github.com/rhobs/observability-operator/pkg/apis/monitoring/v1alpha1"
52+
obsuiv1 "github.com/rhobs/observability-operator/pkg/apis/uiplugin/v1alpha1"
5253

5354
telemetryv1beta1 "github.com/openstack-k8s-operators/telemetry-operator/api/v1beta1"
5455
"github.com/openstack-k8s-operators/telemetry-operator/controllers"
@@ -67,6 +68,7 @@ func init() {
6768
utilruntime.Must(rabbitmqv1.AddToScheme(scheme))
6869
utilruntime.Must(telemetryv1beta1.AddToScheme(scheme))
6970
utilruntime.Must(obov1.AddToScheme(scheme))
71+
utilruntime.Must(obsuiv1.AddToScheme(scheme))
7072
utilruntime.Must(monv1.AddToScheme(scheme))
7173
utilruntime.Must(monv1alpha1.AddToScheme(scheme))
7274
utilruntime.Must(mariadbv1beta1.AddToScheme(scheme))

0 commit comments

Comments
 (0)