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 1b95c5a2b19c8566860fff0b2b736a0b8b8470a3 Author: Antonin Stefanutti <[email protected]> AuthorDate: Thu Jun 11 17:55:32 2020 +0200 chore: Simply type integration Flows as string --- deploy/crd-integration.yaml | 2 +- e2e/knative/knative_platform_test.go | 2 +- pkg/apis/camel/v1/common_types.go | 4 +--- pkg/apis/camel/v1/zz_generated.deepcopy.go | 28 +--------------------------- pkg/cmd/run.go | 3 +-- pkg/util/digest/digest.go | 2 +- 6 files changed, 6 insertions(+), 35 deletions(-) diff --git a/deploy/crd-integration.yaml b/deploy/crd-integration.yaml index 208204b..30d8dce 100644 --- a/deploy/crd-integration.yaml +++ b/deploy/crd-integration.yaml @@ -84,9 +84,9 @@ spec: type: array flows: items: - $ref: '#/definitions/encoding~1json~0RawMessage' description: Flow is an unstructured object representing a Camel Flow in YAML/JSON DSL + type: string type: array kit: type: string diff --git a/e2e/knative/knative_platform_test.go b/e2e/knative/knative_platform_test.go index da40c46..f3aa846 100644 --- a/e2e/knative/knative_platform_test.go +++ b/e2e/knative/knative_platform_test.go @@ -55,7 +55,7 @@ func TestKnativePlatformTest(t *testing.T) { it.Spec.Profile = "" var flows []v1.Flow for _, flow := range it.Spec.Flows { - flows = append(flows, []byte(strings.ReplaceAll(string(flow), "string!", "string!!!"))) + flows = append(flows, v1.Flow(strings.ReplaceAll(string(flow), "string!", "string!!!"))) } it.Spec.Flows = flows })).To(BeNil()) diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go index 83ecb90..b523ffe 100644 --- a/pkg/apis/camel/v1/common_types.go +++ b/pkg/apis/camel/v1/common_types.go @@ -18,8 +18,6 @@ limitations under the License. package v1 import ( - "encoding/json" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -134,4 +132,4 @@ type ResourceCondition interface { } // Flow is an unstructured object representing a Camel Flow in YAML/JSON DSL -type Flow json.RawMessage +type Flow string diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go index 4daba34..87f7ff9 100644 --- a/pkg/apis/camel/v1/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go @@ -615,26 +615,6 @@ func (in *FailureRecovery) DeepCopy() *FailureRecovery { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Flow) DeepCopyInto(out *Flow) { - { - in := &in - *out = make(Flow, len(*in)) - copy(*out, *in) - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Flow. -func (in Flow) DeepCopy() Flow { - if in == nil { - return nil - } - out := new(Flow) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ImageTask) DeepCopyInto(out *ImageTask) { *out = *in in.ContainerTask.DeepCopyInto(&out.ContainerTask) @@ -1103,13 +1083,7 @@ func (in *IntegrationSpec) DeepCopyInto(out *IntegrationSpec) { if in.Flows != nil { in, out := &in.Flows, &out.Flows *out = make([]Flow, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = make(Flow, len(*in)) - copy(*out, *in) - } - } + copy(*out, *in) } if in.Resources != nil { in, out := &in.Resources, &out.Resources diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index e18494d..fce05e7 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -471,8 +471,7 @@ func (o *runCmdOptions) updateIntegrationCode(c client.Client, sources []string) } if o.UseFlows && (strings.HasSuffix(source, ".yaml") || strings.HasSuffix(source, ".yml")) { - flows := []byte(data) - integration.Spec.AddFlows(flows) + integration.Spec.AddFlows(v1.Flow(data)) } else { integration.Spec.AddSources(v1.SourceSpec{ DataSpec: v1.DataSpec{ diff --git a/pkg/util/digest/digest.go b/pkg/util/digest/digest.go index c6dec3c..bc4ff63 100644 --- a/pkg/util/digest/digest.go +++ b/pkg/util/digest/digest.go @@ -68,7 +68,7 @@ func ComputeForIntegration(integration *v1.Integration) (string, error) { // Integration flows for _, flow := range integration.Spec.Flows { - if _, err := hash.Write(flow); err != nil { + if _, err := hash.Write([]byte(flow)); err != nil { return "", err } }
