Skip to content

Commit ad572c6

Browse files
authored
Update RCO to include knative and operator configmap label updates (#456)
Signed-off-by: Leo Christy Jesuraj <[email protected]>
1 parent d718c2e commit ad572c6

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

controllers/webspherelibertyapplication_controller.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import (
4747
ctrl "sigs.k8s.io/controller-runtime"
4848
"sigs.k8s.io/controller-runtime/pkg/builder"
4949
"sigs.k8s.io/controller-runtime/pkg/client"
50-
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
5150
"sigs.k8s.io/controller-runtime/pkg/event"
5251
"sigs.k8s.io/controller-runtime/pkg/predicate"
5352
"sigs.k8s.io/controller-runtime/pkg/reconcile"
@@ -110,22 +109,11 @@ func (r *ReconcileWebSphereLiberty) Reconcile(ctx context.Context, request ctrl.
110109
configMap, err := r.GetOpConfigMap(OperatorName, ns)
111110
if err != nil {
112111
reqLogger.Info("Failed to get websphere-liberty-operator config map, error: " + err.Error())
113-
common.Config = common.DefaultOpConfig()
114-
configMap = &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: OperatorName, Namespace: ns}}
115-
configMap.Data = common.Config
112+
oputils.CreateConfigMap(OperatorName)
116113
} else {
117114
common.Config.LoadFromConfigMap(configMap)
118115
}
119116

120-
_, err = controllerutil.CreateOrUpdate(context.TODO(), r.GetClient(), configMap, func() error {
121-
configMap.Data = common.Config
122-
return nil
123-
})
124-
125-
if err != nil {
126-
reqLogger.Info("Failed to create or update websphere-liberty-operator config map, error: " + err.Error())
127-
}
128-
129117
// Fetch the WebSphereLiberty instance
130118
instance := &webspherelibertyv1.WebSphereLibertyApplication{}
131119
var ba common.BaseComponent = instance
@@ -333,6 +321,7 @@ func (r *ReconcileWebSphereLiberty) Reconcile(ctx context.Context, request ctrl.
333321
}
334322
}
335323
if isKnativeSupported {
324+
reqLogger.Info("Knative is supported and Knative Service is enabled")
336325
ksvc := &servingv1.Service{ObjectMeta: defaultMeta}
337326
err = r.CreateOrUpdate(ksvc, instance, func() error {
338327
oputils.CustomizeKnativeService(ksvc, instance)
@@ -345,6 +334,7 @@ func (r *ReconcileWebSphereLiberty) Reconcile(ctx context.Context, request ctrl.
345334
}
346335

347336
instance.Status.Versions.Reconciled = lutils.OperandVersion
337+
reqLogger.Info("Reconcile WebSphereLibertyApplication - completed")
348338
return r.ManageSuccess(common.StatusConditionTypeReconciled, instance)
349339
}
350340
return r.ManageError(errors.New("failed to reconcile Knative service as operator could not find Knative CRDs"), common.StatusConditionTypeReconciled, instance)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/WASdev/websphere-liberty-operator
33
go 1.19
44

55
require (
6-
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20230413024947-1dca2a9877ad
6+
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20230421190839-08dca6236514
77
github.com/go-logr/logr v1.2.2
88
github.com/openshift/api v0.0.0-20220414050251-a83e6f8f1d50 // Openshift 4.9
99
github.com/openshift/library-go v0.0.0-20220630204433-c71d40c7de49

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
7272
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
7373
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
7474
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210826220005-b48c857c3a0e/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
75-
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20230413024947-1dca2a9877ad h1:LinEeZaTfyp80giRLqapwltcgCfFn6toj42Cl9NWe6I=
76-
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20230413024947-1dca2a9877ad/go.mod h1:JsX0ioxZzA0yM1Sxg/1QKLg9dGqDXYvGZ+WwiQrMoxQ=
75+
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20230421190839-08dca6236514 h1:ZSKbBVQH7C4PwfWzgG1s5m5tZA7N7MCR6ycyxoKfV+Q=
76+
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20230421190839-08dca6236514/go.mod h1:JsX0ioxZzA0yM1Sxg/1QKLg9dGqDXYvGZ+WwiQrMoxQ=
7777
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
7878
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
7979
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=

0 commit comments

Comments
 (0)