Skip to content

Commit

Permalink
detect resources from a previous installation
Browse files Browse the repository at this point in the history
  • Loading branch information
pb82 committed Aug 6, 2019
1 parent 5292aeb commit b84ccbd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions pkg/controller/grafanadashboard/dashboard_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ func (r *ReconcileGrafanaDashboard) Reconcile(request reconcile.Request) (reconc
}
case common.StatusResourceCreated:
// Import / update dashboard
return r.importDashboard(cr)
res, err := r.importDashboard(cr)

// Requeue periodically to find dashboards that have not been updated
// but are not yet imported (can happen if Grafana is uninstalled and
// then reinstalled without an Operator restart
res.RequeueAfter = common.RequeueDelay
return res, err
default:
return reconcile.Result{}, nil
}
Expand Down Expand Up @@ -242,7 +248,6 @@ func (r *ReconcileGrafanaDashboard) isJsonValid(cr *i8ly.GrafanaDashboard) (bool
var js map[string]interface{}
err := json.Unmarshal([]byte(cr.Spec.Json), &js)
return err == nil, err

}

func (r *ReconcileGrafanaDashboard) hasDashboardChanged(cr *i8ly.GrafanaDashboard) (bool, string) {
Expand Down
8 changes: 7 additions & 1 deletion pkg/controller/grafanadatasource/datasource_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ func (r *ReconcileGrafanaDataSource) Reconcile(request reconcile.Request) (recon
return r.setFinalizer(cr)
}
case common.StatusResourceCreated:
return r.reconcileDatasource(cr)
res, err := r.reconcileDatasource(cr)

// Requeue periodically to find datasources that have not been updated
// but are not yet imported (can happen if Grafana is uninstalled and
// then reinstalled without an Operator restart
res.RequeueAfter = common.RequeueDelay
return res, err
default:
return reconcile.Result{}, nil
}
Expand Down

0 comments on commit b84ccbd

Please sign in to comment.