You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/12/19 09:50:06 UTC

[camel-k] 07/10: Fix #921: update OLM and add v1alpha1 compat test

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

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

commit 8006e557b4311940a3f1566809d997e2e4a72c27
Author: Nicola Ferraro <ni...@gmail.com>
AuthorDate: Wed Dec 18 20:30:19 2019 +0100

    Fix #921: update OLM and add v1alpha1 compat test
---
 .../camel-k/1.0.0-rc1-snapshot/crd-build.yaml      | 12 ++++++-
 .../1.0.0-rc1-snapshot/crd-camel-catalog.yaml      | 16 +++++++--
 .../1.0.0-rc1-snapshot/crd-integration-kit.yaml    |  8 ++++-
 .../crd-integration-platform.yaml                  |  8 ++++-
 .../1.0.0-rc1-snapshot/crd-integration.yaml        | 19 ++++++++--
 deploy/olm-catalog/camel-k/camel-k.package.yaml    | 23 ++----------
 e2e/backward_compat_test.go                        | 41 ++++++++++++++++++++++
 7 files changed, 98 insertions(+), 29 deletions(-)

diff --git a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-build.yaml b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-build.yaml
index 6cad421..29e3276 100644
--- a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-build.yaml
+++ b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-build.yaml
@@ -24,7 +24,13 @@ metadata:
 spec:
   group: camel.apache.org
   scope: Namespaced
-  version: v1alpha1
+  versions:
+  - name: v1alpha1
+    served: true
+    storage: false
+  - name: v1
+    served: true
+    storage: true
   names:
     kind: Build
     listKind: BuildList
@@ -39,6 +45,10 @@ spec:
       JSONPath: .status.phase
     - name: Age
       type: date
+      description: The time at which the build was created
+      JSONPath: .metadata.creationTimestamp
+    - name: Started
+      type: date
       description: The time at which the build was last (re-)started
       JSONPath: .status.startedAt
     - name: Duration
diff --git a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-camel-catalog.yaml b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-camel-catalog.yaml
index 858bd0f..8a67c6d 100644
--- a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-camel-catalog.yaml
+++ b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-camel-catalog.yaml
@@ -31,12 +31,22 @@ spec:
     shortNames:
       - cc
   scope: Namespaced
-  version: v1alpha1
+  versions:
+  - name: v1alpha1
+    served: true
+    storage: false
+  - name: v1
+    served: true
+    storage: true
   subresources:
     status: {}
   additionalPrinterColumns:
-    - name: Version
+    - name: Camel Version
       type: string
-      description: The Catalog version
+      description: The Camel version
       JSONPath: .spec.version
+    - name: Runtime Version
+      type: string
+      description: The Camel K Runtime version
+      JSONPath: .spec.runtimeVersion
 
diff --git a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-kit.yaml b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-kit.yaml
index 04f3e81..59a34da 100644
--- a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-kit.yaml
+++ b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-kit.yaml
@@ -24,7 +24,13 @@ metadata:
 spec:
   group: camel.apache.org
   scope: Namespaced
-  version: v1alpha1
+  versions:
+  - name: v1alpha1
+    served: true
+    storage: false
+  - name: v1
+    served: true
+    storage: true
   subresources:
     status: {}
   names:
diff --git a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-platform.yaml b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-platform.yaml
index 532ad86..7b581d0 100644
--- a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-platform.yaml
+++ b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration-platform.yaml
@@ -24,7 +24,13 @@ metadata:
 spec:
   group: camel.apache.org
   scope: Namespaced
-  version: v1alpha1
+  versions:
+  - name: v1alpha1
+    served: true
+    storage: false
+  - name: v1
+    served: true
+    storage: true
   subresources:
     status: {}
   names:
diff --git a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration.yaml b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration.yaml
index 0b0f905..9a63ac4 100644
--- a/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration.yaml
+++ b/deploy/olm-catalog/camel-k/1.0.0-rc1-snapshot/crd-integration.yaml
@@ -24,9 +24,18 @@ metadata:
 spec:
   group: camel.apache.org
   scope: Namespaced
-  version: v1alpha1
+  versions:
+  - name: v1alpha1
+    served: true
+    storage: false
+  - name: v1
+    served: true
+    storage: true
   subresources:
     status: {}
+    scale:
+      specReplicasPath: .spec.replicas
+      statusReplicasPath: .status.replicas
   names:
     kind: Integration
     listKind: IntegrationList
@@ -37,9 +46,13 @@ spec:
   additionalPrinterColumns:
     - name: Phase
       type: string
-      description: The Integration phase
+      description: The integration phase
       JSONPath: .status.phase
     - name: Kit
       type: string
-      description: The IntegrationKit to use
+      description: The integration kit
       JSONPath: .status.kit
+    - name: Replicas
+      type: integer
+      description: The number of pods
+      JSONPath: .status.replicas
diff --git a/deploy/olm-catalog/camel-k/camel-k.package.yaml b/deploy/olm-catalog/camel-k/camel-k.package.yaml
index 4a1671b..5802837 100644
--- a/deploy/olm-catalog/camel-k/camel-k.package.yaml
+++ b/deploy/olm-catalog/camel-k/camel-k.package.yaml
@@ -1,22 +1,5 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-packageName: camel-k
 channels:
-- name: alpha
-  currentCSV: camel-k-operator.v1.0.0-rc1-snapshot
+- currentCSV: camel-k-operator.v1.0.0-rc1-snapshot
+  name: alpha
 defaultChannel: alpha
+packageName: camel-k
diff --git a/e2e/backward_compat_test.go b/e2e/backward_compat_test.go
index dc38bec..2ca3c76 100644
--- a/e2e/backward_compat_test.go
+++ b/e2e/backward_compat_test.go
@@ -27,7 +27,10 @@ import (
 	"github.com/apache/camel-k/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/stretchr/testify/assert"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+	"k8s.io/apimachinery/pkg/runtime/schema"
+	"k8s.io/client-go/dynamic"
 	"sigs.k8s.io/controller-runtime/pkg/client"
 )
 
@@ -77,3 +80,41 @@ status:
 		assert.Equal(t, "hello.groovy", integration.Spec.Sources[0].Name)
 	})
 }
+
+func TestV1Alpha1Compatibility(t *testing.T) {
+	withNewTestNamespace(t, func(ns string) {
+
+		data := `
+apiVersion: camel.apache.org/v1alpha1
+kind: Integration
+metadata:
+  name: example
+  namespace: ` + ns + `
+spec:
+  sources:
+  - name: hello.groovy
+`
+
+		obj, err := kubernetes.LoadRawResourceFromYaml(data)
+		assert.Nil(t, err)
+		dynClient, err := dynamic.NewForConfig(testClient.GetConfig())
+		assert.Nil(t, err)
+
+		obj, err = dynClient.Resource(schema.GroupVersionResource{
+			Group: "camel.apache.org",
+			// Using old v1alpha1 version for testing
+			Version:  "v1alpha1",
+			Resource: "integrations",
+		}).Namespace(ns).Create(obj.(*unstructured.Unstructured), metav1.CreateOptions{})
+		assert.Nil(t, err)
+
+		integration := v1.NewIntegration(ns, "example")
+		key, err := client.ObjectKeyFromObject(&integration)
+		assert.Nil(t, err)
+
+		err = testClient.Get(testContext, key, &integration)
+		assert.Nil(t, err)
+		assert.Equal(t, 1, len(integration.Spec.Sources))
+		assert.Equal(t, "hello.groovy", integration.Spec.Sources[0].Name)
+	})
+}