Correlations: Create first version of correlations on app platform (#110843)
* WIP * Generate API * use different logging, change typing as recommended * Add feature flag and only add to installer when enabled * add codeowner * Lint/fmt * fix dockerfile * move from UID to group/name reference * add generated code * change from enterprise build * build workspace * Remove deprecated field, build api, build for enterprise, build workspace * Not sure what caused this.. * Rebuild? * Fix this file * update sdk * update sdk * fix workspace * fix test build * add to go.mod --------- Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
co-authored by
Ryan McKinley
parent
82e5019333
commit
a6db37c2b7
@@ -0,0 +1,44 @@
|
||||
package correlations
|
||||
|
||||
import (
|
||||
restclient "k8s.io/client-go/rest"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
appsdkapiserver "github.com/grafana/grafana-app-sdk/k8s/apiserver"
|
||||
"github.com/grafana/grafana-app-sdk/simple"
|
||||
"github.com/grafana/grafana/apps/correlations/pkg/apis"
|
||||
correlationsapp "github.com/grafana/grafana/apps/correlations/pkg/app"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
var (
|
||||
_ appsdkapiserver.AppInstaller = (*CorrelationsAppInstaller)(nil)
|
||||
)
|
||||
|
||||
type CorrelationsAppInstaller struct {
|
||||
appsdkapiserver.AppInstaller
|
||||
cfg *setting.Cfg
|
||||
}
|
||||
|
||||
func RegisterAppInstaller(
|
||||
cfg *setting.Cfg,
|
||||
features featuremgmt.FeatureToggles,
|
||||
) (*CorrelationsAppInstaller, error) {
|
||||
installer := &CorrelationsAppInstaller{
|
||||
cfg: cfg,
|
||||
}
|
||||
provider := simple.NewAppProvider(apis.LocalManifest(), nil, correlationsapp.New)
|
||||
|
||||
appConfig := app.Config{
|
||||
KubeConfig: restclient.Config{}, // this will be overridden by the installer's InitializeApp method
|
||||
ManifestData: *apis.LocalManifest().ManifestData,
|
||||
}
|
||||
i, err := appsdkapiserver.NewDefaultAppInstaller(provider, appConfig, &apis.GoTypeAssociator{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
installer.AppInstaller = i
|
||||
|
||||
return installer, nil
|
||||
}
|
||||
Reference in New Issue
Block a user