You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2021/02/09 12:32:04 UTC
[camel-k] 03/06: fix: install ServiceBinding roles for OLM,
HELM and kamel install
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit dd71e005229263ad7c04c3c6cb72165ccec4072d
Author: John Poth <po...@gmail.com>
AuthorDate: Thu Jan 28 11:24:45 2021 +0100
fix: install ServiceBinding roles for OLM, HELM and kamel install
---
config/rbac/operator-role-olm.yaml | 13 +++++++++++++
helm/camel-k/templates/operator-role.yaml | 26 ++++++++++++++++++++++++++
pkg/install/operator.go | 14 ++++++++++++++
3 files changed, 53 insertions(+)
diff --git a/config/rbac/operator-role-olm.yaml b/config/rbac/operator-role-olm.yaml
index 3194335..3769044 100644
--- a/config/rbac/operator-role-olm.yaml
+++ b/config/rbac/operator-role-olm.yaml
@@ -243,3 +243,16 @@ rules:
- get
- list
- watch
+- apiGroups:
+ - "operators.coreos.com"
+ resources:
+ - servicebindings
+ verbs:
+ - create
+ - delete
+ - deletecollection
+ - get
+ - list
+ - patch
+ - update
+ - watch
\ No newline at end of file
diff --git a/helm/camel-k/templates/operator-role.yaml b/helm/camel-k/templates/operator-role.yaml
index 3af4a3f..3c8158e 100644
--- a/helm/camel-k/templates/operator-role.yaml
+++ b/helm/camel-k/templates/operator-role.yaml
@@ -258,3 +258,29 @@ rules:
- patch
- update
- watch
+- apiGroups:
+ - "operators.coreos.com"
+ resources:
+ - servicebindings
+ verbs:
+ - create
+ - delete
+ - deletecollection
+ - get
+ - list
+ - patch
+ - update
+ - watch
+- apiGroups:
+ - "operators.coreos.com"
+ resources:
+ - servicebindings
+ verbs:
+ - create
+ - delete
+ - deletecollection
+ - get
+ - list
+ - patch
+ - update
+ - watch
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index d4e503d..0d73f66 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -197,6 +197,13 @@ func OperatorOrCollect(ctx context.Context, c client.Client, cfg OperatorConfigu
fmt.Println("Warning: the operator will not be able to perform locking using Camel \"master\" component. Try installing as cluster-admin to allow management of lease resources.")
}
+ if errmtr := installServiceBindings(ctx, c, cfg.Namespace, customizer, collection, force); errmtr != nil {
+ if k8serrors.IsAlreadyExists(errmtr) {
+ return errmtr
+ }
+ fmt.Println("Warning: the operator will not be able to lookup ServiceBinding resources. Try installing as cluster-admin to allow the lookup of ServiceBinding resources.")
+ }
+
if cfg.Monitoring.Enabled {
if err := installMonitoringResources(ctx, c, cfg.Namespace, customizer, collection, force); err != nil {
if k8serrors.IsForbidden(err) {
@@ -272,6 +279,13 @@ func installLeaseBindings(ctx context.Context, c client.Client, namespace string
)
}
+func installServiceBindings(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection, force bool) error {
+ return ResourcesOrCollect(ctx, c, namespace, collection, force, customizer,
+ "operator-role-service-binding.yaml",
+ "operator-role-binding-service-binding.yaml",
+ )
+}
+
// PlatformOrCollect --
// nolint: lll
func PlatformOrCollect(ctx context.Context, c client.Client, clusterType string, namespace string, registry v1.IntegrationPlatformRegistrySpec, collection *kubernetes.Collection) (*v1.IntegrationPlatform, error) {