mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-19 05:55:51 +00:00
Merge aeb7b80f77
into 932f17ddae
This commit is contained in:
commit
d4c835a67f
19 changed files with 579 additions and 1 deletions
6
.dockerignore
Normal file
6
.dockerignore
Normal file
|
@ -0,0 +1,6 @@
|
|||
Dockerfile
|
||||
draft.toml
|
||||
charts/
|
||||
NOTICE
|
||||
LICENSE
|
||||
README.md
|
6
Dockerfile
Normal file
6
Dockerfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
FROM openjdk:8-jdk-alpine
|
||||
ENV PORT 8080
|
||||
EXPOSE 8080
|
||||
COPY target/*.jar /opt/app.jar
|
||||
WORKDIR /opt
|
||||
CMD ["java", "-jar", "app.jar"]
|
90
Jenkinsfile
vendored
Normal file
90
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
pipeline {
|
||||
agent {
|
||||
label "jenkins-maven"
|
||||
}
|
||||
environment {
|
||||
ORG = 'jenkinsx'
|
||||
APP_NAME = 'spring-petclinic'
|
||||
GIT_CREDS = credentials('jenkins-x-git')
|
||||
CHARTMUSEUM_CREDS = credentials('jenkins-x-chartmuseum')
|
||||
GIT_USERNAME = "$GIT_CREDS_USR"
|
||||
GIT_API_TOKEN = "$GIT_CREDS_PSW"
|
||||
}
|
||||
stages {
|
||||
stage('CI Build and push snapshot') {
|
||||
when {
|
||||
branch 'PR-*'
|
||||
}
|
||||
environment {
|
||||
PREVIEW_VERSION = "0.0.0-SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER"
|
||||
PREVIEW_NAMESPACE = "$APP_NAME-$BRANCH_NAME".toLowerCase()
|
||||
HELM_RELEASE = "$PREVIEW_NAMESPACE".toLowerCase()
|
||||
}
|
||||
steps {
|
||||
container('maven') {
|
||||
sh "mvn versions:set -DnewVersion=$PREVIEW_VERSION"
|
||||
sh "mvn install"
|
||||
sh "docker build -t \$JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST:\$JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT/$ORG/$APP_NAME:$PREVIEW_VERSION ."
|
||||
sh "docker push \$JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST:\$JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT/$ORG/$APP_NAME:$PREVIEW_VERSION"
|
||||
}
|
||||
|
||||
dir ('./charts/preview') {
|
||||
container('maven') {
|
||||
sh "make preview"
|
||||
sh "jx preview --app $APP_NAME --dir ../.."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Release') {
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
steps {
|
||||
container('maven') {
|
||||
// ensure we're not on a detached head
|
||||
sh "git checkout master"
|
||||
// until we switch to the new kubernetes / jenkins credential implementation use git credentials store
|
||||
sh "git config --global credential.helper store"
|
||||
// so we can retrieve the version in later steps
|
||||
sh "echo \$(jx-release-version) > VERSION"
|
||||
sh "mvn versions:set -DnewVersion=\$(cat VERSION)"
|
||||
}
|
||||
dir ('./charts/spring-petclinic') {
|
||||
container('maven') {
|
||||
sh "make tag"
|
||||
}
|
||||
}
|
||||
container('maven') {
|
||||
sh 'mvn clean deploy'
|
||||
|
||||
sh "docker build -t \$JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST:\$JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT/$ORG/$APP_NAME:\$(cat VERSION) ."
|
||||
sh "docker push \$JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST:\$JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT/$ORG/$APP_NAME:\$(cat VERSION)"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Promote to Environments') {
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
steps {
|
||||
dir ('./charts/spring-petclinic') {
|
||||
container('maven') {
|
||||
sh 'jx step changelog --version v\$(cat ../../VERSION)'
|
||||
|
||||
// release the helm chart
|
||||
sh 'make release'
|
||||
|
||||
// promote through all 'Auto' promotion Environments
|
||||
sh 'jx promote -b --all-auto --timeout 1h --version \$(cat ../../VERSION)'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
9
NOTICE
Normal file
9
NOTICE
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License:
|
||||
|
||||
Copyright (C) 2011-2015 Heroku, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
5
charts/preview/Chart.yaml
Normal file
5
charts/preview/Chart.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v1
|
||||
description: A Helm chart for Kubernetes
|
||||
icon: https://raw.githubusercontent.com/jenkins-x/jenkins-x-platform/master/images/java.png
|
||||
name: preview
|
||||
version: 0.1.0-SNAPSHOT
|
22
charts/preview/Makefile
Executable file
22
charts/preview/Makefile
Executable file
|
@ -0,0 +1,22 @@
|
|||
OS := $(shell uname)
|
||||
|
||||
preview:
|
||||
helm init --client-only
|
||||
helm repo add chartmuseum http://jenkins-x-chartmuseum:8080
|
||||
helm repo add chartmuseum https://chartmuseum.build.cd.jenkins-x.io
|
||||
ifeq ($(OS),Darwin)
|
||||
sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
|
||||
sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
|
||||
sed -i "" -e "s/tag: .*/tag: $(PREVIEW_VERSION)/" values.yaml
|
||||
else ifeq ($(OS),Linux)
|
||||
sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
|
||||
sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
|
||||
sed -i -e "s/repository: .*/repository: $(JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST):$(JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT)\/$(ORG)\/$(APP_NAME)/" values.yaml
|
||||
sed -i -e "s/tag: .*/tag: $(PREVIEW_VERSION)/" values.yaml
|
||||
else
|
||||
echo "platfrom $(OS) not supported to release from"
|
||||
exit -1
|
||||
endif
|
||||
echo " version: $(PREVIEW_VERSION)" >> requirements.yaml
|
||||
helm dependency build
|
||||
helm lint
|
13
charts/preview/requirements.yaml
Executable file
13
charts/preview/requirements.yaml
Executable file
|
@ -0,0 +1,13 @@
|
|||
|
||||
dependencies:
|
||||
- alias: expose
|
||||
name: exposecontroller
|
||||
repository: https://chartmuseum.build.cd.jenkins-x.io
|
||||
version: 2.3.56
|
||||
- alias: cleanup
|
||||
name: exposecontroller
|
||||
repository: https://chartmuseum.build.cd.jenkins-x.io
|
||||
version: 2.3.56
|
||||
- alias: preview
|
||||
name: spring-petclinic
|
||||
repository: file://../spring-petclinic
|
22
charts/preview/values.yaml
Executable file
22
charts/preview/values.yaml
Executable file
|
@ -0,0 +1,22 @@
|
|||
|
||||
expose:
|
||||
Annotations:
|
||||
helm.sh/hook: post-install,post-upgrade
|
||||
helm.sh/hook-delete-policy: hook-succeeded
|
||||
config:
|
||||
exposer: Ingress
|
||||
http: true
|
||||
tlsacme: false
|
||||
|
||||
cleanup:
|
||||
Args:
|
||||
- --cleanup
|
||||
Annotations:
|
||||
helm.sh/hook: pre-delete
|
||||
helm.sh/hook-delete-policy: hook-succeeded
|
||||
|
||||
preview:
|
||||
image:
|
||||
repository:
|
||||
tag:
|
||||
pullPolicy: IfNotPresent
|
21
charts/spring-petclinic/.helmignore
Executable file
21
charts/spring-petclinic/.helmignore
Executable file
|
@ -0,0 +1,21 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
5
charts/spring-petclinic/Chart.yaml
Normal file
5
charts/spring-petclinic/Chart.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v1
|
||||
description: A Helm chart for Kubernetes
|
||||
icon: https://raw.githubusercontent.com/jenkins-x/jenkins-x-platform/master/images/java.png
|
||||
name: spring-petclinic
|
||||
version: 0.1.0-SNAPSHOT
|
48
charts/spring-petclinic/Makefile
Executable file
48
charts/spring-petclinic/Makefile
Executable file
|
@ -0,0 +1,48 @@
|
|||
CHART_REPO := http://jenkins-x-chartmuseum:8080
|
||||
CURRENT=$(pwd)
|
||||
NAME := spring-petclinic
|
||||
OS := $(shell uname)
|
||||
RELEASE_VERSION := $(shell cat ../../VERSION)
|
||||
|
||||
build: clean
|
||||
rm -rf requirements.lock
|
||||
helm dependency build
|
||||
helm lint
|
||||
|
||||
install: clean build
|
||||
helm install . --name ${NAME}
|
||||
|
||||
upgrade: clean build
|
||||
helm upgrade ${NAME} .
|
||||
|
||||
delete:
|
||||
helm delete --purge ${NAME}
|
||||
|
||||
clean:
|
||||
rm -rf charts
|
||||
rm -rf ${NAME}*.tgz
|
||||
|
||||
release: clean
|
||||
helm dependency build
|
||||
helm lint
|
||||
helm init --client-only
|
||||
helm package .
|
||||
curl --fail -u $(CHARTMUSEUM_CREDS_USR):$(CHARTMUSEUM_CREDS_PSW) --data-binary "@$(NAME)-$(shell sed -n 's/^version: //p' Chart.yaml).tgz" $(CHART_REPO)/api/charts
|
||||
rm -rf ${NAME}*.tgz%
|
||||
|
||||
tag:
|
||||
ifeq ($(OS),Darwin)
|
||||
sed -i "" -e "s/version:.*/version: $(RELEASE_VERSION)/" Chart.yaml
|
||||
sed -i "" -e "s/tag: .*/tag: $(RELEASE_VERSION)/" values.yaml
|
||||
else ifeq ($(OS),Linux)
|
||||
sed -i -e "s/version:.*/version: $(RELEASE_VERSION)/" Chart.yaml
|
||||
sed -i -e "s/repository: .*/repository: $(JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST):$(JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT)\/$(ORG)\/$(APP_NAME)/" values.yaml
|
||||
sed -i -e "s/tag: .*/tag: $(RELEASE_VERSION)/" values.yaml
|
||||
else
|
||||
echo "platfrom $(OS) not supported to release from"
|
||||
exit -1
|
||||
endif
|
||||
git add --all
|
||||
git commit -m "release $(RELEASE_VERSION)" --allow-empty # if first release then no verion update is performed
|
||||
git tag -fa v$(RELEASE_VERSION) -m "Release version $(RELEASE_VERSION)"
|
||||
git push origin v$(RELEASE_VERSION)
|
1
charts/spring-petclinic/README.md
Executable file
1
charts/spring-petclinic/README.md
Executable file
|
@ -0,0 +1 @@
|
|||
# Java application
|
4
charts/spring-petclinic/templates/NOTES.txt
Executable file
4
charts/spring-petclinic/templates/NOTES.txt
Executable file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Get the application URL by running these commands:
|
||||
|
||||
kubectl get ingress {{ template "fullname" . }}
|
16
charts/spring-petclinic/templates/_helpers.tpl
Executable file
16
charts/spring-petclinic/templates/_helpers.tpl
Executable file
|
@ -0,0 +1,16 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "fullname" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
39
charts/spring-petclinic/templates/deployment.yaml
Executable file
39
charts/spring-petclinic/templates/deployment.yaml
Executable file
|
@ -0,0 +1,39 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
draft: {{ default "draft-app" .Values.draft }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
draft: {{ default "draft-app" .Values.draft }}
|
||||
app: {{ template "fullname" . }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.service.internalPort }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.probePath }}
|
||||
port: {{ .Values.service.internalPort }}
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.probePath }}
|
||||
port: {{ .Values.service.internalPort }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
19
charts/spring-petclinic/templates/service.yaml
Executable file
19
charts/spring-petclinic/templates/service.yaml
Executable file
|
@ -0,0 +1,19 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
{{- if .Values.service.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.service.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.externalPort }}
|
||||
targetPort: {{ .Values.service.internalPort }}
|
||||
protocol: TCP
|
||||
name: {{ .Values.service.name }}
|
||||
selector:
|
||||
app: {{ template "fullname" . }}
|
33
charts/spring-petclinic/values.yaml
Executable file
33
charts/spring-petclinic/values.yaml
Executable file
|
@ -0,0 +1,33 @@
|
|||
# Default values for Maven projects.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
replicaCount: 1
|
||||
image:
|
||||
repository: draft
|
||||
tag: dev
|
||||
pullPolicy: IfNotPresent
|
||||
service:
|
||||
name: spring-petclinic
|
||||
type: ClusterIP
|
||||
externalPort: 80
|
||||
internalPort: 8080
|
||||
annotations:
|
||||
fabric8.io/expose: "true"
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 400m
|
||||
memory: 512Mi
|
||||
probePath: /
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
readinessProbe:
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
terminationGracePeriodSeconds: 10
|
219
openshift/petclinic-web-app.yaml
Normal file
219
openshift/petclinic-web-app.yaml
Normal file
|
@ -0,0 +1,219 @@
|
|||
apiVersion: v1
|
||||
kind: Template
|
||||
labels:
|
||||
template: petclinic-web-app
|
||||
message: |-
|
||||
Template de exemplo para a Talk DevOps
|
||||
metadata:
|
||||
annotations:
|
||||
openshift.io/display-name: PetClinic Web App
|
||||
description: |-
|
||||
Continuous Integration | Build | Package | Deploy
|
||||
iconClass: icon-spring
|
||||
tags: petclinic-web-app,java
|
||||
name: petclinic-web-app
|
||||
parameters:
|
||||
- description: The name assigned to all of the application objects defined in this template.
|
||||
displayName: Application Name
|
||||
name: APP_NAME
|
||||
required: true
|
||||
value: petclinic-web-app
|
||||
- description: The source URL for the application
|
||||
displayName: Source URL
|
||||
name: GIT_SOURCE_URL
|
||||
required: true
|
||||
value: https://github.com/alexbaptista/spring-petclinic.git
|
||||
- description: The source Ref for the application
|
||||
displayName: Source Ref
|
||||
name: GIT_SOURCE_REF
|
||||
required: true
|
||||
value: master
|
||||
- description: Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.
|
||||
displayName: GitHub Webhook Secret
|
||||
name: GITHUB_WEBHOOK_SECRET
|
||||
from: '[a-zA-Z0-9]{40}'
|
||||
generate: expression
|
||||
required: true
|
||||
- description: A secret string used to configure the Generic webhook.
|
||||
displayName: Generic Webhook Secret
|
||||
name: GENERIC_WEBHOOK_SECRET
|
||||
from: '[a-zA-Z0-9]{40}'
|
||||
generate: expression
|
||||
required: true
|
||||
- description: OpenShift Namespace
|
||||
displayName: Namespace
|
||||
name: NAMESPACE
|
||||
required: true
|
||||
value: talkdevops-step2
|
||||
objects:
|
||||
- apiVersion: v1
|
||||
kind: BuildConfig
|
||||
metadata:
|
||||
annotations:
|
||||
pipeline.alpha.openshift.io/uses: '[{"name": "${APP_NAME}", "namespace": "", "kind": "DeploymentConfig"}]'
|
||||
labels:
|
||||
name: ${APP_NAME}-pipeline
|
||||
name: ${APP_NAME}-pipeline
|
||||
spec:
|
||||
strategy:
|
||||
jenkinsPipelineStrategy:
|
||||
jenkinsfile: |-
|
||||
try {
|
||||
timeout(time: 20, unit: 'MINUTES') {
|
||||
def appName="${APP_NAME}"
|
||||
def project=""
|
||||
node {
|
||||
stage("Initialize") {
|
||||
project = env.PROJECT_NAME
|
||||
}
|
||||
}
|
||||
node("maven") {
|
||||
stage("Checkout") {
|
||||
git url: "${GIT_SOURCE_URL}", branch: "${GIT_SOURCE_REF}"
|
||||
}
|
||||
stage("Build JAR") {
|
||||
sh "mvn clean install"
|
||||
stash name:"jar", includes:"target/spring-petclinic-1.5.1.jar"
|
||||
}
|
||||
}
|
||||
node {
|
||||
stage("Build Image") {
|
||||
unstash name:"jar"
|
||||
sh "oc start-build ${appName}-docker --from-file=target/spring-petclinic-1.5.1.jar -n ${project}"
|
||||
openshiftVerifyBuild bldCfg: "${appName}-docker", namespace: project, waitTime: '20', waitUnit: 'min'
|
||||
}
|
||||
stage("Deploy") {
|
||||
openshiftDeploy deploymentConfig: appName, namespace: project
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
echo "in catch block"
|
||||
echo "Caught: ${err}"
|
||||
currentBuild.result = 'FAILURE'
|
||||
throw err
|
||||
}
|
||||
type: JenkinsPipeline
|
||||
triggers:
|
||||
- github:
|
||||
secret: "${GITHUB_WEBHOOK_SECRET}"
|
||||
type: GitHub
|
||||
- generic:
|
||||
secret: "${GENERIC_WEBHOOK_SECRET}"
|
||||
type: Generic
|
||||
- apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ${APP_NAME}
|
||||
spec:
|
||||
ports:
|
||||
- name: web
|
||||
protocol: TCP
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
selector:
|
||||
name: ${APP_NAME}
|
||||
- apiVersion: v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: ${APP_NAME}
|
||||
spec:
|
||||
port:
|
||||
targetPort: web
|
||||
to:
|
||||
kind: Service
|
||||
name: ${APP_NAME}
|
||||
- apiVersion: v1
|
||||
kind: ImageStream
|
||||
metadata:
|
||||
annotations:
|
||||
description: Docker images hub
|
||||
name: ${APP_NAME}
|
||||
- apiVersion: v1
|
||||
kind: BuildConfig
|
||||
metadata:
|
||||
annotations:
|
||||
description: Define como criar o aplicativo
|
||||
name: ${APP_NAME}-docker
|
||||
spec:
|
||||
output:
|
||||
to:
|
||||
kind: ImageStreamTag
|
||||
name: ${APP_NAME}:latest
|
||||
source:
|
||||
dockerfile: |-
|
||||
FROM docker.io/maven:alpine
|
||||
WORKDIR /
|
||||
ADD spring-petclinic-1.5.1.jar .
|
||||
EXPOSE 8080
|
||||
CMD java -jar spring-petclinic-1.5.1.jar
|
||||
binary:
|
||||
asFile: spring-petclinic-1.5.1.jar
|
||||
type: Docker
|
||||
strategy:
|
||||
dockerStrategy:
|
||||
from:
|
||||
kind: DockerImage
|
||||
name: docker.io/maven:alpine
|
||||
type: Docker
|
||||
triggers: []
|
||||
- apiVersion: v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
annotations:
|
||||
description: Define como é realizada a implantação do APP
|
||||
name: ${APP_NAME}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
name: ${APP_NAME}
|
||||
strategy:
|
||||
rollingParams:
|
||||
intervalSeconds: 1
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
timeoutSeconds: 600
|
||||
updatePeriodSeconds: 1
|
||||
type: Rolling
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
alpha.image.policy.openshift.io/resolve-names: '*'
|
||||
labels:
|
||||
name: ${APP_NAME}
|
||||
name: ${APP_NAME}
|
||||
spec:
|
||||
containers:
|
||||
- image: ${APP_NAME}:latest
|
||||
imagePullPolicy: Always
|
||||
name: ${APP_NAME}
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 2
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 2
|
||||
periodSeconds: 10
|
||||
triggers:
|
||||
- type: ConfigChange
|
||||
- imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- ${APP_NAME}
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: '${APP_NAME}:latest'
|
||||
namespace: ${NAMESPACE}
|
||||
type: ImageChange
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
@spring-green: #6db33f;
|
||||
@spring-dark-green: #5fa134;
|
||||
@spring-brown: #34302D;
|
||||
@spring-brown: #ff0000;
|
||||
@spring-grey: #838789;
|
||||
@spring-light-grey: #f1f1f1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue