Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add ibm-cpp-config backin in non-olm env
Signed-off-by: Allen Li <[email protected]>
  • Loading branch information
qpdpQ committed Jan 30, 2025
commit 6c273f9ceb652c6b31620eab8e2ee447e93955fa
63 changes: 34 additions & 29 deletions controllers/commonservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,6 @@ const (

func (r *CommonServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

if os.Getenv("NO_OLM") == "true" {
klog.Infof("Reconciling CommonService: %s in non OLM environment", req.NamespacedName)

klog.Infof("Start to Create ODLM CR in the namespace %s", r.Bootstrap.CSData.OperatorNs)
// Check if ODLM OperandRegistry and OperandConfig are created
klog.Info("Checking if OperandRegistry and OperandConfig CRD already exist")
existOpreg, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpregKind)
existOpcon, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpconKind)
// Install/update Opreg and Opcon resources before installing ODLM if CRDs exist
if existOpreg && existOpcon {

klog.Info("Installing/Updating OperandRegistry")
if err := r.Bootstrap.InstallOrUpdateOpreg(true, ""); err != nil {
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
return ctrl.Result{}, err
}

klog.Info("Installing/Updating OperandConfig")
if err := r.Bootstrap.InstallOrUpdateOpcon(true); err != nil {
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
return ctrl.Result{}, err
}
} else {
klog.Error("ODLM CRD not ready, waiting for it to be ready")
}

return ctrl.Result{}, nil
}

klog.Infof("Reconciling CommonService: %s", req.NamespacedName)

// Fetch the CommonService instance
Expand Down Expand Up @@ -124,6 +95,40 @@ func (r *CommonServiceReconciler) Reconcile(ctx context.Context, req ctrl.Reques
klog.Error("Accept license by changing .spec.license.accept to true in the CommonService CR. Operator will not proceed until then")
}

if os.Getenv("NO_OLM") == "true" {
klog.Infof("Reconciling CommonService: %s in non OLM environment", req.NamespacedName)

klog.Infof("HEllO")
if err := configurationcollector.CreateUpdateConfig(r.Bootstrap); err != nil {
klog.Errorf("Fail to reconcile %s/%s: %v", instance.Namespace, instance.Name, err)
return ctrl.Result{}, err
}

klog.Infof("Start to Create ODLM CR in the namespace %s", r.Bootstrap.CSData.OperatorNs)
// Check if ODLM OperandRegistry and OperandConfig are created
klog.Info("Checking if OperandRegistry and OperandConfig CRD already exist")
existOpreg, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpregKind)
existOpcon, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpconKind)
// Install/update Opreg and Opcon resources before installing ODLM if CRDs exist
if existOpreg && existOpcon {
klog.Info("Installing/Updating OperandRegistry")
if err := r.Bootstrap.InstallOrUpdateOpreg(true, ""); err != nil {
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
return ctrl.Result{}, err
}

klog.Info("Installing/Updating OperandConfig")
if err := r.Bootstrap.InstallOrUpdateOpcon(true); err != nil {
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
return ctrl.Result{}, err
}
} else {
klog.Error("ODLM CRD not ready, waiting for it to be ready")
}

return ctrl.Result{}, nil
}

// If the CommonService CR is not paused, continue to reconcile
if !r.reconcilePauseRequest(instance) {
if r.checkNamespace(req.NamespacedName.String()) {
Expand Down