This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit f21b9af9ef1194d0a0d9f05e3ef167d9471507e4
Author: John Poth <poth.j...@gmail.com>
AuthorDate: Mon Sep 27 14:14:42 2021 +0200

    Fix #2553 Update kustomize test to reflect changes
---
 e2e/common/kustomize/common.go | 12 ++++++------
 pkg/install/cluster.go         | 10 ++++++++++
 pkg/install/operator.go        | 15 +--------------
 3 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/e2e/common/kustomize/common.go b/e2e/common/kustomize/common.go
index 155747b..c5c483e 100644
--- a/e2e/common/kustomize/common.go
+++ b/e2e/common/kustomize/common.go
@@ -38,14 +38,14 @@ const (
        // v1alpha1.Kamelet,  v1alpha1.KameletBinding
        ExpCrds = 6
 
-       // camel-k-operator,                                             
camel-k-operator-events,
-       // camel-k-operator-knative,             camel-k-operator-leases,
-       // camel-k-operator-podmonitors, camel-k-operator-service-binding
-       // camel-k-operator-strimzi
-       ExpKubePromoteRoles = 7
+       // camel-k-operator,                     camel-k-operator-events,
+       // camel-k-operator-knative,     camel-k-operator-leases,
+       // camel-k-operator-podmonitors, camel-k-operator-strimzi
+       ExpKubePromoteRoles = 6
 
        // camel-k-edit
-       ExpKubeClusterRoles = 1
+       // camel-k-operator-custom-resource-definitions
+       ExpKubeClusterRoles = 2
 
        // camel-k-operator-openshift
        ExpOSPromoteRoles = 1
diff --git a/pkg/install/cluster.go b/pkg/install/cluster.go
index b0893d9..f0e04ff 100644
--- a/pkg/install/cluster.go
+++ b/pkg/install/cluster.go
@@ -163,6 +163,16 @@ func SetupClusterWideResourcesOrCollect(ctx 
context.Context, clientProvider clie
                }
        }
 
+       ok, err = isClusterRoleInstalled(ctx, c, 
"camel-k-operator-custom-resource-definitions")
+       if err != nil {
+               return err
+       }
+       if !ok {
+               if err := installResource(ctx, c, collection, 
"/rbac/operator-cluster-role-custom-resource-definitions.yaml"); err != nil {
+                       return err
+               }
+       }
+
        isOpenShift, err := isOpenShift(c, clusterType)
        if err != nil {
                return err
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index 778a7ee..c13e6c2 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -261,7 +261,7 @@ func OperatorOrCollect(ctx context.Context, c 
client.Client, cfg OperatorConfigu
                fmt.Println("Warning: the operator will not be able to create 
Leases. Try installing as cluster-admin to allow management of Lease 
resources.")
        }
 
-       if errmtr := installCustomResourceDefinitions(ctx, c, cfg.Namespace, 
customizer, collection, force); errmtr != nil {
+       if errmtr := installClusterRoleBinding(ctx, c, collection, 
cfg.Namespace, "camel-k-operator-custom-resource-definitions", 
"/rbac/operator-cluster-role-binding-custom-resource-definitions.yaml"); errmtr 
!= nil {
                fmt.Println("Warning: the operator will not be able to get 
CustomResourceDefinitions resources and the service-binding trait will fail if 
used. Try installing the operator as cluster-admin.")
        }
 
@@ -403,19 +403,6 @@ func installLeaseBindings(ctx context.Context, c 
client.Client, namespace string
        )
 }
 
-func installCustomResourceDefinitions(ctx context.Context, c client.Client, 
namespace string, customizer ResourceCustomizer, collection 
*kubernetes.Collection, force bool) error {
-       ok, err := isClusterRoleInstalled(ctx, c, 
"camel-k-operator-custom-resource-definitions")
-       if err != nil {
-               return err
-       }
-       if !ok {
-               if err := installResource(ctx, c, collection, 
"/rbac/operator-cluster-role-custom-resource-definitions.yaml"); err != nil {
-                       return err
-               }
-       }
-       return installClusterRoleBinding(ctx, c, collection, namespace, 
"camel-k-operator-custom-resource-definitions", 
"/rbac/operator-cluster-role-binding-custom-resource-definitions.yaml")
-}
-
 // PlatformOrCollect --
 // nolint: lll
 func PlatformOrCollect(ctx context.Context, c client.Client, clusterType 
string, namespace string, skipRegistrySetup bool, registry 
v1.IntegrationPlatformRegistrySpec, collection *kubernetes.Collection) 
(*v1.IntegrationPlatform, error) {

Reply via email to