Skip to content

Commit

Permalink
Merge pull request #2 from jsgiraldoh/main
Browse files Browse the repository at this point in the history
add files to run on k8s
  • Loading branch information
ajeetraina authored Nov 21, 2023
2 parents c5e9768 + 076e30d commit 39ecacc
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 0 deletions.
31 changes: 31 additions & 0 deletions k8s/compose/docker-compose-k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

services:
petclinic:
image: jsgiraldoh/spring-petclinic-docker
ports:
- 8000:8000
- 8080:8080
environment:
- SERVER_PORT=8080
- MYSQL_URL=jdbc:mysql://mysqlserver/petclinic
volumes:
- ./:/app
depends_on:
- mysqlserver

mysqlserver:
image: mysql:8
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=
- MYSQL_ALLOW_EMPTY_PASSWORD=true
- MYSQL_USER=petclinic
- MYSQL_PASSWORD=petclinic
- MYSQL_DATABASE=petclinic
volumes:
- mysql_data:/var/lib/mysql
- mysql_config:/etc/mysql/conf.d
volumes:
mysql_data:
mysql_config:
14 changes: 14 additions & 0 deletions k8s/mysql-config-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: mysql-config
name: mysql-config
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}
14 changes: 14 additions & 0 deletions k8s/mysql-data-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: mysql-data
name: mysql-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}
59 changes: 59 additions & 0 deletions k8s/mysql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose-k8s.yml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: mysqlserver
name: mysqlserver
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: mysqlserver
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose-k8s.yml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.network/spring-petclinic-docker-default: "true"
io.kompose.service: mysqlserver
spec:
containers:
- env:
- name: MYSQL_ALLOW_EMPTY_PASSWORD
value: "true"
- name: MYSQL_DATABASE
value: petclinic
- name: MYSQL_PASSWORD
value: petclinic
- name: MYSQL_ROOT_PASSWORD
- name: MYSQL_USER
value: petclinic
image: mysql:8
name: mysqlserver
ports:
- containerPort: 3306
hostPort: 3306
protocol: TCP
resources: {}
volumeMounts:
- mountPath: /var/lib/mysql
name: mysql-data
- mountPath: /etc/mysql/conf.d
name: mysql-config
restartPolicy: Always
volumes:
- name: mysql-data
persistentVolumeClaim:
claimName: mysql-data
- name: mysql-config
persistentVolumeClaim:
claimName: mysql-config
status: {}
19 changes: 19 additions & 0 deletions k8s/mysql-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose-k8s.yml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: mysqlserver
name: mysqlserver
spec:
ports:
- name: "3306"
port: 3306
targetPort: 3306
selector:
io.kompose.service: mysqlserver
status:
loadBalancer: {}
46 changes: 46 additions & 0 deletions k8s/petclinic-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose-k8s.yml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: petclinic
name: petclinic
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: petclinic
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose-k8s.yml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.network/spring-petclinic-docker-default: "true"
io.kompose.service: petclinic
spec:
containers:
- env:
- name: MYSQL_URL
value: jdbc:mysql://mysqlserver/petclinic
- name: SERVER_PORT
value: "8080"
image: jsgiraldoh/spring-petclinic-docker
imagePullPolicy: IfNotPresent
name: petclinic
ports:
- containerPort: 8000
hostPort: 8000
protocol: TCP
- containerPort: 8080
hostPort: 8080
protocol: TCP
resources: {}
restartPolicy: Always
status: {}
22 changes: 22 additions & 0 deletions k8s/petclinic-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose-k8s.yml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: petclinic
name: petclinic
spec:
ports:
- name: "8000"
port: 8000
targetPort: 8000
- name: "8080"
port: 8080
targetPort: 8080
selector:
io.kompose.service: petclinic
status:
loadBalancer: {}

0 comments on commit 39ecacc

Please sign in to comment.