You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/04/26 08:51:22 UTC

[camel-k] 06/18: chore: lint complains

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

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

commit 981fcd13597c5106d214eaf605e706a90976db28
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Tue Mar 28 17:30:25 2023 +0200

    chore: lint complains
---
 addons/keda/keda.go                |  7 +++----
 addons/keda/keda_test.go           | 23 +++++++++++------------
 pkg/resources/resources.go         |  4 ++--
 pkg/util/bindings/bindings_test.go | 11 +++++------
 4 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/addons/keda/keda.go b/addons/keda/keda.go
index 4e4ca5b17..7c9e3158d 100644
--- a/addons/keda/keda.go
+++ b/addons/keda/keda.go
@@ -27,7 +27,6 @@ import (
 
 	kedav1alpha1 "github.com/apache/camel-k/v2/addons/keda/duck/v1alpha1"
 	camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-	camelv1alpha1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 	"github.com/apache/camel-k/v2/pkg/kamelet/repository"
 	"github.com/apache/camel-k/v2/pkg/metadata"
@@ -281,7 +280,7 @@ func (t *kedaTrait) hackControllerReplicas(e *trait.Environment) error {
 	}
 	if ctrlRef.Kind == camelv1.BindingKind {
 		scale.ObjectMeta.Name = ctrlRef.Name
-		_, err = scalesClient.Scales(e.Integration.Namespace).Update(e.Ctx, camelv1alpha1.SchemeGroupVersion.WithResource("bindings").GroupResource(), &scale, metav1.UpdateOptions{})
+		_, err = scalesClient.Scales(e.Integration.Namespace).Update(e.Ctx, camelv1.SchemeGroupVersion.WithResource("bindings").GroupResource(), &scale, metav1.UpdateOptions{})
 		if err != nil {
 			return err
 		}
@@ -297,7 +296,7 @@ func (t *kedaTrait) hackControllerReplicas(e *trait.Environment) error {
 
 func (t *kedaTrait) getTopControllerReference(e *trait.Environment) *v1.ObjectReference {
 	for _, o := range e.Integration.OwnerReferences {
-		if o.Kind == camelv1.BindingKind && strings.HasPrefix(o.APIVersion, camelv1alpha1.SchemeGroupVersion.Group) {
+		if o.Kind == camelv1.BindingKind && strings.HasPrefix(o.APIVersion, camelv1.SchemeGroupVersion.Group) {
 			return &v1.ObjectReference{
 				APIVersion: o.APIVersion,
 				Kind:       o.Kind,
@@ -320,7 +319,7 @@ func (t *kedaTrait) populateTriggersFromKamelets(e *trait.Environment) error {
 	kameletURIs := make(map[string][]string)
 	if err := metadata.Each(e.CamelCatalog, sources, func(_ int, meta metadata.IntegrationMetadata) bool {
 		for _, kameletURI := range meta.FromURIs {
-			if kameletStr := source.ExtractKamelet(kameletURI); kameletStr != "" && camelv1alpha1.ValidKameletName(kameletStr) {
+			if kameletStr := source.ExtractKamelet(kameletURI); kameletStr != "" && camelv1.ValidKameletName(kameletStr) {
 				kamelet := kameletStr
 				if strings.Contains(kamelet, "/") {
 					kamelet = kamelet[0:strings.Index(kamelet, "/")]
diff --git a/addons/keda/keda_test.go b/addons/keda/keda_test.go
index 420f72d05..015cb0d88 100644
--- a/addons/keda/keda_test.go
+++ b/addons/keda/keda_test.go
@@ -24,7 +24,6 @@ import (
 
 	"github.com/apache/camel-k/v2/addons/keda/duck/v1alpha1"
 	camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-	camelv1alpha1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/v2/pkg/controller/binding"
 	"github.com/apache/camel-k/v2/pkg/trait"
 	"github.com/apache/camel-k/v2/pkg/util/camel"
@@ -126,8 +125,8 @@ func TestKameletAutoDetection(t *testing.T) {
 				},
 			},
 			Spec: camelv1.KameletSpec{
-				Definition: &camelv1alpha1.JSONSchemaProps{
-					Properties: map[string]camelv1alpha1.JSONSchemaProp{
+				Definition: &camelv1.JSONSchemaProps{
+					Properties: map[string]camelv1.JSONSchemaProp{
 						"a": {
 							XDescriptors: []string{
 								"urn:keda:metadata:a",
@@ -213,10 +212,10 @@ func TestBindingAutoDetection(t *testing.T) {
 			Name:      "my-binding",
 		},
 		Spec: camelv1.BindingSpec{
-			Source: camelv1alpha1.Endpoint{
+			Source: camelv1.Endpoint{
 				Ref: &corev1.ObjectReference{
 					Kind:       "Kamelet",
-					APIVersion: camelv1alpha1.SchemeGroupVersion.String(),
+					APIVersion: camelv1.SchemeGroupVersion.String(),
 					Name:       "my-kamelet",
 				},
 				Properties: asEndpointProperties(map[string]string{
@@ -225,7 +224,7 @@ func TestBindingAutoDetection(t *testing.T) {
 					"c": "v3",
 				}),
 			},
-			Sink: camelv1alpha1.Endpoint{
+			Sink: camelv1.Endpoint{
 				URI: &logEndpoint,
 			},
 		},
@@ -241,8 +240,8 @@ func TestBindingAutoDetection(t *testing.T) {
 				},
 			},
 			Spec: camelv1.KameletSpec{
-				Definition: &camelv1alpha1.JSONSchemaProps{
-					Properties: map[string]camelv1alpha1.JSONSchemaProp{
+				Definition: &camelv1.JSONSchemaProps{
+					Properties: map[string]camelv1.JSONSchemaProp{
 						"a": {
 							XDescriptors: []string{
 								"urn:keda:metadata:a",
@@ -374,7 +373,7 @@ func TestHackKLBReplicas(t *testing.T) {
 				Name:      "my-it",
 				OwnerReferences: []metav1.OwnerReference{
 					{
-						APIVersion: camelv1alpha1.SchemeGroupVersion.String(),
+						APIVersion: camelv1.SchemeGroupVersion.String(),
 						Kind:       "Binding",
 						Name:       "my-klb",
 					},
@@ -392,7 +391,7 @@ func TestHackKLBReplicas(t *testing.T) {
 	assert.NoError(t, keda.Apply(env))
 	scalesClient, err := env.Client.ScalesClient()
 	assert.NoError(t, err)
-	sc, err := scalesClient.Scales("test").Get(env.Ctx, camelv1alpha1.SchemeGroupVersion.WithResource("bindings").GroupResource(), "my-klb", metav1.GetOptions{})
+	sc, err := scalesClient.Scales("test").Get(env.Ctx, camelv1.SchemeGroupVersion.WithResource("bindings").GroupResource(), "my-klb", metav1.GetOptions{})
 	assert.NoError(t, err)
 	assert.Equal(t, int32(1), sc.Spec.Replicas)
 }
@@ -493,12 +492,12 @@ func createBasicTestEnvironment(resources ...runtime.Object) *trait.Environment
 	}
 }
 
-func asEndpointProperties(props map[string]string) *camelv1alpha1.EndpointProperties {
+func asEndpointProperties(props map[string]string) *camelv1.EndpointProperties {
 	serialized, err := json.Marshal(props)
 	if err != nil {
 		panic(err)
 	}
-	return &camelv1alpha1.EndpointProperties{
+	return &camelv1.EndpointProperties{
 		RawMessage: serialized,
 	}
 }
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 75e697c62..701371ab0 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -159,9 +159,9 @@ var assets = func() http.FileSystem {
 		"/crd/bases/camel.apache.org_kameletbindings.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_kameletbindings.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 571661,
+			uncompressedSize: 572531,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x6b\x73\x23\xb7\xb5\x28\xfa\x3d\xbf\x02\x35\x71\x1d\x49\xdb\x22\x35\xe3\x24\xae\x9d\xa9\xd4\x71\x29\x1a\xd9\xd6\xf5\x8c\x86\x35\x92\x9d\xe3\x1a\x7b\xdb\x60\x37\x48\xe2\xa8\x09\x74\x00\x34\x25\xfa\xfa\xfe\xf7\x5b\x58\x00\xba\xd1\x7c\x09\xab\x29\x29\x9a\xa4\x91\x2a\x67\x48\xb1\x57\xe3\xb5\xde\xaf\x3f\x0c\x06\x83\x3f\xd0\x92\xff\xc0\x94\xe6\x52\xbc\x26\xb4\xe4\xec\xce\x30\x61\x3f\xe9\xe1\xcd\x7f\xeb\x21\x97\x27\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x [...]
 		},
 		"/crd/bases/camel.apache.org_kamelets.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_kamelets.yaml",
diff --git a/pkg/util/bindings/bindings_test.go b/pkg/util/bindings/bindings_test.go
index cbf2e9b74..49c9ee63c 100644
--- a/pkg/util/bindings/bindings_test.go
+++ b/pkg/util/bindings/bindings_test.go
@@ -25,7 +25,6 @@ import (
 	corev1 "k8s.io/api/core/v1"
 	"k8s.io/utils/pointer"
 
-	camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 
@@ -38,9 +37,9 @@ func TestBindings(t *testing.T) {
 	testcases := []struct {
 		endpointType v1.EndpointType
 		endpoint     v1.Endpoint
-		profile      camelv1.TraitProfile
+		profile      v1.TraitProfile
 		uri          string
-		traits       camelv1.Traits
+		traits       v1.Traits
 		props        map[string]string
 	}{
 		{
@@ -183,7 +182,7 @@ func TestBindings(t *testing.T) {
 				}),
 			},
 			uri: "knative:endpoint/sink?ce.override.ce-type=mytype",
-			traits: camelv1.Traits{
+			traits: v1.Traits{
 				Knative: &traitv1.KnativeTrait{
 					SinkBinding:   pointer.Bool(false),
 					Configuration: asKnativeConfig("https://myurl/hey"),
@@ -195,7 +194,7 @@ func TestBindings(t *testing.T) {
 			endpoint: v1.Endpoint{
 				URI: pointer.String("https://myurl/hey"),
 			},
-			profile: camelv1.TraitProfileKubernetes,
+			profile: v1.TraitProfileKubernetes,
 			uri:     "https://myurl/hey",
 		},
 		{
@@ -217,7 +216,7 @@ func TestBindings(t *testing.T) {
 
 			profile := tc.profile
 			if profile == "" {
-				profile = camelv1.TraitProfileKnative
+				profile = v1.TraitProfileKnative
 			}
 
 			bindingContext := BindingContext{