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
The following commit(s) were added to refs/heads/master by this push:
new 427c12c Switch to java 11 by default and adapt to runtime 1.3.x #1327
427c12c is described below
commit 427c12c2080e156b9bc839a9964588ad0a22e257
Author: lburgazzoli <[email protected]>
AuthorDate: Wed Mar 25 18:11:40 2020 +0100
Switch to java 11 by default and adapt to runtime 1.3.x #1327
---
.github/workflows/build.yml | 4 +
.github/workflows/knative.yml | 6 +-
.github/workflows/kubernetes.yml | 6 +-
.github/workflows/openshift.disabled | 6 +-
build/Dockerfile | 2 +-
build/maven/pom-runtime.xml | 2 +-
...yaml => camel-catalog-1.3.0-SNAPSHOT-main.yaml} | 18 +-
...l => camel-catalog-1.3.0-SNAPSHOT-quarkus.yaml} | 14 +-
deploy/resources.go | 32 ++--
e2e/openapi_test.go | 12 +-
e2e/util/dump.go | 42 +++++
examples/RestDSL.java | 4 -
pkg/apis/camel/v1/common_types.go | 2 +
pkg/apis/camel/v1/knative/types.go | 6 +-
pkg/apis/camel/v1/knative/types_support.go | 14 +-
pkg/builder/runtime/quarkus.go | 3 +
pkg/metadata/metadata_dependencies_test.go | 10 +-
pkg/trait/container.go | 99 ++++------
pkg/trait/container_probes_test.go | 26 +--
pkg/trait/dependencies_test.go | 6 +-
pkg/trait/knative.go | 57 +++---
pkg/trait/knative_service.go | 8 +-
pkg/trait/knative_test.go | 209 ++++++++++++++++++++-
pkg/util/defaults/defaults.go | 4 +-
script/Makefile | 4 +-
25 files changed, 399 insertions(+), 197 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9f1ca15..8d0d100 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -33,6 +33,10 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
+ - name: Set up JDK 11
+ uses: joschi/setup-jdk@v1
+ with:
+ java-version: openjdk11
- name: Install Go
uses: actions/setup-go@v1
with:
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index 4f558b7..e8f9e89 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -40,10 +40,10 @@ jobs:
- name: Info
run: |
ls -lart
- - name: Set Up Java
- uses: actions/setup-java@v1
+ - name: Set up JDK 11
+ uses: joschi/setup-jdk@v1
with:
- java-version: 1.8
+ java-version: openjdk11
- name: Set Go
uses: actions/setup-go@v1
with:
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index ab5c36d..aa2d782 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -41,10 +41,10 @@ jobs:
- name: Info
run: |
ls -lart
- - name: Set Up Java
- uses: actions/setup-java@v1
+ - name: Set up JDK 11
+ uses: joschi/setup-jdk@v1
with:
- java-version: 1.8
+ java-version: openjdk11
- name: Set Go
uses: actions/setup-go@v1
with:
diff --git a/.github/workflows/openshift.disabled
b/.github/workflows/openshift.disabled
index 8d709eb..bde0e1b 100644
--- a/.github/workflows/openshift.disabled
+++ b/.github/workflows/openshift.disabled
@@ -36,10 +36,10 @@ jobs:
- name: Info
run: |
ls -lart
- - name: Set Up Java
- uses: actions/setup-java@v1
+ - name: Set up JDK 11
+ uses: joschi/setup-jdk@v1
with:
- java-version: 1.8
+ java-version: openjdk11
- name: Set Go
uses: actions/setup-go@v1
with:
diff --git a/build/Dockerfile b/build/Dockerfile
index b8b0a0b..76e022d 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM adoptopenjdk/openjdk8:slim
+FROM adoptopenjdk/openjdk11:slim
ARG MAVEN_VERSION="3.6.3"
ARG
SHA="c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0"
diff --git a/build/maven/pom-runtime.xml b/build/maven/pom-runtime.xml
index 748bcdb..891f31c 100644
--- a/build/maven/pom-runtime.xml
+++ b/build/maven/pom-runtime.xml
@@ -80,7 +80,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-inspector</artifactId>
+ <artifactId>camel-k-runtime-http</artifactId>
<version>${runtime.version}</version>
</dependency>
<dependency>
diff --git a/deploy/camel-catalog-1.2.1-main.yaml
b/deploy/camel-catalog-1.3.0-SNAPSHOT-main.yaml
similarity index 99%
rename from deploy/camel-catalog-1.2.1-main.yaml
rename to deploy/camel-catalog-1.3.0-SNAPSHOT-main.yaml
index fca16c6..582578b 100644
--- a/deploy/camel-catalog-1.2.1-main.yaml
+++ b/deploy/camel-catalog-1.3.0-SNAPSHOT-main.yaml
@@ -18,16 +18,16 @@
apiVersion: camel.apache.org/v1
kind: CamelCatalog
metadata:
- name: camel-catalog-1.2.1-main
+ name: camel-catalog-1.3.0-snapshot-main
labels:
app: camel-k
camel.apache.org/catalog.version: 3.1.0
camel.apache.org/catalog.loader.version: 3.1.0
- camel.apache.org/runtime.version: 1.2.1
+ camel.apache.org/runtime.version: 1.3.0-SNAPSHOT
camel.apache.org/runtime.provider: main
spec:
runtime:
- version: 1.2.1
+ version: 1.3.0-SNAPSHOT
provider: main
applicationClass: org.apache.camel.k.main.Application
metadata:
@@ -46,12 +46,16 @@ spec:
dependencies:
- groupId: org.apache.camel.k
artifactId: camel-k-runtime-health
+ platform-http:
+ dependencies:
+ - groupId: org.apache.camel.k
+ artifactId: camel-k-runtime-http
rest:
dependencies:
- groupId: org.apache.camel
artifactId: camel-rest
- - groupId: org.apache.camel
- artifactId: camel-undertow
+ - groupId: org.apache.camel.k
+ artifactId: camel-k-runtime-http
artifacts:
camel-zipfile:
groupId: org.apache.camel
@@ -3063,9 +3067,9 @@ spec:
camel-k-runtime-health:
groupId: org.apache.camel.k
artifactId: camel-k-runtime-health
- camel-k-runtime-inspector:
+ camel-k-runtime-http:
groupId: org.apache.camel.k
- artifactId: camel-k-runtime-inspector
+ artifactId: camel-k-runtime-http
camel-k-runtime-webhook:
groupId: org.apache.camel.k
artifactId: camel-k-runtime-webhook
diff --git a/deploy/camel-catalog-1.2.1-quarkus.yaml
b/deploy/camel-catalog-1.3.0-SNAPSHOT-quarkus.yaml
similarity index 98%
rename from deploy/camel-catalog-1.2.1-quarkus.yaml
rename to deploy/camel-catalog-1.3.0-SNAPSHOT-quarkus.yaml
index bd096c1..04bcea3 100644
--- a/deploy/camel-catalog-1.2.1-quarkus.yaml
+++ b/deploy/camel-catalog-1.3.0-SNAPSHOT-quarkus.yaml
@@ -18,16 +18,16 @@
apiVersion: camel.apache.org/v1
kind: CamelCatalog
metadata:
- name: camel-catalog-1.2.1-quarkus
+ name: camel-catalog-1.3.0-snapshot-quarkus
labels:
app: camel-k
camel.apache.org/catalog.version: 3.1.0
camel.apache.org/catalog.loader.version: 3.1.0
- camel.apache.org/runtime.version: 1.2.1
+ camel.apache.org/runtime.version: 1.3.0-SNAPSHOT
camel.apache.org/runtime.provider: quarkus
spec:
runtime:
- version: 1.2.1
+ version: 1.3.0-SNAPSHOT
provider: quarkus
applicationClass: io.quarkus.runner.GeneratedMain
metadata:
@@ -46,6 +46,10 @@ spec:
dependencies:
- groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-microprofile-health
+ platform-http:
+ dependencies:
+ - groupId: org.apache.camel.quarkus
+ artifactId: camel-quarkus-platform-http
rest:
dependencies:
- groupId: org.apache.camel.quarkus
@@ -903,9 +907,9 @@ spec:
camel-k-runtime-health:
groupId: org.apache.camel.k
artifactId: camel-k-runtime-health
- camel-k-runtime-inspector:
+ camel-k-runtime-http:
groupId: org.apache.camel.k
- artifactId: camel-k-runtime-inspector
+ artifactId: camel-k-runtime-http
camel-k-runtime-webhook:
groupId: org.apache.camel.k
artifactId: camel-k-runtime-webhook
diff --git a/deploy/resources.go b/deploy/resources.go
index 6196a63..c5e50d7 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -88,19 +88,19 @@ var assets = func() http.FileSystem {
compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x53\x3d\x6f\xdb\x30\x14\xdc\xf9\x2b\x0e\xd6\x92\x00\xfe\x68\x3b\xba\x93\x9a\xd8\xa8\xd0\xc0\x06\x22\xa7\x41\xc6\x67\xf1\x59\x7a\x08\x45\xaa\x24\x15\xc5\xff\xbe\xa0\x6c\x37\x09\xba\x86\x9b\xa0\xd3\x7d\xf0\x4e\x19\x66\x9f\x77\x54\x86\x3b\xa9\xd8\x06\xd6\x88\x0e\xb1\x61\xe4\x1d\x55\x0d\xa3\x74\x87\x38\x90\x67\xac\x5d\x6f\x35\x45\x71\x16\x57\x79\xb9\xbe\x46\x6f\x35\x7b\x38\xcb\x70\x1e\xad\xf3\xac\x32\x54\xce\x46\x2f\x
[...]
},
- "/camel-catalog-1.2.1-main.yaml": &vfsgen۰CompressedFileInfo{
- name: "camel-catalog-1.2.1-main.yaml",
+ "/camel-catalog-1.3.0-SNAPSHOT-main.yaml":
&vfsgen۰CompressedFileInfo{
+ name:
"camel-catalog-1.3.0-SNAPSHOT-main.yaml",
modTime: time.Time{},
- uncompressedSize: 87210,
+ uncompressedSize: 87359,
- compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x7d\x5b\x77\xdb\x38\xb2\xee\x7b\x7e\x05\xd7\xe4\x65\xef\x75\x46\x98\x6e\x67\x66\xfa\xec\x3e\x4f\xb6\x1c\x27\x76\x6c\xc7\x1d\x7a\x92\xcc\xbc\xf4\x82\x48\x48\x82\x45\x12\x34\x00\xc9\xb2\x7f\xfd\x59\xb8\xf0\x2a\x08\x12\x59\x86\xd7\xf6\x83\x49\x11\x55\x5f\xb1\x08\x12\x97\x42\xa1\xea\x7d\x34\x79\xbd\xbf\x77\xef\xa3\x6b\x9a\x90\x42\x90\x34\x92\x2c\x92\x4b\x12\x9d\x96\x38\x59\x92\x28\x66\x73\xf9\x84\x39\x89\x2e\xd8\xba\x
[...]
+ compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x7d\x5b\x77\xdb\x38\xb2\xee\x7b\x7e\x05\xd7\xe4\x65\xef\x75\x46\x98\x6e\x67\x66\xfa\xec\x3e\x4f\xb6\x1c\x27\x76\x6c\xc7\x1d\x7a\x92\xcc\xbc\xf4\x82\x48\x48\x82\x45\x12\x34\x00\xc9\xb2\x7f\xfd\x59\xb8\xf0\x2a\x08\x12\x59\x86\xd7\xf6\x83\x49\x11\x55\x5f\xb1\x00\x10\xd7\x42\xd5\xfb\x68\xf2\x7a\x7f\xef\xde\x47\xd7\x34\x21\x85\x20\x69\x24\x59\x24\x97\x24\x3a\x2d\x71\xb2\x24\x51\xcc\xe6\xf2\x09\x73\x12\x5d\xb0\x75\x91\x
[...]
},
- "/camel-catalog-1.2.1-quarkus.yaml": &vfsgen۰CompressedFileInfo{
- name: "camel-catalog-1.2.1-quarkus.yaml",
+ "/camel-catalog-1.3.0-SNAPSHOT-quarkus.yaml":
&vfsgen۰CompressedFileInfo{
+ name:
"camel-catalog-1.3.0-SNAPSHOT-quarkus.yaml",
modTime: time.Time{},
- uncompressedSize: 29181,
+ uncompressedSize: 29335,
- compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x5d\x5b\x57\xdb\xba\xf2\x7f\xcf\xa7\xd0\x2a\x2f\xe7\xac\x55\xab\x17\xfe\x7b\x3f\xf0\x7f\x02\x0a\xdd\x50\x42\x7b\x1a\x4e\xdb\xbd\xdf\x14\x5b\x49\x44\x6c\xc9\x48\xca\x05\x3e\xfd\x59\x92\xe5\x2b\x66\x6c\x07\xb9\x3c\x10\xc7\x9a\xf9\x8d\x66\x74\x19\x69\x74\xc9\x11\x0a\xfc\xfd\x4d\x8e\xd0\x0d\x0b\x29\x57\x34\x42\x5a\x20\xbd\xa2\xe8\x34\x25\xe1\x8a\xa2\x99\x58\xe8\x1d\x91\x14\x5d\x8a\x0d\x8f\x88\x66\x82\xa3\x7f\x9d\xce\x
[...]
+ compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x5d\x5b\x5b\xdb\x38\xf3\xbf\xcf\xa7\xd0\x53\x6e\xde\xf7\x79\x6a\xb5\xbb\xfc\x77\x2f\xf8\x5f\x01\x85\x16\x4a\x80\xad\xb3\x6d\x77\xef\x14\x5b\x89\x45\x6c\xcb\x48\xca\x01\x3e\xfd\xfb\x48\x96\xe3\x03\x66\x6c\x07\xb9\x5c\x10\xc7\x9a\xf9\x8d\x66\x74\x18\x69\x74\xc8\x11\xf2\xdc\xfd\x4d\x8e\xd0\x0d\x0b\x68\x2a\x69\x88\x14\x47\x2a\xa2\xe8\x34\x23\x41\x44\x91\xcf\x17\x6a\x4b\x04\x45\x97\x7c\x9d\x86\x44\x31\x9e\xa2\xff\x9c\x
[...]
},
"/cr-example.yaml": &vfsgen۰CompressedFileInfo{
name: "cr-example.yaml",
@@ -203,9 +203,9 @@ var assets = func() http.FileSystem {
"/operator-role-olm.yaml": &vfsgen۰CompressedFileInfo{
name: "operator-role-olm.yaml",
modTime: time.Time{},
- uncompressedSize: 3685,
+ uncompressedSize: 3684,
- compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x56\x41\x8f\xdb\x36\x13\xbd\xeb\x57\x0c\xac\x4b\xf2\x61\x2d\x7f\xe9\xa9\x70\x4f\x6e\xb2\xdb\x1a\x0d\x6c\x60\xed\x34\xc8\x71\x44\x8d\xa5\xa9\x29\x0e\x4b\x52\x76\xdc\x5f\x5f\x88\x92\x77\xe5\xd5\x6e\x37\x05\x02\xb8\xbe\x98\x22\xc7\x6f\xde\xbc\x37\x1a\x33\x85\xe9\xf7\xfb\x24\x29\x7c\x64\x45\xc6\x53\x01\x41\x20\x54\x04\x0b\x8b\xaa\x22\xd8\xc8\x2e\x1c\xd1\x11\xdc\x49\x63\x0a\x0c\x2c\x06\xde\x2c\x36\x77\x6f\xa1\x31\x05\x
[...]
+ compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x56\x41\x8f\xdb\x36\x13\xbd\xeb\x57\x0c\xac\x4b\xf2\x61\x2d\x7f\xe9\xa9\x70\x4f\x6e\xb2\xdb\x1a\x0d\x6c\x60\xed\x34\xc8\x71\x44\x8d\xa5\xa9\x29\x0e\x4b\x52\x76\xdc\x5f\x5f\x88\x92\x77\xe5\xd5\x6e\x37\x05\x02\xb8\xbe\x98\x22\xc7\x6f\xde\xbc\x37\x1a\x33\x85\xe9\xf7\xfb\x24\x29\x7c\x64\x45\xc6\x53\x01\x41\x20\x54\x04\x0b\x8b\xaa\x22\xd8\xc8\x2e\x1c\xd1\x11\xdc\x49\x63\x0a\x0c\x2c\x06\xde\x2c\x36\x77\x6f\xa1\x31\x05\x
[...]
},
"/operator-role-openshift.yaml": &vfsgen۰CompressedFileInfo{
name: "operator-role-openshift.yaml",
@@ -221,13 +221,6 @@ var assets = func() http.FileSystem {
compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x53\x4d\x6f\x9b\x40\x14\xbc\xef\xaf\x18\x99\x4b\x22\xf9\xa3\xed\xd1\x3d\xd1\xc4\x56\x51\x23\x5b\x0a\x4e\xa3\x1c\x9f\xe1\x19\x9e\x02\xfb\xe8\xee\x12\xe2\x7f\x5f\x2d\xb6\x9b\x44\xbd\x66\x6f\x88\x61\x3e\x76\x86\x04\xb3\xcf\x3b\x26\xc1\x9d\x14\x6c\x3d\x97\x08\x8a\x50\x33\xd2\x8e\x8a\x9a\x91\xeb\x21\x0c\xe4\x18\x6b\xed\x6d\x49\x41\xd4\xe2\x2a\xcd\xd7\xd7\xe8\x6d\xc9\x0e\x6a\x19\xea\xd0\xaa\x63\x93\xa0\x50\x1b\x9c\xec\x
[...]
},
- "/operator.yaml": &vfsgen۰CompressedFileInfo{
- name: "operator.yaml",
- modTime: time.Time{},
- uncompressedSize: 2112,
-
- compressedContent:
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x54\xc1\x6e\xe3\x36\x10\xbd\xeb\x2b\x1e\xac\xcb\x2e\x10\xdb\x49\x76\x4f\xea\x49\x4d\x1c\xac\xd0\x54\x36\x2c\x6f\x83\x3d\x15\x13\x6a\x24\x11\xa1\x48\x95\xa4\xa2\xd5\xdf\x17\x94\xed\xc4\xc9\x6e\xd3\x1e\x82\xf2\x24\x69\x86\x6f\xde\x9b\x79\x9a\x18\xf3\xf7\x3b\x51\x8c\x5b\x29\x58\x3b\x2e\xe1\x0d\x7c\xc3\x48\x3b\x12\x0d\xa3\x30\x95\x1f\xc8\x32\x6e\x4c\xaf\x4b\xf2\xd2\x68\x7c\x48\x8b\x9b\x8f\xe8\x75\xc9\x16\x46\x33\x8c\x
[...]
- },
"/platform-cr.yaml": &vfsgen۰CompressedFileInfo{
name: "platform-cr.yaml",
modTime: time.Time{},
@@ -358,8 +351,8 @@ var assets = func() http.FileSystem {
fs["/builder-role-kubernetes.yaml"].(os.FileInfo),
fs["/builder-role-openshift.yaml"].(os.FileInfo),
fs["/builder-service-account.yaml"].(os.FileInfo),
- fs["/camel-catalog-1.2.1-main.yaml"].(os.FileInfo),
- fs["/camel-catalog-1.2.1-quarkus.yaml"].(os.FileInfo),
+ fs["/camel-catalog-1.3.0-SNAPSHOT-main.yaml"].(os.FileInfo),
+ fs["/camel-catalog-1.3.0-SNAPSHOT-quarkus.yaml"].(os.FileInfo),
fs["/cr-example.yaml"].(os.FileInfo),
fs["/crd-build.yaml"].(os.FileInfo),
fs["/crd-camel-catalog.yaml"].(os.FileInfo),
@@ -377,7 +370,6 @@ var assets = func() http.FileSystem {
fs["/operator-role-olm.yaml"].(os.FileInfo),
fs["/operator-role-openshift.yaml"].(os.FileInfo),
fs["/operator-service-account.yaml"].(os.FileInfo),
- fs["/operator.yaml"].(os.FileInfo),
fs["/platform-cr.yaml"].(os.FileInfo),
fs["/platform-integration-kit-groovy.yaml"].(os.FileInfo),
fs["/platform-integration-kit-java.yaml"].(os.FileInfo),
diff --git a/e2e/openapi_test.go b/e2e/openapi_test.go
index 735603f..2cccebe 100644
--- a/e2e/openapi_test.go
+++ b/e2e/openapi_test.go
@@ -45,11 +45,11 @@ func TestOpenAPIService(t *testing.T) {
Should(Not(BeNil()))
Eventually(integrationLogs(ns, "petstore"), testTimeoutMedium).
- Should(ContainSubstring("Route: listPets started and
consuming from: http://0.0.0.0:8080/v1/pets"))
+ Should(ContainSubstring("Route: listPets started and
consuming from: platform-http:///v1/pets"))
Eventually(integrationLogs(ns, "petstore"), testTimeoutMedium).
- Should(ContainSubstring("Route: createPets started and
consuming from: http://0.0.0.0:8080/v1/pets"))
+ Should(ContainSubstring("Route: createPets started and
consuming from: platform-http:///v1/pets"))
Eventually(integrationLogs(ns, "petstore"), testTimeoutMedium).
- Should(ContainSubstring("Route: showPetById started and
consuming from: http://0.0.0.0:8080/v1/pets"))
+ Should(ContainSubstring("Route: showPetById started and
consuming from: platform-http:///v1/pets"))
Expect(kamel("delete", "--all", "-n",
ns).Execute()).Should(BeNil())
})
@@ -72,11 +72,11 @@ func TestOpenAPIDeployment(t *testing.T) {
Should(Not(BeNil()))
Eventually(integrationLogs(ns, "petstore"), testTimeoutMedium).
- Should(ContainSubstring("Route: listPets started and
consuming from: http://0.0.0.0:8080/v1/pets"))
+ Should(ContainSubstring("Route: listPets started and
consuming from: platform-http:///v1/pets"))
Eventually(integrationLogs(ns, "petstore"), testTimeoutMedium).
- Should(ContainSubstring("Route: createPets started and
consuming from: http://0.0.0.0:8080/v1/pets"))
+ Should(ContainSubstring("Route: createPets started and
consuming from: platform-http:///v1/pets"))
Eventually(integrationLogs(ns, "petstore"), testTimeoutMedium).
- Should(ContainSubstring("Route: showPetById started and
consuming from: http://0.0.0.0:8080/v1/pets"))
+ Should(ContainSubstring("Route: showPetById started and
consuming from: platform-http:///v1/pets"))
Expect(kamel("delete", "--all", "-n",
ns).Execute()).Should(BeNil())
})
diff --git a/e2e/util/dump.go b/e2e/util/dump.go
index c8454e1..afaabdb 100644
--- a/e2e/util/dump.go
+++ b/e2e/util/dump.go
@@ -52,6 +52,48 @@ func Dump(c client.Client, ns string, t *testing.T) error {
t.Logf("---\n%s\n---\n", string(pdata))
}
+ its, err :=
camelClient.CamelV1().Integrations(ns).List(metav1.ListOptions{})
+ if err != nil {
+ return err
+ }
+ t.Logf("Found %d integrations:\n", len(its.Items))
+ for _, integration := range its.Items {
+ ref := integration
+ pdata, err := kubernetes.ToYAML(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(pdata))
+ }
+
+ iks, err :=
camelClient.CamelV1().IntegrationKits(ns).List(metav1.ListOptions{})
+ if err != nil {
+ return err
+ }
+ t.Logf("Found %d integration kits:\n", len(iks.Items))
+ for _, ik := range iks.Items {
+ ref := ik
+ pdata, err := kubernetes.ToYAML(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(pdata))
+ }
+
+ cms, err := c.CoreV1().ConfigMaps(ns).List(metav1.ListOptions{})
+ if err != nil {
+ return err
+ }
+ t.Logf("Found %d ConfigMaps:\n", len(cms.Items))
+ for _, cm := range cms.Items {
+ ref := cm
+ pdata, err := kubernetes.ToYAML(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(pdata))
+ }
+
lst, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{})
if err != nil {
return err
diff --git a/examples/RestDSL.java b/examples/RestDSL.java
index 10cff73..1037ba3 100644
--- a/examples/RestDSL.java
+++ b/examples/RestDSL.java
@@ -25,10 +25,6 @@ import org.apache.camel.Exchange;
public class RestDSL extends org.apache.camel.builder.RouteBuilder {
@Override
public void configure() throws Exception {
- restConfiguration()
- .host("0.0.0.0")
- .port("8080");
-
rest()
.get("/hello")
.to("direct:hello");
diff --git a/pkg/apis/camel/v1/common_types.go
b/pkg/apis/camel/v1/common_types.go
index 1cc3123..f731aa8 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -112,6 +112,8 @@ const (
CapabilityHealth = "health"
// CapabilityCron --
CapabilityCron = "cron"
+ // CapabilityPlatformHttp --
+ CapabilityPlatformHttp = "platform-http"
)
// ResourceCondition is a common type for all conditions
diff --git a/pkg/apis/camel/v1/knative/types.go
b/pkg/apis/camel/v1/knative/types.go
index f520a08..c0b7526 100644
--- a/pkg/apis/camel/v1/knative/types.go
+++ b/pkg/apis/camel/v1/knative/types.go
@@ -33,9 +33,9 @@ func NewCamelEnvironment() CamelEnvironment {
type CamelServiceDefinition struct {
ServiceType CamelServiceType `json:"type"`
Name string `json:"name"`
- Host string `json:"host"`
- Port int `json:"port"`
- Metadata map[string]string `json:"metadata"`
+ Host string `json:"host,omitempty"`
+ Port *int `json:"port,omitempty"`
+ Metadata map[string]string `json:"metadata,omitempty"`
}
// CamelEndpointKind --
diff --git a/pkg/apis/camel/v1/knative/types_support.go
b/pkg/apis/camel/v1/knative/types_support.go
index 168c6bd..796b89d 100644
--- a/pkg/apis/camel/v1/knative/types_support.go
+++ b/pkg/apis/camel/v1/knative/types_support.go
@@ -27,10 +27,12 @@ import (
func BuildCamelServiceDefinition(name string, endpointKind CamelEndpointKind,
serviceType CamelServiceType,
serviceURL url.URL, apiVersion, kind string) (CamelServiceDefinition,
error) {
+ port := 80
+
definition := CamelServiceDefinition{
Name: name,
Host: serviceURL.Host,
- Port: 80,
+ Port: &port,
ServiceType: serviceType,
Metadata: map[string]string{
CamelMetaEndpointKind: string(endpointKind),
@@ -44,14 +46,12 @@ func BuildCamelServiceDefinition(name string, endpointKind
CamelEndpointKind, se
if err != nil {
return CamelServiceDefinition{}, err
}
- definition.Port = port
+ definition.Port = &port
}
- path := serviceURL.Path
- if path != "" {
- definition.Metadata[CamelMetaServicePath] = path
- } else {
- definition.Metadata[CamelMetaServicePath] = "/"
+ if serviceURL.Path != "" {
+ definition.Metadata[CamelMetaServicePath] = serviceURL.Path
}
+
return definition, nil
}
diff --git a/pkg/builder/runtime/quarkus.go b/pkg/builder/runtime/quarkus.go
index 538474f..aefc706 100644
--- a/pkg/builder/runtime/quarkus.go
+++ b/pkg/builder/runtime/quarkus.go
@@ -74,6 +74,9 @@ func generateQuarkusProject(ctx *builder.Context) error {
// proxies which in some case may fail
p.Properties["quarkus.camel.main.routes-discovery.enabled"] = "false"
+ // disable quarkus banner ...
+ p.Properties["quarkus.banner.enabled"] = "false"
+
// DependencyManagement
p.DependencyManagement.Dependencies =
append(p.DependencyManagement.Dependencies,
maven.Dependency{
diff --git a/pkg/metadata/metadata_dependencies_test.go
b/pkg/metadata/metadata_dependencies_test.go
index b0973e1..3a8f528 100644
--- a/pkg/metadata/metadata_dependencies_test.go
+++ b/pkg/metadata/metadata_dependencies_test.go
@@ -371,7 +371,7 @@ func TestRestDependency(t *testing.T) {
"camel:direct",
"camel:log",
"mvn:org.apache.camel/camel-rest",
- "mvn:org.apache.camel/camel-undertow",
+ "mvn:org.apache.camel.k/camel-k-runtime-http",
},
meta.Dependencies.List())
}
@@ -402,7 +402,7 @@ func TestRestWithPathDependency(t *testing.T) {
"camel:direct",
"camel:log",
"mvn:org.apache.camel/camel-rest",
- "mvn:org.apache.camel/camel-undertow",
+ "mvn:org.apache.camel.k/camel-k-runtime-http",
},
meta.Dependencies.List())
}
@@ -431,7 +431,7 @@ func TestRestConfigurationDependency(t *testing.T) {
"camel:http",
"camel:log",
"mvn:org.apache.camel/camel-rest",
- "mvn:org.apache.camel/camel-undertow",
+ "mvn:org.apache.camel.k/camel-k-runtime-http",
},
meta.Dependencies.List())
}
@@ -461,7 +461,7 @@ func TestRestClosureDependencyGroovy(t *testing.T) {
"camel:http",
"camel:log",
"mvn:org.apache.camel/camel-rest",
- "mvn:org.apache.camel/camel-undertow",
+ "mvn:org.apache.camel.k/camel-k-runtime-http",
},
meta.Dependencies.List())
}
@@ -491,7 +491,7 @@ func TestRestClosureDependencyKotlin(t *testing.T) {
"camel:http",
"camel:log",
"mvn:org.apache.camel/camel-rest",
- "mvn:org.apache.camel/camel-undertow",
+ "mvn:org.apache.camel.k/camel-k-runtime-http",
},
meta.Dependencies.List())
}
diff --git a/pkg/trait/container.go b/pkg/trait/container.go
index a172543..b5c4ec7 100644
--- a/pkg/trait/container.go
+++ b/pkg/trait/container.go
@@ -43,18 +43,6 @@ const (
defaultServicePort = 80
defaultProbePath = "/health"
containerTraitID = "container"
-
- // CamelRestPortProperty ---
- CamelRestPortProperty = "camel.context.rest-configuration.port"
- // CamelRestDefaultPort ---
- CamelRestDefaultPort = "8080"
-
- // CamelRestComponentProperty ---
- CamelRestComponentProperty =
"camel.context.rest-configuration.component"
- // CamelRestDefaultComponentMain ---
- CamelRestDefaultComponentMain = "undertow"
- // CamelRestDefaultComponentQuarkus ---
- CamelRestDefaultComponentQuarkus = "platform-http"
)
// The Container trait can be used to configure properties of the container
where the integration will run.
@@ -92,10 +80,6 @@ type containerTrait struct {
// ProbesEnabled enable/disable probes on the container (default
`false`)
ProbesEnabled bool `property:"probes-enabled"`
- // ProbePort configures the port on which the probes are exposed, by
default it inhierit the
- // value from the `http` port configured on the container. Note that
the value has no effect for Knative service
- // as the port should be the same as the port declared by the container.
- ProbePort *int `property:"probe-port"`
// Path to access on the probe ( default `/health`). Note that this
property is not supported
// on quarkus runtime and setting it will result in the integration
failing to start.
ProbePath string `property:"probe-path"`
@@ -134,7 +118,6 @@ func newContainerTrait() Trait {
ServicePortName: httpPortName,
Name: defaultContainerName,
ProbesEnabled: false,
- ProbePort: nil,
ProbePath: defaultProbePath,
}
}
@@ -194,6 +177,10 @@ func (t *containerTrait) configureDependencies(e
*Environment) {
// nolint:gocyclo
func (t *containerTrait) configureContainer(e *Environment) error {
+ if e.ApplicationProperties == nil {
+ e.ApplicationProperties = make(map[string]string)
+ }
+
container := corev1.Container{
Name: t.Name,
Image: e.Integration.Status.Image,
@@ -215,7 +202,6 @@ func (t *containerTrait) configureContainer(e *Environment)
error {
if t.Expose != nil && *t.Expose {
t.configureService(e, &container)
}
-
if err := t.configureCapabilities(e); err != nil {
return err
}
@@ -224,19 +210,8 @@ func (t *containerTrait) configureContainer(e
*Environment) error {
// Deployment
//
if err := e.Resources.VisitDeploymentE(func(deployment
*appsv1.Deployment) error {
- if t.ProbesEnabled {
- var port int
-
- switch {
- case t.ProbePort != nil:
- port = *t.ProbePort
- case t.Expose != nil && *t.Expose && t.PortName ==
httpPortName:
- port = t.Port
- default:
- return fmt.Errorf("unable to determine the port
probes should be bound to")
- }
-
- if err := t.configureProbes(e, &container, port,
t.ProbePath); err != nil {
+ if t.ProbesEnabled && t.PortName == httpPortName {
+ if err := t.configureProbes(e, &container, t.Port,
t.ProbePath); err != nil {
return err
}
}
@@ -264,7 +239,7 @@ func (t *containerTrait) configureContainer(e *Environment)
error {
// Knative Service
//
if err := e.Resources.VisitKnativeServiceE(func(service
*serving.Service) error {
- if t.ProbesEnabled {
+ if t.ProbesEnabled && t.PortName == httpPortName {
// don't set the port on Knative service as it is not
allowed.
if err := t.configureProbes(e, &container, 0,
t.ProbePath); err != nil {
return err
@@ -305,19 +280,8 @@ func (t *containerTrait) configureContainer(e
*Environment) error {
// CronJob
//
if err := e.Resources.VisitCronJobE(func(cron *v1beta1.CronJob) error {
- if t.ProbesEnabled {
- var port int
-
- switch {
- case t.ProbePort != nil:
- port = *t.ProbePort
- case t.Expose != nil && *t.Expose && t.PortName ==
httpPortName:
- port = t.Port
- default:
- return fmt.Errorf("unable to determine the port
probes should be bound to")
- }
-
- if err := t.configureProbes(e, &container, port,
t.ProbePath); err != nil {
+ if t.ProbesEnabled && t.PortName == httpPortName {
+ if err := t.configureProbes(e, &container, t.Port,
t.ProbePath); err != nil {
return err
}
}
@@ -431,39 +395,48 @@ func (t *containerTrait) configureResources(_
*Environment, container *corev1.Co
}
}
-func (t *containerTrait) configureCapabilities(e *Environment) error {
- if !util.StringSliceExists(e.Integration.Status.Capabilities,
v1.CapabilityRest) {
- return nil
- }
-
- if e.ApplicationProperties == nil {
- e.ApplicationProperties = make(map[string]string)
- }
-
+func (t *containerTrait) configureHTTP(e *Environment) error {
switch e.CamelCatalog.Runtime.Provider {
case v1.RuntimeProviderMain:
- e.ApplicationProperties[CamelRestPortProperty] =
CamelRestDefaultPort
- e.ApplicationProperties[CamelRestComponentProperty] =
CamelRestDefaultComponentMain
+ e.ApplicationProperties["customizer.platform-http.enabled"] =
True
+ e.ApplicationProperties["customizer.platform-http.bind-port"] =
strconv.Itoa(t.Port)
case v1.RuntimeProviderQuarkus:
- // On quarkus, the rest endpoint is bound to the platform http
service
- e.ApplicationProperties[CamelRestComponentProperty] =
CamelRestDefaultComponentQuarkus
+ // Quarkus does not offer a runtime option to change http
listening ports
+ return nil
default:
return fmt.Errorf("unsupported runtime: %s",
e.CamelCatalog.Runtime.Provider)
}
return nil
+
+}
+
+func (t *containerTrait) configureCapabilities(e *Environment) error {
+ requiresHTTP := false
+
+ if util.StringSliceExists(e.Integration.Status.Capabilities,
v1.CapabilityRest) {
+
e.ApplicationProperties["camel.context.rest-configuration.component"] =
"platform-http"
+ requiresHTTP = true
+ }
+
+ if util.StringSliceExists(e.Integration.Status.Capabilities,
v1.CapabilityPlatformHttp) {
+ requiresHTTP = true
+ }
+
+ if requiresHTTP {
+ return t.configureHTTP(e)
+ }
+
+ return nil
}
func (t *containerTrait) configureProbes(e *Environment, container
*corev1.Container, port int, path string) error {
- if e.ApplicationProperties == nil {
- e.ApplicationProperties = make(map[string]string)
+ if err := t.configureHTTP(e); err != nil {
+ return nil
}
switch e.CamelCatalog.Runtime.Provider {
case v1.RuntimeProviderMain:
- e.ApplicationProperties["customizer.inspector.enabled"] = True
- e.ApplicationProperties["customizer.inspector.bind-host"] =
"0.0.0.0"
- e.ApplicationProperties["customizer.inspector.bind-port"] =
strconv.Itoa(port)
e.ApplicationProperties["customizer.health.enabled"] = True
e.ApplicationProperties["customizer.health.path"] = path
case v1.RuntimeProviderQuarkus:
diff --git a/pkg/trait/container_probes_test.go
b/pkg/trait/container_probes_test.go
index 5d2cde6..2de98c6 100644
--- a/pkg/trait/container_probes_test.go
+++ b/pkg/trait/container_probes_test.go
@@ -126,23 +126,14 @@ func TestProbesOnDeploymentWithNoHttpPort(t *testing.T) {
env.Integration.Status.Phase = v1.IntegrationPhaseDeploying
env.Resources.Add(&target)
- probePort := 9191
-
ctr := newTestContainerTrait()
ctr.PortName = "custom"
- ctr.ProbePort = &probePort
ctr.LivenessTimeout = 1234
err := ctr.Apply(&env)
assert.Nil(t, err)
-
- assert.Equal(t, "",
target.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Host)
- assert.Equal(t, int32(probePort),
target.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultProbePath,
target.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Path)
- assert.Equal(t, "",
target.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Host)
- assert.Equal(t, int32(probePort),
target.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultProbePath,
target.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Path)
- assert.Equal(t, int32(1234),
target.Spec.Template.Spec.Containers[0].LivenessProbe.TimeoutSeconds)
+ assert.Nil(t, target.Spec.Template.Spec.Containers[0].LivenessProbe)
+ assert.Nil(t, target.Spec.Template.Spec.Containers[0].ReadinessProbe)
}
func TestProbesOnKnativeService(t *testing.T) {
@@ -177,21 +168,12 @@ func TestProbesOnKnativeServiceWithNoHttpPort(t
*testing.T) {
env.Integration.Status.Phase = v1.IntegrationPhaseDeploying
env.Resources.Add(&target)
- probePort := 9191
-
ctr := newTestContainerTrait()
ctr.PortName = "custom"
- ctr.ProbePort = &probePort
ctr.LivenessTimeout = 1234
err := ctr.Apply(&env)
assert.Nil(t, err)
-
- assert.Equal(t, "",
target.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Host)
- assert.Equal(t, int32(0),
target.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultProbePath,
target.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Path)
- assert.Equal(t, "",
target.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Host)
- assert.Equal(t, int32(0),
target.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultProbePath,
target.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Path)
- assert.Equal(t, int32(1234),
target.Spec.Template.Spec.Containers[0].LivenessProbe.TimeoutSeconds)
+ assert.Nil(t, target.Spec.Template.Spec.Containers[0].LivenessProbe)
+ assert.Nil(t, target.Spec.Template.Spec.Containers[0].ReadinessProbe)
}
diff --git a/pkg/trait/dependencies_test.go b/pkg/trait/dependencies_test.go
index d227d2f..1d28d1c 100644
--- a/pkg/trait/dependencies_test.go
+++ b/pkg/trait/dependencies_test.go
@@ -186,10 +186,10 @@ func TestIntegrationAutoGeneratedDeps(t *testing.T) {
"camel:direct",
"camel:log",
"mvn:org.apache.camel/camel-rest",
- "mvn:org.apache.camel/camel-undertow",
"mvn:org.apache.camel.k/camel-k-loader-java",
"mvn:org.apache.camel.k/camel-k-loader-xml",
- "mvn:org.apache.camel.k/camel-k-runtime-main"},
+ "mvn:org.apache.camel.k/camel-k-runtime-main",
+ "mvn:org.apache.camel.k/camel-k-runtime-http"},
e.Integration.Status.Dependencies,
)
}
@@ -277,7 +277,7 @@ func TestRestDeps(t *testing.T) {
e.Integration.Status.Dependencies,
[]string{
"mvn:org.apache.camel/camel-rest",
- "mvn:org.apache.camel/camel-undertow",
+ "mvn:org.apache.camel.k/camel-k-runtime-http",
},
)
}
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index cd55fac..20747bb 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -21,6 +21,8 @@ import (
"net/url"
"strings"
+ "github.com/apache/camel-k/pkg/util"
+
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
knativeapi "github.com/apache/camel-k/pkg/apis/camel/v1/knative"
"github.com/apache/camel-k/pkg/metadata"
@@ -93,7 +95,7 @@ func (t *knativeTrait) Configure(e *Environment) (bool,
error) {
return false, nil
}
- if !e.IntegrationInPhase(v1.IntegrationPhaseDeploying,
v1.IntegrationPhaseRunning) {
+ if !e.IntegrationInPhase(v1.IntegrationPhaseInitialization,
v1.IntegrationPhaseDeploying, v1.IntegrationPhaseRunning) {
return false, nil
}
@@ -171,30 +173,39 @@ func (t *knativeTrait) Configure(e *Environment) (bool,
error) {
}
func (t *knativeTrait) Apply(e *Environment) error {
- env := knativeapi.NewCamelEnvironment()
- if t.Configuration != "" {
- if err := env.Deserialize(t.Configuration); err != nil {
+ if len(t.ChannelSources) > 0 || len(t.EndpointSources) > 0 ||
len(t.EventSources) > 0 {
+ util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities,
v1.CapabilityPlatformHttp)
+ }
+ if len(t.ChannelSinks) > 0 || len(t.EndpointSinks) > 0 ||
len(t.EventSinks) > 0 {
+ util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities,
v1.CapabilityPlatformHttp)
+ }
+
+ if e.IntegrationInPhase(v1.IntegrationPhaseDeploying,
v1.IntegrationPhaseRunning) {
+ env := knativeapi.NewCamelEnvironment()
+ if t.Configuration != "" {
+ if err := env.Deserialize(t.Configuration); err != nil {
+ return err
+ }
+ }
+
+ if err := t.configureChannels(e, &env); err != nil {
+ return err
+ }
+ if err := t.configureEndpoints(e, &env); err != nil {
+ return err
+ }
+ if err := t.configureEvents(e, &env); err != nil {
return err
}
- }
- if err := t.configureChannels(e, &env); err != nil {
- return err
- }
- if err := t.configureEndpoints(e, &env); err != nil {
- return err
- }
- if err := t.configureEvents(e, &env); err != nil {
- return err
- }
+ conf, err := env.Serialize()
+ if err != nil {
+ return errors.Wrap(err, "unable to fetch environment
configuration")
+ }
- conf, err := env.Serialize()
- if err != nil {
- return errors.Wrap(err, "unable to fetch environment
configuration")
+ envvar.SetVal(&e.EnvVars, "CAMEL_KNATIVE_CONFIGURATION", conf)
}
- envvar.SetVal(&e.EnvVars, "CAMEL_KNATIVE_CONFIGURATION", conf)
-
return nil
}
@@ -213,8 +224,6 @@ func (t *knativeTrait) configureChannels(e *Environment,
env *knativeapi.CamelEn
}
svc := knativeapi.CamelServiceDefinition{
Name: ref.Name,
- Host: "0.0.0.0",
- Port: 8080,
ServiceType: knativeapi.CamelServiceTypeChannel,
Metadata: meta,
}
@@ -223,6 +232,7 @@ func (t *knativeTrait) configureChannels(e *Environment,
env *knativeapi.CamelEn
if err := t.createSubscription(e, ref); err != nil {
return err
}
+
return nil
})
if err != nil {
@@ -267,8 +277,6 @@ func (t *knativeTrait) configureEndpoints(e *Environment,
env *knativeapi.CamelE
}
svc := knativeapi.CamelServiceDefinition{
Name: ref.Name,
- Host: "0.0.0.0",
- Port: 8080,
ServiceType: knativeapi.CamelServiceTypeEndpoint,
Metadata: map[string]string{
knativeapi.CamelMetaServicePath: "/",
@@ -309,8 +317,6 @@ func (t *knativeTrait) configureEvents(e *Environment, env
*knativeapi.CamelEnvi
if !env.ContainsService(ref.Name,
knativeapi.CamelEndpointKindSource, knativeapi.CamelServiceTypeEvent,
ref.APIVersion, ref.Kind) {
svc := knativeapi.CamelServiceDefinition{
Name: ref.Name,
- Host: "0.0.0.0",
- Port: 8080,
ServiceType:
knativeapi.CamelServiceTypeEvent,
Metadata: map[string]string{
knativeapi.CamelMetaServicePath: "/",
@@ -321,6 +327,7 @@ func (t *knativeTrait) configureEvents(e *Environment, env
*knativeapi.CamelEnvi
}
env.Services = append(env.Services, svc)
}
+
return nil
})
if err != nil {
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index 8a46b92..8bbe95c 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -74,8 +74,7 @@ type knativeServiceTrait struct {
//
// * Integration is using the Knative profile
// * All routes are either starting from a HTTP based consumer or a
passive consumer (e.g. `direct` is a passive consumer)
- Auto *bool `property:"auto"`
- deployer deployerTrait
+ Auto *bool `property:"auto"`
}
var _ ControllerStrategySelector = &knativeServiceTrait{}
@@ -165,11 +164,6 @@ func (t *knativeServiceTrait) Configure(e *Environment)
(bool, error) {
}
}
- dt := e.Catalog.GetTrait("deployer")
- if dt != nil {
- t.deployer = *dt.(*deployerTrait)
- }
-
return true, nil
}
diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go
index fc119c5..ad6b766 100644
--- a/pkg/trait/knative_test.go
+++ b/pkg/trait/knative_test.go
@@ -21,6 +21,8 @@ import (
"context"
"testing"
+ eventing "knative.dev/eventing/pkg/apis/eventing/v1alpha1"
+
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
@@ -123,7 +125,7 @@ func TestKnativeEnvConfigurationFromTrait(t *testing.T) {
cSource1 := ne.FindService("channel-source-1",
knativeapi.CamelEndpointKindSource, knativeapi.CamelServiceTypeChannel,
"messaging.knative.dev/v1alpha1", "Channel")
assert.NotNil(t, cSource1)
- assert.Equal(t, "0.0.0.0", cSource1.Host)
+ assert.Empty(t, cSource1.Host)
cSink1 := ne.FindService("channel-sink-1",
knativeapi.CamelEndpointKindSink, knativeapi.CamelServiceTypeChannel,
"messaging.knative.dev/v1alpha1", "Channel")
assert.NotNil(t, cSink1)
@@ -131,7 +133,7 @@ func TestKnativeEnvConfigurationFromTrait(t *testing.T) {
eSource1 := ne.FindService("endpoint-source-1",
knativeapi.CamelEndpointKindSource, knativeapi.CamelServiceTypeEndpoint,
"serving.knative.dev/v1", "Service")
assert.NotNil(t, eSource1)
- assert.Equal(t, "0.0.0.0", eSource1.Host)
+ assert.Empty(t, eSource1.Host)
eSink1 := ne.FindService("endpoint-sink-1",
knativeapi.CamelEndpointKindSink, knativeapi.CamelServiceTypeEndpoint,
"serving.knative.dev/v1", "Service")
assert.NotNil(t, eSink1)
@@ -233,8 +235,158 @@ func TestKnativeEnvConfigurationFromSource(t *testing.T) {
source := ne.FindService("s3fileMover1",
knativeapi.CamelEndpointKindSource, knativeapi.CamelServiceTypeEndpoint,
"serving.knative.dev/v1", "Service")
assert.NotNil(t, source)
- assert.Equal(t, "0.0.0.0", source.Host)
- assert.Equal(t, 8080, source.Port)
+ assert.Empty(t, source.Host)
+ assert.Nil(t, source.Port)
+}
+
+func TestKnativePlatformHttpConfig(t *testing.T) {
+ sources := []v1.SourceSpec{
+ {
+ DataSpec: v1.DataSpec{
+ Name: "source-endpoint.groovy",
+ Content:
`from('knative:endpoint/ep').log('${body}')`,
+ },
+ Language: v1.LanguageGroovy,
+ },
+ {
+ DataSpec: v1.DataSpec{
+ Name: "source-channel.groovy",
+ Content:
`from('knative:channel/channel-source-1').log('${body}')`,
+ },
+ Language: v1.LanguageGroovy,
+ },
+ {
+ DataSpec: v1.DataSpec{
+ Name: "source-event.groovy",
+ Content:
`from('knative:event/event-source-1').log('${body}')`,
+ },
+ Language: v1.LanguageGroovy,
+ },
+ }
+
+ for _, source := range sources {
+ t.Run(source.Name, func(t *testing.T) {
+ environment := NewFakeEnvironment(t, source)
+
+ c, err := NewFakeClient("ns")
+ assert.Nil(t, err)
+
+ tc := NewCatalog(context.TODO(), c)
+
+ err = tc.configure(&environment)
+ assert.Nil(t, err)
+
+ err = tc.apply(&environment)
+ assert.Nil(t, err)
+
+ assert.Contains(t,
environment.Integration.Status.Capabilities, v1.CapabilityPlatformHttp)
+ assert.Equal(t, "true",
environment.ApplicationProperties["customizer.platform-http.enabled"])
+ assert.Equal(t, "8080",
environment.ApplicationProperties["customizer.platform-http.bind-port"])
+ })
+ }
+}
+
+func TestKnativePlatformHttpDepdencies(t *testing.T) {
+ sources := []v1.SourceSpec{
+ {
+ DataSpec: v1.DataSpec{
+ Name: "source-endpoint.groovy",
+ Content:
`from('knative:endpoint/ep').log('${body}')`,
+ },
+ Language: v1.LanguageGroovy,
+ },
+ {
+ DataSpec: v1.DataSpec{
+ Name: "source-channel.groovy",
+ Content:
`from('knative:channel/channel-source-1').log('${body}')`,
+ },
+ Language: v1.LanguageGroovy,
+ },
+ {
+ DataSpec: v1.DataSpec{
+ Name: "source-event.groovy",
+ Content:
`from('knative:event/event-source-1').log('${body}')`,
+ },
+ Language: v1.LanguageGroovy,
+ },
+ }
+
+ for _, source := range sources {
+ t.Run(source.Name, func(t *testing.T) {
+ environment := NewFakeEnvironment(t, source)
+ environment.Integration.Status.Phase =
v1.IntegrationPhaseInitialization
+
+ c, err := NewFakeClient("ns")
+ assert.Nil(t, err)
+
+ tc := NewCatalog(context.TODO(), c)
+
+ err = tc.configure(&environment)
+ assert.Nil(t, err)
+
+ err = tc.apply(&environment)
+ assert.Nil(t, err)
+
+ assert.Contains(t,
environment.Integration.Status.Capabilities, v1.CapabilityPlatformHttp)
+ assert.Contains(t,
environment.Integration.Status.Dependencies,
"mvn:org.apache.camel.k/camel-k-runtime-http")
+ })
+ }
+}
+
+func NewFakeEnvironment(t *testing.T, source v1.SourceSpec) Environment {
+ catalog, err := camel.DefaultCatalog()
+ assert.Nil(t, err)
+
+ traitCatalog := NewCatalog(context.TODO(), nil)
+
+ environment := Environment{
+ CamelCatalog: catalog,
+ Catalog: traitCatalog,
+ Integration: &v1.Integration{
+ ObjectMeta: metav1.ObjectMeta{
+ Name: "test",
+ Namespace: "ns",
+ },
+ Status: v1.IntegrationStatus{
+ Phase: v1.IntegrationPhaseDeploying,
+ },
+ Spec: v1.IntegrationSpec{
+ Profile: v1.TraitProfileKnative,
+ Sources: []v1.SourceSpec{
+ source,
+ },
+ Resources: []v1.ResourceSpec{},
+ Traits: map[string]v1.TraitSpec{
+ "knative": {
+ Configuration:
map[string]string{
+ "enabled": "true",
+ },
+ },
+ },
+ },
+ },
+ IntegrationKit: &v1.IntegrationKit{
+ Status: v1.IntegrationKitStatus{
+ Phase: v1.IntegrationKitPhaseReady,
+ },
+ },
+ Platform: &v1.IntegrationPlatform{
+ Spec: v1.IntegrationPlatformSpec{
+ Cluster: v1.IntegrationPlatformClusterOpenShift,
+ Build: v1.IntegrationPlatformBuildSpec{
+ PublishStrategy:
v1.IntegrationPlatformBuildPublishStrategyS2I,
+ Registry:
v1.IntegrationPlatformRegistrySpec{Address: "registry"},
+ },
+ Profile: v1.TraitProfileKnative,
+ },
+ },
+ EnvVars: make([]corev1.EnvVar, 0),
+ ExecutedTraits: make([]Trait, 0),
+ Resources: k8sutils.NewCollection(),
+ }
+ environment.Platform.ResyncStatusFullConfig()
+
+ return environment
}
func NewFakeClient(namespace string) (client.Client, error) {
@@ -254,6 +406,11 @@ func NewFakeClient(namespace string) (client.Client,
error) {
if err != nil {
return nil, err
}
+ brokerURL, err := apis.ParseURL("http://broker-default.host/")
+ if err != nil {
+ return nil, err
+ }
+
return test.NewFakeClient(
&messaging.Channel{
TypeMeta: metav1.TypeMeta{
@@ -304,7 +461,6 @@ func NewFakeClient(namespace string) (client.Client, error)
{
},
Status: serving.ServiceStatus{
RouteStatusFields: serving.RouteStatusFields{
-
Address: &duckv1.Addressable{
URL: sink1URL,
},
@@ -328,5 +484,48 @@ func NewFakeClient(namespace string) (client.Client,
error) {
},
},
},
+ &eventing.Broker{
+ TypeMeta: metav1.TypeMeta{
+ APIVersion:
eventing.SchemeGroupVersion.String(),
+ Kind: "Broker",
+ },
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ Name: "default",
+ },
+ Spec: eventing.BrokerSpec{},
+ Status: eventing.BrokerStatus{
+ Address: duckv1alpha1.Addressable{
+ Addressable: duckv1beta1.Addressable{
+ URL: brokerURL,
+ },
+ },
+ },
+ },
+ &eventing.Trigger{
+ TypeMeta: metav1.TypeMeta{
+ APIVersion:
eventing.SchemeGroupVersion.String(),
+ Kind: "Trigger",
+ },
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ Name: "event-source-1",
+ },
+ Spec: eventing.TriggerSpec{
+ Filter: &eventing.TriggerFilter{
+ Attributes:
&eventing.TriggerFilterAttributes{
+ "type": "event-source-1",
+ },
+ },
+ Broker: "default",
+ Subscriber: duckv1.Destination{
+ Ref: &corev1.ObjectReference{
+ APIVersion:
serving.SchemeGroupVersion.String(),
+ Kind: "Service",
+ Name: "event-source-1",
+ },
+ },
+ },
+ },
)
}
diff --git a/pkg/util/defaults/defaults.go b/pkg/util/defaults/defaults.go
index 494f4fc..91febcb 100644
--- a/pkg/util/defaults/defaults.go
+++ b/pkg/util/defaults/defaults.go
@@ -26,7 +26,7 @@ const (
Version = "1.0.0-SNAPSHOT"
// DefaultRuntimeVersion --
- DefaultRuntimeVersion = "1.2.1"
+ DefaultRuntimeVersion = "1.3.0-SNAPSHOT"
// BuildahVersion --
BuildahVersion = "1.14.0"
@@ -35,7 +35,7 @@ const (
KanikoVersion = "0.17.1"
// BaseImage --
- BaseImage = "adoptopenjdk/openjdk8:slim"
+ BaseImage = "adoptopenjdk/openjdk11:slim"
// LocalRepository --
LocalRepository = "/tmp/artifacts/m2"
diff --git a/script/Makefile b/script/Makefile
index 34b0979..77ae2d3 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -16,10 +16,10 @@
VERSIONFILE := pkg/util/defaults/defaults.go
VERSION := 1.0.0-SNAPSHOT
LAST_RELEASED_VERSION := 1.0.0-RC2
-RUNTIME_VERSION := 1.2.1
+RUNTIME_VERSION := 1.3.0-SNAPSHOT
BUILDAH_VERSION := 1.14.0
KANIKO_VERSION := 0.17.1
-BASE_IMAGE := adoptopenjdk/openjdk8:slim
+BASE_IMAGE := adoptopenjdk/openjdk11:slim
LOCAL_REPOSITORY := /tmp/artifacts/m2
IMAGE_NAME := docker.io/apache/camel-k
RELEASE_GIT_REMOTE := upstream