in operator/controllers/operator/banyandb_controller.go [54:86]
func (r *BanyanDBReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := runtimelog.FromContext(ctx)
log.Info("=====================reconcile started================================")
var banyanDB v1alpha1.BanyanDB
if err := r.Get(ctx, req.NamespacedName, &banyanDB); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err)
}
ff, err := r.FileRepo.GetFilesRecursive("templates")
if err != nil {
log.Error(err, "failed to load resource templates")
return ctrl.Result{}, err
}
app := kubernetes.Application{
Client: r.Client,
CR: &banyanDB,
FileRepo: r.FileRepo,
GVK: operatorv1alpha1.GroupVersion.WithKind("BanyanDB"),
Recorder: r.Recorder,
}
if err := app.ApplyAll(ctx, ff, log); err != nil {
return ctrl.Result{}, err
}
if err := r.checkState(ctx, log, &banyanDB); err != nil {
log.Error(err, "failed to check sub resources state")
return ctrl.Result{}, err
}
return ctrl.Result{RequeueAfter: schedDuration}, nil
}