mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-19 05:55:51 +00:00
Add container module & helm charts
This commit is contained in:
parent
583f101a0c
commit
465a4c841d
12 changed files with 372 additions and 11 deletions
13
pom.xml
13
pom.xml
|
@ -4,19 +4,20 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>udc-petclinic</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>UDC :: Petclinic</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.4.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>udc-petclinic</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>UDC :: Petclinic</name>
|
||||
|
||||
<modules>
|
||||
<module>udc-backend</module>
|
||||
<!--<module>udc-containers</module>-->
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
@ -4,17 +4,15 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>udc-backend</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>UDC :: Petclinic :: Backend</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>udc-petclinic</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>udc-backend</artifactId>
|
||||
<name>UDC :: Petclinic :: Backend</name>
|
||||
|
||||
<properties>
|
||||
<!-- Generic properties -->
|
||||
<java.version>1.8</java.version>
|
||||
|
|
117
udc-containers/pom.xml
Normal file
117
udc-containers/pom.xml
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>udc-petclinic</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>udc-containers</artifactId>
|
||||
<name>UDC :: Containers :: Parent</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>udc-backend-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<docker.skip.build>true</docker.skip.build>
|
||||
<docker.skip.push>true</docker.skip.push>
|
||||
<docker.baseImage>TODO</docker.baseImage>
|
||||
<docker.repository>university-course</docker.repository>
|
||||
<docker.registry.host>localhost</docker.registry.host>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-docker-resources</id>
|
||||
<phase>none</phase>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/context</outputDirectory>
|
||||
<includeEmptyDirs>true</includeEmptyDirs>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>docker-build</id>
|
||||
<phase>none</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>${docker.skip.build}</skip>
|
||||
<executable>docker</executable>
|
||||
<arguments>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>
|
||||
${docker.registry.host}/${docker.repository}/${project.artifactId}:${project.version}
|
||||
</argument>
|
||||
<argument>${project.build.directory}/context</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>docker-push</id>
|
||||
<phase>none</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>${docker.skip.push}</skip>
|
||||
<executable>docker</executable>
|
||||
<arguments>
|
||||
<argument>push</argument>
|
||||
<argument>
|
||||
${docker.registry.host}/${docker.repository}/${project.artifactId}:${project.version}
|
||||
</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>image</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
|
||||
<properties>
|
||||
<docker.skip.build>false</docker.skip.build>
|
||||
<docker.skip.push>false</docker.skip.push>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
75
udc-containers/udc-backend-service/pom.xml
Normal file
75
udc-containers/udc-backend-service/pom.xml
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>udc-containers</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>udc-backend-service</artifactId>
|
||||
<name>UDC :: Containers :: Backend</name>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-docker-resources</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>TODO</groupId>
|
||||
<artifactId>TODO</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${project.basedir}/target/context</outputDirectory>
|
||||
<destFileName>${project.artifactId}.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<overWriteReleases>false</overWriteReleases>
|
||||
<overWriteSnapshots>true</overWriteSnapshots>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>docker-build</id>
|
||||
<phase>install</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>docker-push</id>
|
||||
<phase>deploy</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
FROM ${docker.baseImage}
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
WORKDIR "/udc/apps/petclinic"
|
||||
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
COPY todo.jar /udc/apps/petclinic/todo.jar
|
||||
|
||||
LABEL project.groupid="${project.groupId}" \
|
||||
project.artifactid="${project.artifactId}" \
|
||||
project.version="${project.version}"
|
|
@ -0,0 +1 @@
|
|||
#!/bin/bash
|
|
@ -0,0 +1,15 @@
|
|||
FROM jenkinsci/jnlp-slave
|
||||
|
||||
ENV CLOUDSDK_CORE_DISABLE_PROMPTS 1
|
||||
ENV PATH /opt/google-cloud-sdk/bin:${PATH}
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y jq \
|
||||
libapparmor-dev \
|
||||
libseccomp-dev \
|
||||
unzip
|
||||
RUN curl https://sdk.cloud.google.com | bash && mv google-cloud-sdk /opt
|
||||
RUN gcloud components install kubectl
|
||||
RUN curl -sfSL https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
|
11
udc-helm/cicd/jenkins/Chart.yaml
Normal file
11
udc-helm/cicd/jenkins/Chart.yaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
name: jenkins
|
||||
description: Jenkins CI for UDC
|
||||
version: 1.0.0
|
||||
keywords:
|
||||
- cicd
|
||||
sources:
|
||||
- https://github.com/kvendingoldo/udc-petclinic
|
||||
maintainers:
|
||||
- name: Alex Sharov
|
||||
email: kvendingoldo@gmail.com
|
||||
engine: gotpl
|
45
udc-helm/cicd/jenkins/templates/deployment.yaml
Normal file
45
udc-helm/cicd/jenkins/templates/deployment.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Values.component.name }}
|
||||
labels:
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: {{ .Values.component.name }}
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
name: {{ .Values.component.name }}
|
||||
labels:
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: {{ .Values.component.name }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Values.component.container.name }}
|
||||
image: {{ .Values.component.container.image }}
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
- containerPort: 50000
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: JENKINS_SLAVEPORT
|
||||
value: '50000'
|
||||
- name: JAVA_VM_PARAMETERS
|
||||
value: '-Xmx3072m -Xms256m'
|
||||
- name: JAVA_OPTS
|
||||
value: '-Djava.util.logging.config.file=/var/jenkins_home/log.properties'
|
||||
volumeMounts:
|
||||
- name: jenkins-persistent-storage
|
||||
mountPath: /var/jenkins_home
|
||||
subPath: jenkins_home
|
||||
volumes:
|
||||
- name: jenkins-persistent-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.component.name }}-pvc
|
37
udc-helm/cicd/jenkins/templates/svc.yaml
Normal file
37
udc-helm/cicd/jenkins/templates/svc.yaml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.component.name }}-ui
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: {{ .Values.component.external.ip }}
|
||||
selector:
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: {{ .Values.component.name }}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.component.external.port }}
|
||||
targetPort: 8080
|
||||
name: ui
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.component.name }}-discovery
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: {{ .Values.component.external.ip }}
|
||||
selector:
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: {{ .Values.component.name }}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 50000
|
||||
targetPort: 50000
|
||||
name: slaves
|
37
udc-helm/cicd/jenkins/templates/volume.yaml
Normal file
37
udc-helm/cicd/jenkins/templates/volume.yaml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: {{ .Values.component.name }}-pv
|
||||
labels:
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: {{ .Values.component.name }}
|
||||
spec:
|
||||
capacity:
|
||||
storage: 15Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
gcePersistentDisk:
|
||||
pdName: {{ .Values.component.volume.name }}
|
||||
fsType: ext4
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Values.component.name }}-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
storageClassName: ""
|
||||
resources:
|
||||
requests:
|
||||
storage: 15Gi
|
||||
selector:
|
||||
matchLabels:
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: {{ .Values.component.name }}
|
10
udc-helm/cicd/jenkins/values.yaml
Normal file
10
udc-helm/cicd/jenkins/values.yaml
Normal file
|
@ -0,0 +1,10 @@
|
|||
component:
|
||||
name: jenkins
|
||||
container:
|
||||
name: udc-jenkins
|
||||
image: jenkins/jenkins:lts
|
||||
external:
|
||||
ip: 104.199.74.83
|
||||
port: 8080
|
||||
volume:
|
||||
name: udc-infra-jenkins-pd
|
Loading…
Reference in a new issue