mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* add initial structure for investigations app backedn * update version * Fix codegen & paths Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Fix Go workspace and CODEOWNERS Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * update kinds for investigation * update dockerfile * update codeowners * update dependabot * update golangci * add investigation app and watcher * run make update-workspace * run make update-workspace * register investigation app * add investigation app to wireset * add investigations app provider to api initializer * fix imports * update feature toggle * fix cue definition and api initializer * clean up removing unecessary components * remove watcher feature toggle * add investigations backend behind feature toggle * revert change --------- Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> Co-authored-by: Igor Suleymanov <igor.suleymanov@grafana.com>
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana-app-sdk/app"
|
|
"github.com/grafana/grafana-app-sdk/resource"
|
|
"github.com/grafana/grafana-app-sdk/simple"
|
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
"k8s.io/klog/v2"
|
|
|
|
investigationv1alpha1 "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1"
|
|
)
|
|
|
|
func New(cfg app.Config) (app.App, error) {
|
|
var err error
|
|
simpleConfig := simple.AppConfig{
|
|
Name: "investigation",
|
|
KubeConfig: cfg.KubeConfig,
|
|
InformerConfig: simple.AppInformerConfig{
|
|
ErrorHandler: func(ctx context.Context, err error) {
|
|
klog.ErrorS(err, "Informer processing error")
|
|
},
|
|
},
|
|
ManagedKinds: []simple.AppManagedKind{
|
|
{
|
|
Kind: investigationv1alpha1.InvestigationKind(),
|
|
},
|
|
},
|
|
}
|
|
|
|
a, err := simple.NewApp(simpleConfig)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
err = a.ValidateManifest(cfg.ManifestData)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return a, nil
|
|
}
|
|
|
|
func GetKinds() map[schema.GroupVersion][]resource.Kind {
|
|
gv := schema.GroupVersion{
|
|
Group: investigationv1alpha1.InvestigationKind().Group(),
|
|
Version: investigationv1alpha1.InvestigationKind().Version(),
|
|
}
|
|
return map[schema.GroupVersion][]resource.Kind{
|
|
gv: {investigationv1alpha1.InvestigationKind()},
|
|
}
|
|
}
|