Skip to content

Commit 06db1e8

Browse files
runzexiaks-ci-bot
authored andcommitted
Add tomcat b2i (#96)
* update s2i template * config support b2i Signed-off-by: runzexia <runzexia@yunify.com> * e2e test Signed-off-by: runzexia <runzexia@yunify.com> * update runtimeImage org Signed-off-by: runzexia <runzexia@yunify.com> * update e2e test timeout Signed-off-by: runzexia <runzexia@yunify.com> * update runtime image name Signed-off-by: runzexia <runzexia@yunify.com>
1 parent 9ab0b86 commit 06db1e8

22 files changed

Lines changed: 518 additions & 73 deletions

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# Image URL to use all building/pushing image targets
3-
IMG ?= kubespheredev/s2ioperator:v0.0.11
3+
IMG ?= kubespheredev/s2ioperator:advanced-2.1.0
44

55
all: test manager
66

config/crds/devops_v1alpha1_s2ibuilder.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ spec:
217217
type: string
218218
type: object
219219
type: array
220+
isBinaryURL:
221+
description: IsBinaryURL explain the type of SourceURL. If it is
222+
IsBinaryURL, it will download the file directly without using
223+
git.
224+
type: boolean
220225
keepSymlinks:
221226
description: KeepSymlinks indicates to copy symlinks as symlinks.
222227
Default behavior is to follow symlinks and copy files by content.

config/crds/devops_v1alpha1_s2irun.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ spec:
6060
description: NewRevisionId override the default NewRevisionId in its
6161
s2ibuilder.
6262
type: string
63+
newSourceURL:
64+
description: NewSourceURL is used to download new binary artifacts
65+
type: string
6366
newTag:
6467
description: NewTag override the default tag in its s2ibuilder, image
6568
name cannot be changed.

config/default/manager_image_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ spec:
88
spec:
99
containers:
1010
# Change the value of image field below to your controller image URL
11-
- image: kubespheredev/s2ioperator:v0.0.11
11+
- image: kubespheredev/s2ioperator:advanced-2.1.0
1212
name: manager
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
kind: Deployment
2+
apiVersion: apps/v1
3+
metadata:
4+
name: tomcat-s2i
5+
namespace: default
6+
labels:
7+
app: tomcat-s2i
8+
s2ibuilder-b2i-tomcat: s2ibuilder-b2i-tomcat
9+
spec:
10+
replicas: 0
11+
selector:
12+
matchLabels:
13+
app: tomcat-s2i
14+
template:
15+
metadata:
16+
creationTimestamp: null
17+
labels:
18+
app: tomcat-s2i
19+
spec:
20+
containers:
21+
- name: tomcat
22+
image: 'runzexia/hello-java:latest'
23+
ports:
24+
- containerPort: 8080
25+
protocol: TCP
26+
resources:
27+
limits:
28+
cpu: 100m
29+
memory: 200Mi
30+
requests:
31+
cpu: 10m
32+
memory: 10Mi
33+
terminationMessagePath: /dev/termination-log
34+
terminationMessagePolicy: File
35+
imagePullPolicy: IfNotPresent
36+
restartPolicy: Always
37+
terminationGracePeriodSeconds: 30
38+
dnsPolicy: ClusterFirst
39+
serviceAccountName: default
40+
serviceAccount: default
41+
securityContext: {}
42+
schedulerName: default-scheduler
43+
strategy:
44+
type: RollingUpdate
45+
rollingUpdate:
46+
maxUnavailable: 25%
47+
maxSurge: 25%
48+
revisionHistoryLimit: 10
49+
progressDeadlineSeconds: 600
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: devops.kubesphere.io/v1alpha1
2+
kind: S2iBuilder
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: s2ibuilder-b2i-tomcat
7+
namespace: default
8+
annotations:
9+
devops.kubesphere.io/autoscale: '[{"Kind": "Deployment","Name":"tomcat-s2i","initReplicas":3},{"Kind":"StatefulSet","Name":"tomcat-s2i"}]'
10+
spec:
11+
# Add fields here
12+
config:
13+
displayName: "For Test"
14+
sourceUrl: "https://github.com/kubesphere/devops-java-sample/releases/download/v0.0.1/spring-mvc-java11.war"
15+
imageName: runzexia/hello-java
16+
tag: latest
17+
builderPullPolicy: if-not-present
18+
export: true
19+
isBinaryURL: true
20+
pushAuthentication:
21+
username: UserShouldEnterUserName
22+
password: UserShouldEnterUserPassword
23+
builderImage: kubespheredev/tomcat85-java11-centos7
24+
buildVolumes: ["s2i_java_cache:/tmp/artifacts"]
25+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: devops.kubesphere.io/v1alpha1
2+
kind: S2iRun
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: tomcat-s2irun
7+
namespace: default
8+
spec:
9+
builderName: s2ibuilder-b2i-tomcat
10+
newTag: v0.1.0
11+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
labels:
5+
app: tomcat-s2i
6+
s2ibuilder-b2i-tomcat: s2ibuilder-b2i-tomcat
7+
name: tomcat-s2i
8+
namespace: default
9+
spec:
10+
podManagementPolicy: OrderedReady
11+
replicas: 0
12+
revisionHistoryLimit: 10
13+
serviceName: test
14+
selector:
15+
matchLabels:
16+
app: tomcat-s2i
17+
template:
18+
metadata:
19+
creationTimestamp: null
20+
labels:
21+
app: tomcat-s2i
22+
spec:
23+
containers:
24+
- image: runzexia/hello-java:latest
25+
imagePullPolicy: Always
26+
name: container-frx25k
27+
resources:
28+
limits:
29+
cpu: 100m
30+
memory: 200Mi
31+
requests:
32+
cpu: 10m
33+
memory: 10Mi
34+
terminationMessagePath: /dev/termination-log
35+
terminationMessagePolicy: File
36+
dnsPolicy: ClusterFirst
37+
restartPolicy: Always
38+
schedulerName: default-scheduler
39+
securityContext: {}
40+
serviceAccount: default
41+
serviceAccountName: default
42+
terminationGracePeriodSeconds: 30
43+
updateStrategy:
44+
rollingUpdate:
45+
partition: 0
46+
type: RollingUpdate

config/samples/devops_v1alpha2_s2ibuilder_runtimeimage.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ metadata:
88
spec:
99
config:
1010
displayName: "For Test"
11-
builderImage: kubesphere/java-8-centos7:advanced-2.0.0
11+
builderImage: kubespheredev/java-8-centos7:latest
1212
runtimeArtifacts:
1313
- source: /deployments
14-
runtimeImage: zhuxiaoyang/s2i-java8-runtime:latest
14+
runtimeImage: kubespheredev/java-8-runtime:latest
1515
imageName: kubesphere/sample-java
16-
sourceUrl: https://github.com/soulseen/devops-java-sample.git
16+
sourceUrl: https://github.com/kubesphere/devops-java-sample.git
1717
tag: latest
1818
revisionId: master
1919
builderPullPolicy: if-not-present
20-
buildVolumes: ["s2i_java_cache:/opt/app-root/lib"]
20+
buildVolumes: ["s2i_java_cache:/opt/app-root/lib"]

config/templates/java.yaml

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ kind: S2iBuilderTemplate
33
metadata:
44
labels:
55
controller-tools.k8s.io: "1.0"
6+
builder-type.kubesphere.io/s2i: "s2i"
7+
builder-type.kubesphere.io/b2i: "b2i"
68
name: java
79
spec:
810
containerInfo:
9-
- builderImage: kubespheredev/java-11-centos7:advanced-2.0.0
10-
runtimeImage: zhuxiaoyang/s2i-java11-runtime:latest
11+
- builderImage: kubespheredev/java-11-centos7:latest
12+
runtimeImage: kubespheredev/java-11-runtime:latest
1113
runtimeArtifacts:
1214
- source: "/deployments"
1315
buildVolumes: ["s2i_java_cache:/tmp/artifacts"]
14-
- builderImage: kubespheredev/java-8-centos7:advanced-2.0.0
15-
runtimeImage: zhuxiaoyang/s2i-java8-runtime:latest
16+
- builderImage: kubespheredev/java-8-centos7:latest
17+
runtimeImage: kubespheredev/java-8-runtime:latest
1618
runtimeArtifacts:
1719
- source: "/deployments"
1820
buildVolumes: ["s2i_java_cache:/tmp/artifacts"]
@@ -132,65 +134,10 @@ spec:
132134
description: "The list of hosts that should be reached directly, bypassing the proxy, that translates into the http.nonProxyHosts system property."
133135
required: false
134136
defaultValue: ""
135-
- key: AB_JOLOKIA_OFF
136-
type: string
137-
description: "If set disables activation of Jolokia (i.e. echos an empty value). By default, Jolokia is enabled."
138-
required: false
139-
defaultValue: ""
140-
- key: AB_JOLOKIA_CONFIG
141-
type: string
142-
description: " If set uses this file (including path) as Jolokia JVM agent properties (as described in Jolokia's reference manual). If not set, the /opt/jolokia/etc/jolokia.properties will be created using the settings as defined in this document, otherwise the reset of the settings in this document are ignored."
143-
required: false
144-
defaultValue: ""
145-
- key: AB_JOLOKIA_HOST
146-
type: string
147-
description: "Host address to bind to (Default: 0.0.0.0)"
148-
required: false
149-
defaultValue: ""
150-
- key: AB_JOLOKIA_HOST
151-
type: string
152-
description: "Port to use (Default: 8778)"
153-
required: false
154-
defaultValue: ""
155-
- key: AB_JOLOKIA_USER
156-
type: string
157-
description: "User for basic authentication. Defaults to 'jolokia'"
158-
required: false
159-
defaultValue: ""
160-
- key: AB_JOLOKIA_PASSWORD
161-
type: string
162-
description: "Password for basic authentication. By default authentication is switched off."
163-
required: false
164-
defaultValue: ""
165-
- key: AB_JOLOKIA_PASSWORD_RANDOM
166-
type: string
167-
description: "Should a random AB_JOLOKIA_PASSWORD be generated? Generated value will be written to /opt/jolokia/etc/jolokia.pw"
168-
required: false
169-
defaultValue: ""
170-
- key: AB_JOLOKIA_HTTPS
171-
type: string
172-
description: "Switch on secure communication with https. By default self signed server certificates are generated if no serverCert configuration is given in AB_JOLOKIA_OPTS"
173-
required: false
174-
defaultValue: ""
175-
- key: AB_JOLOKIA_ID
176-
type: string
177-
description: "Agent ID to use ($HOSTNAME by default, which is the container id)"
178-
required: false
179-
defaultValue: ""
180-
- key: AB_JOLOKIA_DISCOVERY_ENABLED
181-
type: string
182-
description: "Enable Jolokia discovery. Defaults to false."
183-
required: false
184-
defaultValue: ""
185-
- key: AB_JOLOKIA_OPTS
186-
type: string
187-
description: "Additional options to be appended to the agent configuration. They should be given in the format \"key=value,key=value,...\""
188-
required: false
189-
defaultValue: ""
190137
codeFramework: java
191138
defaultBaseImage: kubespheredev/java-8-centos7:advanced-2.0.0
192139
version: 0.0.1
193140
description: "This is a S2I builder template for Java builds whose result can be run directly without any further application server.It's suited ideally for microservices with a flat classpath (including \"far jars\").
194141
195142
This image also provides an easy integration with an Jolokia agent."
196-
iconPath: assets/java.png
143+
iconPath: assets/java.png

0 commit comments

Comments
 (0)