Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k8s and v8o support in archetype (3.x) #4887

Merged
merged 1 commit into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion archetypes/helidon/src/main/archetype/common/common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<includes>
<include>.helidon.mustache</include>
<include>README.md.mustache</include>
<include>app.yaml.mustache</include>
</includes>
</templates>
<model>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
#
# Copyright (c) 2018, 2021 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:
Expand All @@ -29,11 +13,24 @@ spec:
targetPort: 8080
name: http
---
{{#yaml-section}}
{{.}}
---
{{/yaml-section}}

{{#app-yaml-content}}
{{.}}
{{/app-yaml-content}}
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
kind: Component
apiVersion: core.oam.dev/v1alpha2
metadata:
name: {{artifactId}}-component
spec:
workload:
apiVersion: oam.verrazzano.io/v1alpha1
kind: VerrazzanoHelidonWorkload
metadata:
name: {{artifactId}}-workload
labels:
app: {{artifactId}}
spec:
deploymentTemplate:
metadata:
name: {{artifactId}}-deployment
podSpec:
containers:
- name: {{artifactId}}-container
image : {{artifactId}}
ports:
- containerPort: 8080
name: http
---
kind: ApplicationConfiguration
apiVersion: core.oam.dev/v1alpha2
metadata:
name: {{artifactId}}-appconf
annotations:
version: v1.0.0
description: "{{artifactId}} application"
spec:
components:
- componentName: {{artifactId}}-component
92 changes: 36 additions & 56 deletions archetypes/helidon/src/main/archetype/common/packaging.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,37 @@
default="false"
optional="true">
<output>
<templates engine="mustache" transformations="mustache">
<directory>files</directory>
<includes>
<include>app.yaml.mustache</include>
</includes>
</templates>
<model>
<list key="yaml-section">
<value template="mustache"><![CDATA[
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{artifactId}}
spec:
replicas: 1
selector:
matchLabels:
app: {{artifactId}}
template:
metadata:
labels:
app: {{artifactId}}
version: v1
spec:
imagePullSecrets:
- name: ocirsecret
containers:
- name: {{artifactId}}
image: {{artifactId}}
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
]]></value>
</list>
<list key="readme-sections">
<value order="50" template="mustache">
<![CDATA[
## Deploy the application to Kubernetes

```
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 {{artifactId}} # 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
```
]]>
</value>
</list>
</model>
</output>
</boolean>
Expand All @@ -66,35 +69,12 @@ spec:
default="false"
optional="true">
<output>
<model>
<list key="yaml-section">
<value template="mustache"><![CDATA[
kind: Component
apiVersion: core.oam.dev/v1alpha2
metadata:
name: {{artifactId}}
spec:
workload:
apiVersion: oam.verrazzano.io/v1alpha1
kind: VerrazzanoHelidonWorkload
metadata:
name: hello-helidon-workload
labels:
app: hello-helidon
spec:
deploymentTemplate:
metadata:
name: hello-helidon-deployment
podSpec:
containers:
- name: hello-helidon-container
image : {{artifactId}}
ports:
- containerPort: 8080
name: http
]]></value>
</list>
</model>
<templates engine="mustache" transformations="mustache">
<directory>files</directory>
<includes>
<include>v8o.yaml.mustache</include>
</includes>
</templates>
</output>
</boolean>
</inputs>
Expand Down