Provisioning: Move OSS provisioning to Run step (#105428)

* Provisioning: Move OSS provisioning to Run step

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>


---------

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
pull/105696/head
maicon 1 week ago committed by GitHub
parent 9308f86d63
commit 1435eedbc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 38
      pkg/services/provisioning/provisioning.go

@ -171,30 +171,36 @@ type ProvisioningServiceImpl struct {
}
func (ps *ProvisioningServiceImpl) RunInitProvisioners(ctx context.Context) error {
err := ps.ProvisionDatasources(ctx)
if err != nil {
ps.log.Error("Failed to provision data sources", "error", err)
return err
}
err = ps.ProvisionPlugins(ctx)
if err != nil {
ps.log.Error("Failed to provision plugins", "error", err)
return err
}
// We had to move the initialization of OSS provisioners to Run()
// because they need the /apis/* endpoints to be ready and listening.
// They query these endpoints to retrieve folders and dashboards.
return nil
}
func (ps *ProvisioningServiceImpl) Run(ctx context.Context) error {
var err error
// Run Datasources, Plugins and Alerting Provisioning only once.
// It can't be initialized at RunInitProvisioners because it
// depends on the /apis endpoints to be already running and listeningq
ps.onceInitProvisioners.Do(func() {
// Run Alerting Provisioning only once.
// It can't be initialized at RunInitProvisioners because it
// depends on the Server to be already running and listening
// to /apis endpoints.
err = ps.ProvisionDatasources(ctx)
if err != nil {
ps.log.Error("Failed to provision data sources", "error", err)
return
}
err = ps.ProvisionPlugins(ctx)
if err != nil {
ps.log.Error("Failed to provision plugins", "error", err)
return
}
err = ps.ProvisionAlerting(ctx)
if err != nil {
ps.log.Error("Failed to provision alerting", "error", err)
return
}
})
if err != nil {

Loading…
Cancel
Save