Skip to content

Commit

Permalink
Add tomcat b2i (#96)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
runzexia authored and ks-ci-bot committed Aug 6, 2019
1 parent 9ab0b86 commit 06db1e8
Show file tree
Hide file tree
Showing 22 changed files with 518 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

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

all: test manager

Expand Down
5 changes: 5 additions & 0 deletions config/crds/devops_v1alpha1_s2ibuilder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ spec:
type: string
type: object
type: array
isBinaryURL:
description: IsBinaryURL explain the type of SourceURL. If it is
IsBinaryURL, it will download the file directly without using
git.
type: boolean
keepSymlinks:
description: KeepSymlinks indicates to copy symlinks as symlinks.
Default behavior is to follow symlinks and copy files by content.
Expand Down
3 changes: 3 additions & 0 deletions config/crds/devops_v1alpha1_s2irun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ spec:
description: NewRevisionId override the default NewRevisionId in its
s2ibuilder.
type: string
newSourceURL:
description: NewSourceURL is used to download new binary artifacts
type: string
newTag:
description: NewTag override the default tag in its s2ibuilder, image
name cannot be changed.
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: kubespheredev/s2ioperator:v0.0.11
- image: kubespheredev/s2ioperator:advanced-2.1.0
name: manager
49 changes: 49 additions & 0 deletions config/samples/b2i/tomcat-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: tomcat-s2i
namespace: default
labels:
app: tomcat-s2i
s2ibuilder-b2i-tomcat: s2ibuilder-b2i-tomcat
spec:
replicas: 0
selector:
matchLabels:
app: tomcat-s2i
template:
metadata:
creationTimestamp: null
labels:
app: tomcat-s2i
spec:
containers:
- name: tomcat
image: 'runzexia/hello-java:latest'
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 100m
memory: 200Mi
requests:
cpu: 10m
memory: 10Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
25 changes: 25 additions & 0 deletions config/samples/b2i/tomcat-s2i-builder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: devops.kubesphere.io/v1alpha1
kind: S2iBuilder
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: s2ibuilder-b2i-tomcat
namespace: default
annotations:
devops.kubesphere.io/autoscale: '[{"Kind": "Deployment","Name":"tomcat-s2i","initReplicas":3},{"Kind":"StatefulSet","Name":"tomcat-s2i"}]'
spec:
# Add fields here
config:
displayName: "For Test"
sourceUrl: "https://github.com/kubesphere/devops-java-sample/releases/download/v0.0.1/spring-mvc-java11.war"
imageName: runzexia/hello-java
tag: latest
builderPullPolicy: if-not-present
export: true
isBinaryURL: true
pushAuthentication:
username: UserShouldEnterUserName
password: UserShouldEnterUserPassword
builderImage: kubespheredev/tomcat85-java11-centos7
buildVolumes: ["s2i_java_cache:/tmp/artifacts"]

11 changes: 11 additions & 0 deletions config/samples/b2i/tomcat-s2i-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: devops.kubesphere.io/v1alpha1
kind: S2iRun
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: tomcat-s2irun
namespace: default
spec:
builderName: s2ibuilder-b2i-tomcat
newTag: v0.1.0

46 changes: 46 additions & 0 deletions config/samples/b2i/tomcat-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: tomcat-s2i
s2ibuilder-b2i-tomcat: s2ibuilder-b2i-tomcat
name: tomcat-s2i
namespace: default
spec:
podManagementPolicy: OrderedReady
replicas: 0
revisionHistoryLimit: 10
serviceName: test
selector:
matchLabels:
app: tomcat-s2i
template:
metadata:
creationTimestamp: null
labels:
app: tomcat-s2i
spec:
containers:
- image: runzexia/hello-java:latest
imagePullPolicy: Always
name: container-frx25k
resources:
limits:
cpu: 100m
memory: 200Mi
requests:
cpu: 10m
memory: 10Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
updateStrategy:
rollingUpdate:
partition: 0
type: RollingUpdate
8 changes: 4 additions & 4 deletions config/samples/devops_v1alpha2_s2ibuilder_runtimeimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
spec:
config:
displayName: "For Test"
builderImage: kubesphere/java-8-centos7:advanced-2.0.0
builderImage: kubespheredev/java-8-centos7:latest
runtimeArtifacts:
- source: /deployments
runtimeImage: zhuxiaoyang/s2i-java8-runtime:latest
runtimeImage: kubespheredev/java-8-runtime:latest
imageName: kubesphere/sample-java
sourceUrl: https://github.com/soulseen/devops-java-sample.git
sourceUrl: https://github.com/kubesphere/devops-java-sample.git
tag: latest
revisionId: master
builderPullPolicy: if-not-present
buildVolumes: ["s2i_java_cache:/opt/app-root/lib"]
buildVolumes: ["s2i_java_cache:/opt/app-root/lib"]
67 changes: 7 additions & 60 deletions config/templates/java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ kind: S2iBuilderTemplate
metadata:
labels:
controller-tools.k8s.io: "1.0"
builder-type.kubesphere.io/s2i: "s2i"
builder-type.kubesphere.io/b2i: "b2i"
name: java
spec:
containerInfo:
- builderImage: kubespheredev/java-11-centos7:advanced-2.0.0
runtimeImage: zhuxiaoyang/s2i-java11-runtime:latest
- builderImage: kubespheredev/java-11-centos7:latest
runtimeImage: kubespheredev/java-11-runtime:latest
runtimeArtifacts:
- source: "/deployments"
buildVolumes: ["s2i_java_cache:/tmp/artifacts"]
- builderImage: kubespheredev/java-8-centos7:advanced-2.0.0
runtimeImage: zhuxiaoyang/s2i-java8-runtime:latest
- builderImage: kubespheredev/java-8-centos7:latest
runtimeImage: kubespheredev/java-8-runtime:latest
runtimeArtifacts:
- source: "/deployments"
buildVolumes: ["s2i_java_cache:/tmp/artifacts"]
Expand Down Expand Up @@ -132,65 +134,10 @@ spec:
description: "The list of hosts that should be reached directly, bypassing the proxy, that translates into the http.nonProxyHosts system property."
required: false
defaultValue: ""
- key: AB_JOLOKIA_OFF
type: string
description: "If set disables activation of Jolokia (i.e. echos an empty value). By default, Jolokia is enabled."
required: false
defaultValue: ""
- key: AB_JOLOKIA_CONFIG
type: string
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."
required: false
defaultValue: ""
- key: AB_JOLOKIA_HOST
type: string
description: "Host address to bind to (Default: 0.0.0.0)"
required: false
defaultValue: ""
- key: AB_JOLOKIA_HOST
type: string
description: "Port to use (Default: 8778)"
required: false
defaultValue: ""
- key: AB_JOLOKIA_USER
type: string
description: "User for basic authentication. Defaults to 'jolokia'"
required: false
defaultValue: ""
- key: AB_JOLOKIA_PASSWORD
type: string
description: "Password for basic authentication. By default authentication is switched off."
required: false
defaultValue: ""
- key: AB_JOLOKIA_PASSWORD_RANDOM
type: string
description: "Should a random AB_JOLOKIA_PASSWORD be generated? Generated value will be written to /opt/jolokia/etc/jolokia.pw"
required: false
defaultValue: ""
- key: AB_JOLOKIA_HTTPS
type: string
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"
required: false
defaultValue: ""
- key: AB_JOLOKIA_ID
type: string
description: "Agent ID to use ($HOSTNAME by default, which is the container id)"
required: false
defaultValue: ""
- key: AB_JOLOKIA_DISCOVERY_ENABLED
type: string
description: "Enable Jolokia discovery. Defaults to false."
required: false
defaultValue: ""
- key: AB_JOLOKIA_OPTS
type: string
description: "Additional options to be appended to the agent configuration. They should be given in the format \"key=value,key=value,...\""
required: false
defaultValue: ""
codeFramework: java
defaultBaseImage: kubespheredev/java-8-centos7:advanced-2.0.0
version: 0.0.1
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\").
This image also provides an easy integration with an Jolokia agent."
iconPath: assets/java.png
iconPath: assets/java.png
3 changes: 2 additions & 1 deletion config/templates/nodejs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: S2iBuilderTemplate
metadata:
labels:
controller-tools.k8s.io: "1.0"
builder-type.kubesphere.io/s2i: "s2i"
name: nodejs
spec:
containerInfo:
Expand Down Expand Up @@ -57,4 +58,4 @@ spec:
defaultBaseImage: kubespheredev/nodejs-8-centos7
version: 0.0.1
description: "Node.js available as container is a base platform for building and running various Node.js applications and frameworks. Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices."
iconPath: assets/nodejs.png
iconPath: assets/nodejs.png
3 changes: 2 additions & 1 deletion config/templates/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: S2iBuilderTemplate
metadata:
labels:
controller-tools.k8s.io: "1.0"
builder-type.kubesphere.io/s2i: "s2i"
name: python
spec:
containerInfo:
Expand Down Expand Up @@ -82,4 +83,4 @@ spec:
description: "Python available as container is a base platform for building and running various Python applications and frameworks. Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
This container image includes an npm utility, so users can use it to install JavaScript modules for their web applications. There is no guarantee for any specific npm or nodejs version, that is included in the image; those versions can be changed anytime and the nodejs itself is included just to make the npm work."
iconPath: assets/python.png
iconPath: assets/python.png
Loading

0 comments on commit 06db1e8

Please sign in to comment.