diff --git a/controllers/cinder_controller.go b/controllers/cinder_controller.go index 5dfe21b6..119da0c6 100644 --- a/controllers/cinder_controller.go +++ b/controllers/cinder_controller.go @@ -136,6 +136,7 @@ func (r *CinderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res return ctrl.Result{}, nil } // Error reading the object - requeue the request. + Log.Error(err, fmt.Sprintf("could not fetch Cinder instance %s", instance.Name)) return ctrl.Result{}, err } @@ -147,6 +148,7 @@ func (r *CinderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res Log, ) if err != nil { + Log.Error(err, fmt.Sprintf("could not instantiate helper for instance %s", instance.Name)) return ctrl.Result{}, err } @@ -654,22 +656,6 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder return ctrlResult, nil } - // Handle service update - ctrlResult, err = r.reconcileUpdate(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service upgrade - ctrlResult, err = r.reconcileUpgrade(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - // // normal reconcile tasks // @@ -686,7 +672,7 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder return ctrl.Result{}, err } if op != controllerutil.OperationResultNone { - Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("API CR for %s successfully %s", instance.Name, string(op))) } // Mirror values when the data in the StatefulSet is for the current generation @@ -715,7 +701,7 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder return ctrl.Result{}, err } if op != controllerutil.OperationResultNone { - Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("Scheduler CR for %s successfully %s", instance.Name, string(op))) } // Mirror values when the data in the StatefulSet is for the current generation @@ -747,7 +733,7 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder return ctrl.Result{}, err } if op != controllerutil.OperationResultNone { - Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("Backup CR for %s successfully %s", instance.Name, string(op))) } // Mirror values when the data in the StatefulSet is for the current generation @@ -790,7 +776,7 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder return ctrl.Result{}, err } if op != controllerutil.OperationResultNone { - Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op))) + Log.Info(fmt.Sprintf("Volume %s CR for %s successfully %s", name, instance.Name, string(op))) } // Mirror values when the data in the StatefulSet is for the current generation @@ -864,30 +850,6 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder return ctrl.Result{}, nil } -func (r *CinderReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.Cinder) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name)) - - // TODO: should have minor update tasks if required - // - delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name)) - return ctrl.Result{}, nil -} - -func (r *CinderReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.Cinder) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name)) - - // TODO: should have major version upgrade tasks - // -delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name)) - return ctrl.Result{}, nil -} - // generateServiceConfigs - create Secret which hold scripts and service configuration func (r *CinderReconciler) generateServiceConfigs( ctx context.Context, @@ -1253,6 +1215,8 @@ func (r *CinderReconciler) ensureDB( h *helper.Helper, instance *cinderv1beta1.Cinder, ) (*mariadbv1.Database, ctrl.Result, error) { + Log := r.GetLogger(ctx) + // ensure MariaDBAccount exists. This account record may be created by // openstack-operator or the cloud operator up front without a specific // MariaDBDatabase configured yet. Otherwise, a MariaDBAccount CR is @@ -1320,6 +1284,7 @@ func (r *CinderReconciler) ensureDB( return db, ctrlResult, err } if (ctrlResult != ctrl.Result{}) { + Log.Info(fmt.Sprintf("%s... requeueing", condition.DBReadyRunningMessage)) instance.Status.Conditions.Set(condition.FalseCondition( condition.DBReadyCondition, condition.RequestedReason, diff --git a/controllers/cinderapi_controller.go b/controllers/cinderapi_controller.go index a6e54613..47790f7d 100644 --- a/controllers/cinderapi_controller.go +++ b/controllers/cinderapi_controller.go @@ -821,22 +821,6 @@ func (r *CinderAPIReconciler) reconcileNormal(ctx context.Context, instance *cin return ctrlResult, nil } - // Handle service update - ctrlResult, err = r.reconcileUpdate(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service upgrade - ctrlResult, err = r.reconcileUpgrade(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - // // normal reconcile tasks // @@ -984,30 +968,6 @@ func (r *CinderAPIReconciler) reconcileNormal(ctx context.Context, instance *cin return ctrl.Result{}, nil } -func (r *CinderAPIReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderAPI) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name)) - - // TODO: should have minor update tasks if required - // - delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name)) - return ctrl.Result{}, nil -} - -func (r *CinderAPIReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderAPI) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name)) - - // TODO: should have major version upgrade tasks - // -delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name)) - return ctrl.Result{}, nil -} - // generateServiceConfigs - create Secret which holds the service configuration func (r *CinderAPIReconciler) generateServiceConfigs( ctx context.Context, diff --git a/controllers/cinderbackup_controller.go b/controllers/cinderbackup_controller.go index 6bca8055..39f06a56 100644 --- a/controllers/cinderbackup_controller.go +++ b/controllers/cinderbackup_controller.go @@ -320,18 +320,6 @@ func (r *CinderBackupReconciler) reconcileDelete(ctx context.Context, instance * return ctrl.Result{}, nil } -func (r *CinderBackupReconciler) reconcileInit( - ctx context.Context, - instance *cinderv1beta1.CinderBackup, -) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' init", instance.Name)) - - Log.Info(fmt.Sprintf("Reconciled Service '%s' init successfully", instance.Name)) - return ctrl.Result{}, nil -} - func (r *CinderBackupReconciler) reconcileNormal(ctx context.Context, instance *cinderv1beta1.CinderBackup, helper *helper.Helper) (ctrl.Result, error) { Log := r.GetLogger(ctx) @@ -516,30 +504,6 @@ func (r *CinderBackupReconciler) reconcileNormal(ctx context.Context, instance * return ctrl.Result{}, err } - // Handle service init - ctrlResult, err = r.reconcileInit(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service update - ctrlResult, err = r.reconcileUpdate(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service upgrade - ctrlResult, err = r.reconcileUpgrade(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - // // normal reconcile tasks // @@ -652,30 +616,6 @@ func (r *CinderBackupReconciler) reconcileNormal(ctx context.Context, instance * return ctrl.Result{}, nil } -func (r *CinderBackupReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderBackup) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name)) - - // TODO: should have minor update tasks if required - // - delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name)) - return ctrl.Result{}, nil -} - -func (r *CinderBackupReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderBackup) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name)) - - // TODO: should have major version upgrade tasks - // -delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name)) - return ctrl.Result{}, nil -} - // generateServiceConfigs - create Secret which holds the service configuration func (r *CinderBackupReconciler) generateServiceConfigs( ctx context.Context, diff --git a/controllers/cinderscheduler_controller.go b/controllers/cinderscheduler_controller.go index ece04b0c..fbac5a06 100644 --- a/controllers/cinderscheduler_controller.go +++ b/controllers/cinderscheduler_controller.go @@ -320,18 +320,6 @@ func (r *CinderSchedulerReconciler) reconcileDelete(ctx context.Context, instanc return ctrl.Result{}, nil } -func (r *CinderSchedulerReconciler) reconcileInit( - ctx context.Context, - instance *cinderv1beta1.CinderScheduler, -) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' init", instance.Name)) - - Log.Info(fmt.Sprintf("Reconciled Service '%s' init successfully", instance.Name)) - return ctrl.Result{}, nil -} - func (r *CinderSchedulerReconciler) reconcileNormal(ctx context.Context, instance *cinderv1beta1.CinderScheduler, helper *helper.Helper) (ctrl.Result, error) { Log := r.GetLogger(ctx) @@ -515,30 +503,6 @@ func (r *CinderSchedulerReconciler) reconcileNormal(ctx context.Context, instanc return ctrl.Result{}, err } - // Handle service init - ctrlResult, err = r.reconcileInit(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service update - ctrlResult, err = r.reconcileUpdate(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service upgrade - ctrlResult, err = r.reconcileUpgrade(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - // // normal reconcile tasks // @@ -651,30 +615,6 @@ func (r *CinderSchedulerReconciler) reconcileNormal(ctx context.Context, instanc return ctrl.Result{}, nil } -func (r *CinderSchedulerReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderScheduler) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name)) - - // TODO: should have minor update tasks if required - // - delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name)) - return ctrl.Result{}, nil -} - -func (r *CinderSchedulerReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderScheduler) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name)) - - // TODO: should have major version upgrade tasks - // -delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name)) - return ctrl.Result{}, nil -} - // generateServiceConfigs - create Secret which holds the service configuration func (r *CinderSchedulerReconciler) generateServiceConfigs( ctx context.Context, diff --git a/controllers/cindervolume_controller.go b/controllers/cindervolume_controller.go index aea0d30f..f00deedf 100644 --- a/controllers/cindervolume_controller.go +++ b/controllers/cindervolume_controller.go @@ -322,18 +322,6 @@ func (r *CinderVolumeReconciler) reconcileDelete(ctx context.Context, instance * return ctrl.Result{}, nil } -func (r *CinderVolumeReconciler) reconcileInit( - ctx context.Context, - instance *cinderv1beta1.CinderVolume, -) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' init", instance.Name)) - - Log.Info(fmt.Sprintf("Reconciled Service '%s' init successfully", instance.Name)) - return ctrl.Result{}, nil -} - func (r *CinderVolumeReconciler) reconcileNormal(ctx context.Context, instance *cinderv1beta1.CinderVolume, helper *helper.Helper) (ctrl.Result, error) { Log := r.GetLogger(ctx) @@ -518,30 +506,6 @@ func (r *CinderVolumeReconciler) reconcileNormal(ctx context.Context, instance * return ctrl.Result{}, err } - // Handle service init - ctrlResult, err = r.reconcileInit(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service update - ctrlResult, err = r.reconcileUpdate(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - - // Handle service upgrade - ctrlResult, err = r.reconcileUpgrade(ctx, instance) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil - } - // // normal reconcile tasks // @@ -654,30 +618,6 @@ func (r *CinderVolumeReconciler) reconcileNormal(ctx context.Context, instance * return ctrl.Result{}, nil } -func (r *CinderVolumeReconciler) reconcileUpdate(ctx context.Context, instance *cinderv1beta1.CinderVolume) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' update", instance.Name)) - - // TODO: should have minor update tasks if required - // - delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' update successfully", instance.Name)) - return ctrl.Result{}, nil -} - -func (r *CinderVolumeReconciler) reconcileUpgrade(ctx context.Context, instance *cinderv1beta1.CinderVolume) (ctrl.Result, error) { - Log := r.GetLogger(ctx) - - Log.Info(fmt.Sprintf("Reconciling Service '%s' upgrade", instance.Name)) - - // TODO: should have major version upgrade tasks - // -delete dbsync hash from status to rerun it? - - Log.Info(fmt.Sprintf("Reconciled Service '%s' upgrade successfully", instance.Name)) - return ctrl.Result{}, nil -} - // generateServiceConfigs - create Secret which holds the service configuration and check if it's using LVM func (r *CinderVolumeReconciler) generateServiceConfigs( ctx context.Context,