From f4c26194d00b0c73a2e0c0630d2fb27adbdffbdf Mon Sep 17 00:00:00 2001 From: Joe DiPol Date: Wed, 8 Jul 2020 15:20:43 -0700 Subject: [PATCH] Add app.yaml to quickstart archetypes. Update k8s support in docs. (#2141) --- .../META-INF/helidon-archetype.xml.mustache | 2 + .../src/main/resources/README.md.mustache | 10 ++++ .../quickstart-mp/src/main/resources/app.yaml | 35 ------------ .../src/main/resources/app.yaml.mustache | 53 +++++++++++++++++++ .../META-INF/helidon-archetype.xml.mustache | 2 + .../src/main/resources/README.md.mustache | 10 ++++ .../quickstart-se/src/main/resources/app.yaml | 35 ------------ .../src/main/resources/app.yaml.mustache | 53 +++++++++++++++++++ docs/about/03_prerequisites.adoc | 2 +- docs/mp/guides/02_quickstart.adoc | 2 +- docs/se/guides/02_quickstart.adoc | 2 +- 11 files changed, 133 insertions(+), 73 deletions(-) delete mode 100644 archetypes/quickstart-mp/src/main/resources/app.yaml create mode 100644 archetypes/quickstart-mp/src/main/resources/app.yaml.mustache delete mode 100644 archetypes/quickstart-se/src/main/resources/app.yaml create mode 100644 archetypes/quickstart-se/src/main/resources/app.yaml.mustache diff --git a/archetypes/quickstart-mp/src/main/resources/META-INF/helidon-archetype.xml.mustache b/archetypes/quickstart-mp/src/main/resources/META-INF/helidon-archetype.xml.mustache index bd05d508266..6c055928e59 100644 --- a/archetypes/quickstart-mp/src/main/resources/META-INF/helidon-archetype.xml.mustache +++ b/archetypes/quickstart-mp/src/main/resources/META-INF/helidon-archetype.xml.mustache @@ -56,6 +56,7 @@ Dockerfile.mustache Dockerfile.native.mustache Dockerfile.jlink.mustache + app.yaml.mustache .dockerignore @@ -67,6 +68,7 @@ Dockerfile.mustache Dockerfile.native.mustache Dockerfile.jlink.mustache + app.yaml.mustache .dockerignore diff --git a/archetypes/quickstart-mp/src/main/resources/README.md.mustache b/archetypes/quickstart-mp/src/main/resources/README.md.mustache index 86e7fa092f7..4ea9328ac16 100644 --- a/archetypes/quickstart-mp/src/main/resources/README.md.mustache +++ b/archetypes/quickstart-mp/src/main/resources/README.md.mustache @@ -64,9 +64,19 @@ Exercise the application as described above kubectl cluster-info # Verify which cluster kubectl get pods # Verify connectivity to cluster kubectl create -f app.yaml # Deploy application +kubectl get pods # Wait for quickstart pod to be RUNNING kubectl get service helidon-quickstart-mp # Verify deployed service ``` +Note the PORTs. You can now exercise the application as you did before but use the second +port number (the NodePort) instead of 8080. + +After you’re done, cleanup. + +``` +kubectl delete -f app.yaml +``` + ## Build a native image with GraalVM GraalVM allows you to compile your programs ahead-of-time into a native diff --git a/archetypes/quickstart-mp/src/main/resources/app.yaml b/archetypes/quickstart-mp/src/main/resources/app.yaml deleted file mode 100644 index 7ff67d44005..00000000000 --- a/archetypes/quickstart-mp/src/main/resources/app.yaml +++ /dev/null @@ -1,35 +0,0 @@ - -kind: Service -apiVersion: v1 -metadata: - name: helidon-quickstart-mp - labels: - app: helidon-quickstart-mp -spec: - type: NodePort - selector: - app: helidon-quickstart-mp - ports: - - port: 8080 - targetPort: 8080 - name: http ---- -kind: Deployment -apiVersion: extensions/v1beta1 -metadata: - name: helidon-quickstart-mp -spec: - replicas: 1 - template: - metadata: - labels: - app: helidon-quickstart-mp - version: v1 - spec: - containers: - - name: helidon-quickstart-mp - image: helidon-quickstart-mp - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8080 ---- diff --git a/archetypes/quickstart-mp/src/main/resources/app.yaml.mustache b/archetypes/quickstart-mp/src/main/resources/app.yaml.mustache new file mode 100644 index 00000000000..7a254fae94e --- /dev/null +++ b/archetypes/quickstart-mp/src/main/resources/app.yaml.mustache @@ -0,0 +1,53 @@ +# +# Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved. +# +# Licensed 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. +# + +kind: Service +apiVersion: v1 +metadata: + name: {{artifactId}} + labels: + app: {{artifactId}} +spec: + type: NodePort + selector: + app: {{artifactId}} + ports: + - port: 8080 + targetPort: 8080 + name: http +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{artifactId}} +spec: + replicas: 1 + selector: + matchLabels: + app: {{artifactId}} + template: + metadata: + labels: + app: {{artifactId}} + version: v1 + spec: + containers: + - name: {{artifactId}} + image: {{artifactId}} + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 +--- diff --git a/archetypes/quickstart-se/src/main/resources/META-INF/helidon-archetype.xml.mustache b/archetypes/quickstart-se/src/main/resources/META-INF/helidon-archetype.xml.mustache index ab26f20ca0d..8ab3832b3f3 100644 --- a/archetypes/quickstart-se/src/main/resources/META-INF/helidon-archetype.xml.mustache +++ b/archetypes/quickstart-se/src/main/resources/META-INF/helidon-archetype.xml.mustache @@ -56,6 +56,7 @@ Dockerfile.mustache Dockerfile.native.mustache Dockerfile.jlink.mustache + app.yaml.mustache .dockerignore @@ -67,6 +68,7 @@ Dockerfile.mustache Dockerfile.native.mustache Dockerfile.jlink.mustache + app.yaml.mustache .dockerignore diff --git a/archetypes/quickstart-se/src/main/resources/README.md.mustache b/archetypes/quickstart-se/src/main/resources/README.md.mustache index e977b9385ca..d361e37c688 100644 --- a/archetypes/quickstart-se/src/main/resources/README.md.mustache +++ b/archetypes/quickstart-se/src/main/resources/README.md.mustache @@ -64,9 +64,19 @@ Exercise the application as described above kubectl cluster-info # Verify which cluster kubectl get pods # Verify connectivity to cluster kubectl create -f app.yaml # Deploy application +kubectl get pods # Wait for quickstart pod to be RUNNING kubectl get service helidon-quickstart-se # Get service info ``` +Note the PORTs. You can now exercise the application as you did before but use the second +port number (the NodePort) instead of 8080. + +After you’re done, cleanup. + +``` +kubectl delete -f app.yaml +``` + ## Build a native image with GraalVM GraalVM allows you to compile your programs ahead-of-time into a native diff --git a/archetypes/quickstart-se/src/main/resources/app.yaml b/archetypes/quickstart-se/src/main/resources/app.yaml deleted file mode 100644 index 5a240092bf7..00000000000 --- a/archetypes/quickstart-se/src/main/resources/app.yaml +++ /dev/null @@ -1,35 +0,0 @@ - -kind: Service -apiVersion: v1 -metadata: - name: helidon-quickstart-se - labels: - app: helidon-quickstart-se -spec: - type: NodePort - selector: - app: helidon-quickstart-se - ports: - - port: 8080 - targetPort: 8080 - name: http ---- -kind: Deployment -apiVersion: extensions/v1beta1 -metadata: - name: helidon-quickstart-se -spec: - replicas: 1 - template: - metadata: - labels: - app: helidon-quickstart-se - version: v1 - spec: - containers: - - name: helidon-quickstart-se - image: helidon-quickstart-se - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8080 ---- diff --git a/archetypes/quickstart-se/src/main/resources/app.yaml.mustache b/archetypes/quickstart-se/src/main/resources/app.yaml.mustache new file mode 100644 index 00000000000..7a254fae94e --- /dev/null +++ b/archetypes/quickstart-se/src/main/resources/app.yaml.mustache @@ -0,0 +1,53 @@ +# +# Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved. +# +# Licensed 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. +# + +kind: Service +apiVersion: v1 +metadata: + name: {{artifactId}} + labels: + app: {{artifactId}} +spec: + type: NodePort + selector: + app: {{artifactId}} + ports: + - port: 8080 + targetPort: 8080 + name: http +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{artifactId}} +spec: + replicas: 1 + selector: + matchLabels: + app: {{artifactId}} + template: + metadata: + labels: + app: {{artifactId}} + version: v1 + spec: + containers: + - name: {{artifactId}} + image: {{artifactId}} + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 +--- diff --git a/docs/about/03_prerequisites.adoc b/docs/about/03_prerequisites.adoc index 79ac0d3a7a9..b986a15e1b7 100644 --- a/docs/about/03_prerequisites.adoc +++ b/docs/about/03_prerequisites.adoc @@ -34,7 +34,7 @@ deploy to Kubernetes, you need `kubectl` and a Kubernetes cluster (you can |https://www.oracle.com/technetwork/java/javase/downloads[Java{nbsp}SE{nbsp}11] (http://jdk.java.net[Open{nbsp}JDK{nbsp}11]) or newer |https://maven.apache.org/download.cgi[Maven 3.6.1+] |https://docs.docker.com/install/[Docker 18.09+] -|https://kubernetes.io/docs/tasks/tools/install-kubectl/[Kubectl 1.11.9+] +|https://kubernetes.io/docs/tasks/tools/install-kubectl/[Kubectl 1.16.5+] |======= diff --git a/docs/mp/guides/02_quickstart.adoc b/docs/mp/guides/02_quickstart.adoc index 90c0eb9430b..e4b27553ecb 100644 --- a/docs/mp/guides/02_quickstart.adoc +++ b/docs/mp/guides/02_quickstart.adoc @@ -143,7 +143,7 @@ Then you can try the application as you did before. == Deploy the application to Kubernetes If you don't have access to a Kubernetes cluster, you can -<>. +<>. Then deploy the example: [source,bash] diff --git a/docs/se/guides/02_quickstart.adoc b/docs/se/guides/02_quickstart.adoc index 5dd9bf97b63..a09311f72b9 100644 --- a/docs/se/guides/02_quickstart.adoc +++ b/docs/se/guides/02_quickstart.adoc @@ -143,7 +143,7 @@ Then you can try the application as you did before. == Deploy the application to Kubernetes If you don't have access to a Kubernetes cluster, you can -<>. +<>. Then deploy the example: [source,bash]