Skip to content

Commit 5f2f4db

Browse files
authored
create ibm-cpp-config in non-olm (#2357)
* add ibm-cpp-config backin in non-olm env Signed-off-by: Allen Li <[email protected]> * remove comment Signed-off-by: Allen Li <[email protected]> * create ibm-cpp-config Signed-off-by: Allen Li <[email protected]> --------- Signed-off-by: Allen Li <[email protected]>
1 parent b5ed092 commit 5f2f4db

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

controllers/commonservice_controller.go

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,6 @@ const (
6363

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

66-
if os.Getenv("NO_OLM") == "true" {
67-
klog.Infof("Reconciling CommonService: %s in non OLM environment", req.NamespacedName)
68-
69-
klog.Infof("Start to Create ODLM CR in the namespace %s", r.Bootstrap.CSData.OperatorNs)
70-
// Check if ODLM OperandRegistry and OperandConfig are created
71-
klog.Info("Checking if OperandRegistry and OperandConfig CRD already exist")
72-
existOpreg, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpregKind)
73-
existOpcon, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpconKind)
74-
// Install/update Opreg and Opcon resources before installing ODLM if CRDs exist
75-
if existOpreg && existOpcon {
76-
77-
klog.Info("Installing/Updating OperandRegistry")
78-
if err := r.Bootstrap.InstallOrUpdateOpreg(true, ""); err != nil {
79-
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
80-
return ctrl.Result{}, err
81-
}
82-
83-
klog.Info("Installing/Updating OperandConfig")
84-
if err := r.Bootstrap.InstallOrUpdateOpcon(true); err != nil {
85-
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
86-
return ctrl.Result{}, err
87-
}
88-
} else {
89-
klog.Error("ODLM CRD not ready, waiting for it to be ready")
90-
}
91-
92-
return ctrl.Result{}, nil
93-
}
94-
9566
klog.Infof("Reconciling CommonService: %s", req.NamespacedName)
9667

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

98+
if os.Getenv("NO_OLM") == "true" {
99+
klog.Infof("Reconciling CommonService: %s in non OLM environment", req.NamespacedName)
100+
101+
// create ibm-cpp-config configmap
102+
if err := configurationcollector.CreateUpdateConfig(r.Bootstrap); err != nil {
103+
klog.Errorf("Fail to reconcile %s/%s: %v", instance.Namespace, instance.Name, err)
104+
return ctrl.Result{}, err
105+
}
106+
107+
klog.Infof("Start to Create ODLM CR in the namespace %s", r.Bootstrap.CSData.OperatorNs)
108+
// Check if ODLM OperandRegistry and OperandConfig are created
109+
klog.Info("Checking if OperandRegistry and OperandConfig CRD already exist")
110+
existOpreg, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpregKind)
111+
existOpcon, _ := r.Bootstrap.CheckCRD(constant.OpregAPIGroupVersion, constant.OpconKind)
112+
// Install/update Opreg and Opcon resources before installing ODLM if CRDs exist
113+
if existOpreg && existOpcon {
114+
klog.Info("Installing/Updating OperandRegistry")
115+
if err := r.Bootstrap.InstallOrUpdateOpreg(true, ""); err != nil {
116+
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
117+
return ctrl.Result{}, err
118+
}
119+
120+
klog.Info("Installing/Updating OperandConfig")
121+
if err := r.Bootstrap.InstallOrUpdateOpcon(true); err != nil {
122+
klog.Errorf("Fail to Installing/Updating OperandConfig: %v", err)
123+
return ctrl.Result{}, err
124+
}
125+
126+
// Temporary solution for EDB image ConfigMap reference
127+
if err := r.Bootstrap.CreateEDBImageMaps(); err != nil {
128+
klog.Errorf("Failed to create EDB Image ConfigMap: %v", err)
129+
return ctrl.Result{}, err
130+
}
131+
} else {
132+
klog.Error("ODLM CRD not ready, waiting for it to be ready")
133+
}
134+
135+
return ctrl.Result{}, nil
136+
}
137+
127138
// If the CommonService CR is not paused, continue to reconcile
128139
if !r.reconcilePauseRequest(instance) {
129140
if r.checkNamespace(req.NamespacedName.String()) {

0 commit comments

Comments
 (0)