Skip to content

Commit a1cec81

Browse files
committed
Move dashboards to use go API
1 parent 0b65ef4 commit a1cec81

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
@@ -633,30 +634,13 @@ func (r *MetricStorageReconciler) createScrapeConfigs(
633634

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