You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/03/05 14:28:28 UTC

[camel-k] 01/02: chore: Upgrade ServiceBindingOperator to v0.5.0 #2077

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

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

commit aeb0857b0dbcbfc3a8c467ec6555655066eebf30
Author: John Poth <po...@gmail.com>
AuthorDate: Thu Mar 4 13:25:08 2021 +0100

    chore: Upgrade ServiceBindingOperator to v0.5.0 #2077
---
 go.mod                       |  2 +-
 go.sum                       |  4 ++--
 pkg/trait/service_binding.go | 25 +++++++++++++------------
 pkg/trait/trait_types.go     |  8 ++++----
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/go.mod b/go.mod
index 69f7bea..8093a11 100644
--- a/go.mod
+++ b/go.mod
@@ -28,7 +28,7 @@ require (
 	github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.42.1
 	github.com/prometheus/client_golang v1.7.1
 	github.com/radovskyb/watcher v1.0.6
-	github.com/redhat-developer/service-binding-operator v0.4.1-0.20210217004726-4f7892420a13
+	github.com/redhat-developer/service-binding-operator v0.5.0
 	github.com/rs/xid v1.2.1
 	github.com/scylladb/go-set v1.0.2
 	github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
diff --git a/go.sum b/go.sum
index 899c3e1..8e45b27 100644
--- a/go.sum
+++ b/go.sum
@@ -1047,8 +1047,8 @@ github.com/radovskyb/watcher v1.0.6 h1:8WIQ9UxEYMZjem1OwU7dVH94DXXk9mAIE1i8eqHD+
 github.com/radovskyb/watcher v1.0.6/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
 github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
-github.com/redhat-developer/service-binding-operator v0.4.1-0.20210217004726-4f7892420a13 h1:tRpj5V6u+D8hK0GieODXZkpfzziH3wgtfnhxIX3iGLc=
-github.com/redhat-developer/service-binding-operator v0.4.1-0.20210217004726-4f7892420a13/go.mod h1:pnMK07Z13eYWFrta6rIcrGjWg1ESEQZLfpu6wcXMfY8=
+github.com/redhat-developer/service-binding-operator v0.5.0 h1:qai/SDUEOnsLlHEa0seFJ1sT7dRemFc/1Y3Q7MeYng8=
+github.com/redhat-developer/service-binding-operator v0.5.0/go.mod h1:pnMK07Z13eYWFrta6rIcrGjWg1ESEQZLfpu6wcXMfY8=
 github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
 github.com/rickb777/date v1.13.0 h1:+8AmwLuY1d/rldzdqvqTEg7107bZ8clW37x4nsdG3Hs=
 github.com/rickb777/date v1.13.0/go.mod h1:GZf3LoGnxPWjX+/1TXOuzHefZFDovTyNLHDMd3qH70k=
diff --git a/pkg/trait/service_binding.go b/pkg/trait/service_binding.go
index 0e1fbc1..a78143e 100644
--- a/pkg/trait/service_binding.go
+++ b/pkg/trait/service_binding.go
@@ -195,15 +195,15 @@ func (t *serviceBindingTrait) parseProvisionedServices(e *Environment) ([]sb.Ser
 			namespace = seg[2]
 		}
 		service := sb.Service{
-			GroupVersionKind: metav1.GroupVersionKind{
-				Group:   group,
-				Version: version,
-				Kind:    kind,
+			NamespacedRef: sb.NamespacedRef{
+				Ref: sb.Ref{
+					Group:   group,
+					Version: version,
+					Kind:    kind,
+					Name:    name,
+				},
+				Namespace: &namespace,
 			},
-			LocalObjectReference: corev1.LocalObjectReference{
-				Name: name,
-			},
-			Namespace: &namespace,
 		}
 		services = append(services, service)
 	}
@@ -222,8 +222,8 @@ func (t *serviceBindingTrait) parseServiceBindings(e *Environment) ([]string, er
 		kind := seg[0][0:index]
 		if kind == "ServiceBinding" {
 			vg := seg[0][index+1 : len(gvk)]
-			if vg != "v1alpha1.operators.coreos.com" {
-				return nil, fmt.Errorf("ServiceBinding: %s VERSION.GROUP should be v1alpha1.operators.coreos.com", s)
+			if vg != "v1alpha1.binding.operators.coreos.com" {
+				return nil, fmt.Errorf("ServiceBinding: %s VERSION.GROUP should be v1alpha1.binding.operators.coreos.com", s)
 			}
 			if len(seg) == 3 && seg[2] != e.Integration.Namespace {
 				return nil, fmt.Errorf("ServiceBinding: %s should be in the same namespace %s as the integration", s, e.Integration.Namespace)
@@ -236,7 +236,8 @@ func (t *serviceBindingTrait) parseServiceBindings(e *Environment) ([]string, er
 
 func createServiceBinding(e *Environment, services []sb.Service, name string) sb.ServiceBinding {
 	spec := sb.ServiceBindingSpec{
-		Services: services,
+		NamingStrategy: "none",
+		Services:       services,
 	}
 	labels := map[string]string{
 		v1.IntegrationLabel: e.Integration.Name,
@@ -244,7 +245,7 @@ func createServiceBinding(e *Environment, services []sb.Service, name string) sb
 	serviceBinding := sb.ServiceBinding{
 		TypeMeta: metav1.TypeMeta{
 			Kind:       "ServiceBinding",
-			APIVersion: "operators.coreos.com/v1alpha1",
+			APIVersion: "binding.operators.coreos.com/v1alpha1",
 		},
 		ObjectMeta: metav1.ObjectMeta{
 			Namespace: e.Integration.Namespace,
diff --git a/pkg/trait/trait_types.go b/pkg/trait/trait_types.go
index 89c205f..a34c718 100644
--- a/pkg/trait/trait_types.go
+++ b/pkg/trait/trait_types.go
@@ -713,21 +713,21 @@ func (e *Environment) configureVolumesAndMounts(vols *[]corev1.Volume, mnts *[]c
 	// Volumes :: Additional Secrets
 	//
 	// append Service Binding secrets
-	for _, name := range e.ServiceBindings {
-		refName := kubernetes.SanitizeLabel(name)
+	for sb, secret := range e.ServiceBindings {
+		refName := kubernetes.SanitizeLabel(sb)
 
 		*vols = append(*vols, corev1.Volume{
 			Name: refName,
 			VolumeSource: corev1.VolumeSource{
 				Secret: &corev1.SecretVolumeSource{
-					SecretName: name,
+					SecretName: secret,
 				},
 			},
 		})
 
 		*mnts = append(*mnts, corev1.VolumeMount{
 			Name:      refName,
-			MountPath: path.Join(serviceBindingsMountPath, strings.ToLower(name)),
+			MountPath: path.Join(serviceBindingsMountPath, strings.ToLower(sb)),
 		})
 	}
 	for _, secretName := range e.collectConfigurationValues("secret") {