Skip to content

Commit 8955eae

Browse files
committed
RepoI Init
0 parents  commit 8955eae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1752
-0
lines changed

.editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = false
8+
insert_final_newline = false

README.adoc

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
= Istio Tutorial Pipelines
2+
3+
The https://tekton.dev[Tekton Pipelines] that can be used to deploy the https://bit.ly/istio-tutorial[Istio Tutorial] applications to OpenShift/Kubernetes
4+
5+
== Pre-req
6+
7+
An OpenShift4 cluster with
8+
9+
- Isito
10+
- Knative Serving - if you want to deploy the applications in serverless way
11+
- Tekton Pipelines
12+
13+
== Create Tutorial Project in OpenShift
14+
15+
[source,bash]
16+
----
17+
oc new-project tutorial && \
18+
oc create serviceaccount pipeline && \
19+
oc adm policy add-scc-to-user privileged -z pipeline && \
20+
oc adm policy add-role-to-user edit -z pipeline
21+
----
22+
23+
== Deploy Nexus
24+
25+
To make maven builds faster, we will deploy Sonatype Nexus
26+
27+
[source,bash]
28+
----
29+
oc new-app sonatype/nexus && \
30+
oc expose svc/nexus
31+
----
32+
33+
== Tasks
34+
35+
Create the following Tekton tasks which will be used in the `Pipelines`
36+
37+
[source,bash]
38+
----
39+
oc create -f https://raw.githubusercontent.com/tektoncd/catalog/master/openshift-client/openshift-client-task.yaml && \
40+
oc create -f https://raw.githubusercontent.com/openshift/pipelines-catalog/master/s2i-java-8/s2i-java-8-task.yaml && \
41+
oc create -f https://raw.githubusercontent.com/redhat-developer-demos/pipelines-catalog/master/quarkus/s2i-quarkus-task.yaml
42+
----
43+
44+
== Application Deployment
45+
46+
== Common
47+
48+
[source,bash]
49+
----
50+
----
51+
52+
== Customer
53+
54+
[source,bash]
55+
----
56+
----
57+
58+
== Preference
59+
60+
[source,bash]
61+
----
62+
----
63+
64+
== Recommendation
65+
66+
[source,bash]
67+
----
68+
----
69+
70+

