@@ -140,6 +140,21 @@ func (r *ReconcileWebSphereLiberty) Reconcile(ctx context.Context, request ctrl.
140140 // Error reading the object - requeue the request.
141141 return reconcile.Result {}, err
142142 }
143+
144+ isKnativeSupported , err := r .IsGroupVersionSupported (servingv1 .SchemeGroupVersion .String (), "Service" )
145+ if err != nil {
146+ r .ManageError (err , common .StatusConditionTypeReconciled , instance )
147+ } else if ! isKnativeSupported && instance .Spec .CreateKnativeService != nil && * instance .Spec .CreateKnativeService {
148+ reqLogger .V (1 ).Info (fmt .Sprintf ("%s is not supported on the cluster" , servingv1 .SchemeGroupVersion .String ()))
149+ }
150+
151+ // Check if there is an existing Deployment, Statefulset or Knative service by this name
152+ // not managed by this operator
153+ err = oputils .CheckForNameConflicts ("WebSphereLibertyApplication" , instance .Name , instance .Namespace , r .GetClient (), request , isKnativeSupported )
154+ if err != nil {
155+ return r .ManageError (err , common .StatusConditionTypeReconciled , instance )
156+ }
157+
143158 // Check if the WebSphereLibertyApplication instance is marked to be deleted, which is
144159 // indicated by the deletion timestamp being set.
145160 isInstanceMarkedToBeDeleted := instance .GetDeletionTimestamp () != nil
@@ -289,13 +304,6 @@ func (r *ReconcileWebSphereLiberty) Reconcile(ctx context.Context, request ctrl.
289304 }
290305 }
291306
292- isKnativeSupported , err := r .IsGroupVersionSupported (servingv1 .SchemeGroupVersion .String (), "Service" )
293- if err != nil {
294- r .ManageError (err , common .StatusConditionTypeReconciled , instance )
295- } else if ! isKnativeSupported && instance .Spec .CreateKnativeService != nil && * instance .Spec .CreateKnativeService {
296- reqLogger .V (1 ).Info (fmt .Sprintf ("%s is not supported on the cluster" , servingv1 .SchemeGroupVersion .String ()))
297- }
298-
299307 if instance .Spec .CreateKnativeService != nil && * instance .Spec .CreateKnativeService {
300308 // Clean up non-Knative resources
301309 resources := []client.Object {
0 commit comments