customer/Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM fabric8/java-jboss-openjdk8-jdk:1.5.4
2+
ENV JAVA_OPTIONS=-Dquarkus.http.host=0.0.0.0
3+
ENV JAEGER_SERVICE_NAME=customer\
4+
JAEGER_ENDPOINT=http://jaeger-collector.istio-system.svc:14268/api/traces\
5+
JAEGER_PROPAGATION=b3\
6+
JAEGER_SAMPLER_TYPE=const\
7+
JAEGER_SAMPLER_PARAM=1
8+
EXPOSE 8080 8778 9779
9+
COPY target/lib/* /deployments/lib/
10+
COPY target/*-runner.jar /deployments/app.jar
11+
ENTRYPOINT [ "/deployments/run-java.sh" ]

customer/app.yaml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
apiVersion: apps.openshift.io/v1
3+
kind: DeploymentConfig
4+
metadata:
5+
labels:
6+
app: customer
7+
name: customer
8+
spec:
9+
replicas: 1
10+
selector:
11+
app: customer
12+
version: v1
13+
triggers:
14+
- type: ConfigChange
15+
- imageChangeParams:
16+
containerNames:
17+
- customer
18+
from:
19+
kind: ImageStreamTag
20+
name: customer:latest
21+
type: ImageChange
22+
strategy:
23+
type: Rolling
24+
template:
25+
metadata:
26+
labels:
27+
app: customer
28+
version: v1
29+
annotations:
30+
sidecar.istio.io/inject: "true"
31+
spec:
32+
containers:
33+
- env:
34+
- name: JAEGER_SERVICE_NAME
35+
value: customer
36+
- name: JAEGER_ENDPOINT
37+
value: http://jaeger-collector.istio-system.svc:14268/api/traces
38+
- name: JAEGER_PROPAGATION
39+
value: b3
40+
- name: JAEGER_SAMPLER_TYPE
41+
value: const
42+
- name: JAEGER_SAMPLER_PARAM
43+
value: "1"
44+
name: customer
45+
image: customer:latest
46+
imagePullPolicy: IfNotPresent
47+
ports:
48+
- containerPort: 8080
49+
name: http
50+
protocol: TCP
51+
livenessProbe:
52+
httpGet:
53+
path: /health
54+
port: 8080
55+
initialDelaySeconds: 3
56+
periodSeconds: 5
57+
timeoutSeconds: 5
58+
readinessProbe:
59+
httpGet:
60+
path: /health
61+
port: 8080
62+
initialDelaySeconds: 3
63+
periodSeconds: 5
64+
timeoutSeconds: 5
65+
resources:
66+
requests:
67+
memory: "20Mi"
68+
cpu: "50m"
69+
limits:
70+
memory: "40Mi"
71+
cpu: "100m"
72+
securityContext:
73+
privileged: false
74+
---
75+
apiVersion: v1
76+
kind: Service
77+
metadata:
78+
name: customer
79+
labels:
80+
app: customer
81+
spec:
82+
ports:
83+
- name: http
84+
port: 8080
85+
targetPort: 8080
86+
selector:
87+
app: customer
88+
---
89+
kind: Route
90+
apiVersion: route.openshift.io/v1
91+
metadata:
92+
name: customer
93+
labels:
94+
app: customer
95+
spec:
96+
to:
97+
kind: Service
98+
name: customer
99+
weight: 100
100+
port:
101+
targetPort: http

customer/pipeline-deploy.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: tekton.dev/v1alpha1
2+
kind: Pipeline
3+
metadata:
4+
name: cust-deploy-openshift-pipeline
5+
spec:
6+
resources:
7+
- name: app-git
8+
type: git
9+
- name: app-image
10+
type: image
11+
tasks:
12+
- name: build
13+
taskRef:
14+
name: s2i-quarkus
15+
params:
16+
- name: TLSVERIFY
17+
value: "false"
18+
- name: PATH_CONTEXT
19+
value: "customer/java/quarkus"
20+
# if you have different repository manager update the value below
21+
# if don't wish to use nexus or repo manager then comment the name/value below
22+
- name: MAVEN_MIRROR_URL
23+
value: 'http://nexus:8081/nexus/content/groups/public'
24+
resources:
25+
inputs:
26+
- name: source
27+
resource: app-git
28+
outputs:
29+
- name: image
30+
resource: app-image
31+
- name: deploy
32+
taskRef:
33+
name: openshift-client
34+
runAfter:
35+
- build
36+
params:
37+
- name: ARGS
38+
value: "rollout latest customer"

customer/pipeline-run.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: tekton.dev/v1alpha1
2+
kind: PipelineRun
3+
metadata:
4+
generateName: customer-deploy-pipelinerun-
5+
spec:
6+
pipelineRef:
7+
name: deploy-openshift-pipeline
8+
trigger:
9+
type: manual
10+
serviceAccount: 'pipeline'
11+
resources:
12+
- name: app-git
13+
resourceRef:
14+
name: korea-keynote-demo-git
15+
- name: app-image
16+
resourceRef:
17+
name: customer-openshift-image

customer/pom.xml

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.redhat.developer.demos.customer.rest</groupId>
6+
<artifactId>customer</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<properties>
9+
<surefire-plugin.version>2.22.0</surefire-plugin.version>
10+
<quarkus.version>0.19.1</quarkus.version>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
<maven.compiler.source>1.8</maven.compiler.source>
13+
<maven.compiler.target>1.8</maven.compiler.target>
14+
</properties>
15+
<dependencyManagement>
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.quarkus</groupId>
19+
<artifactId>quarkus-bom</artifactId>
20+
<version>${quarkus.version}</version>
21+
<type>pom</type>
22+
<scope>import</scope>
23+
</dependency>
24+
</dependencies>
25+
</dependencyManagement>
26+
<dependencies>
27+
<dependency>
28+
<groupId>io.quarkus</groupId>
29+
<artifactId>quarkus-resteasy</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>io.quarkus</groupId>
33+
<artifactId>quarkus-junit5</artifactId>
34+
<scope>test</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>io.rest-assured</groupId>
38+
<artifactId>rest-assured</artifactId>
39+
<scope>test</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>io.quarkus</groupId>
43+
<artifactId>quarkus-smallrye-rest-client</artifactId>
44+
</dependency>
45+
<dependency>
46+
<groupId>io.quarkus</groupId>
47+
<artifactId>quarkus-smallrye-opentracing</artifactId>
48+
</dependency>
49+
<dependency>
50+
<groupId>io.quarkus</groupId>
51+
<artifactId>quarkus-smallrye-health</artifactId>
52+
</dependency>
53+
<dependency>
54+
<groupId>io.quarkus</groupId>
55+
<artifactId>quarkus-smallrye-metrics</artifactId>
56+
</dependency>
57+
</dependencies>
58+
<build>
59+
<plugins>
60+
<plugin>
61+
<groupId>io.quarkus</groupId>
62+
<artifactId>quarkus-maven-plugin</artifactId>
63+
<version>${quarkus.version}</version>
64+
<executions>
65+
<execution>
66+
<goals>
67+
<goal>build</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
</plugin>
72+
<plugin>
73+
<artifactId>maven-surefire-plugin</artifactId>
74+
<version>${surefire-plugin.version}</version>
75+
<configuration>
76+
<systemProperties>
77+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
78+
</systemProperties>
79+
</configuration>
80+
</plugin>
81+
</plugins>
82+
</build>
83+
<profiles>
84+
<profile>
85+
<id>native</id>
86+
<activation>
87+
<property>
88+
<name>native</name>
89+
</property>
90+
</activation>
91+
<build>
92+
<plugins>
93+
<plugin>
94+
<groupId>io.quarkus</groupId>
95+
<artifactId>quarkus-maven-plugin</artifactId>
96+
<version>${quarkus.version}</version>
97+
<executions>
98+
<execution>
99+
<goals>
100+
<goal>native-image</goal>
101+
</goals>
102+
<configuration>
103+
<enableHttpUrlHandler>true</enableHttpUrlHandler>
104+
</configuration>
105+
</execution>
106+
</executions>
107+
</plugin>
108+
<plugin>
109+
<artifactId>maven-failsafe-plugin</artifactId>
110+
<version>${surefire-plugin.version}</version>
111+
<executions>
112+
<execution>
113+
<goals>
114+
<goal>integration-test</goal>
115+
<goal>verify</goal>
116+
</goals>
117+
<configuration>
118+
<systemProperties>
119+
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
120+
</systemProperties>
121+
</configuration>
122+
</execution>
123+
</executions>
124+
</plugin>
125+
</plugins>
126+
</build>
127+
</profile>
128+
</profiles>
129+
</project>

0 commit comments

Comments
 (0)