Skip to content

Commit a1ab448

Browse files
authored
Merge branch 'dev' into feature/k8s-5-MySQL_StatefulSets
2 parents f2f8640 + 894058c commit a1ab448

28 files changed

Lines changed: 836 additions & 113 deletions

k8s/admin-server/deployment.yaml

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,34 @@ kind: Deployment
33
metadata:
44
name: admin-server
55
namespace: petclinic
6-
76
spec:
87
replicas: 1
9-
108
selector:
119
matchLabels:
1210
app: admin-server
13-
1411
template:
1512
metadata:
1613
labels:
1714
app: admin-server
18-
1915
spec:
2016
imagePullSecrets:
2117
- name: ecr-secret
22-
2318
containers:
2419
- name: admin-server
2520
image: 045810265680.dkr.ecr.us-east-1.amazonaws.com/petclinic/admin-server:9caf48e
26-
2721
ports:
28-
- containerPort: 9090 # ✅ correct
29-
30-
envFrom:
31-
- configMapRef:
32-
name: admin-config # ✅ fixed from 'app-config'
33-
22+
- containerPort: 9090
23+
env:
24+
- name: SPRING_PROFILES_ACTIVE
25+
value: kubernetes
26+
- name: CONFIG_SERVER_URL
27+
value: http://config-server:8888
3428
readinessProbe:
3529
httpGet:
3630
path: /actuator/health
37-
port: 9090 # ✅ correct
31+
port: 9090
3832
initialDelaySeconds: 60
3933
periodSeconds: 10
40-
41-
livenessProbe: # ✅ added — was missing
42-
httpGet:
43-
path: /actuator/health
44-
port: 9090
45-
initialDelaySeconds: 120
46-
periodSeconds: 20
47-
4834
resources:
4935
requests:
5036
memory: 512Mi
@@ -53,17 +39,5 @@ spec:
5339
memory: 768Mi
5440
cpu: 500m
5541

56-
---
57-
apiVersion: v1
58-
kind: Service
59-
metadata:
60-
name: admin-server
61-
namespace: petclinic
6242

63-
spec:
64-
selector:
65-
app: admin-server
6643

67-
ports:
68-
- port: 9090 # ✅ correct
69-
targetPort: 9090

k8s/admin-server/service.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: admin-server
5+
namespace: petclinic
6+
spec:
7+
selector:
8+
app: admin-server
9+
ports:
10+
- port: 9090
11+
targetPort: 9090

k8s/api-gateway/deployment.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: api-gateway
5+
namespace: petclinic
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: api-gateway
11+
template:
12+
metadata:
13+
labels:
14+
app: api-gateway
15+
spec:
16+
imagePullSecrets:
17+
- name: ecr-secret
18+
containers:
19+
- name: api-gateway
20+
image: 045810265680.dkr.ecr.us-east-1.amazonaws.com/petclinic/api-gateway:9caf48e
21+
ports:
22+
- containerPort: 8080
23+
env:
24+
- name: SPRING_PROFILES_ACTIVE
25+
value: kubernetes
26+
- name: CONFIG_SERVER_URL
27+
value: http://config-server:8888
28+
readinessProbe:
29+
httpGet:
30+
path: /actuator/health
31+
port: 8080
32+
initialDelaySeconds: 60
33+
periodSeconds: 10
34+
livenessProbe:
35+
httpGet:
36+
path: /actuator/health
37+
port: 8080
38+
initialDelaySeconds: 120
39+
periodSeconds: 20
40+
resources:
41+
requests:
42+
memory: 512Mi
43+
cpu: 250m
44+
limits:
45+
memory: 768Mi
46+
cpu: 500m
47+
48+

k8s/api-gateway/hpa.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: autoscaling/v2
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: api-gateway-hpa
5+
namespace: petclinic
6+
spec:
7+
scaleTargetRef:
8+
apiVersion: apps/v1
9+
kind: Deployment
10+
name: api-gateway
11+
minReplicas: 1
12+
maxReplicas: 4
13+
metrics:
14+
- type: Resource
15+
resource:
16+
name: cpu
17+
target:
18+
type: Utilization
19+
averageUtilization: 70
20+
- type: Resource
21+
resource:
22+
name: memory
23+
target:
24+
type: Utilization
25+
averageUtilization: 80
26+
behavior:
27+
scaleUp:
28+
stabilizationWindowSeconds: 30
29+
policies:
30+
- type: Pods
31+
value: 2
32+
periodSeconds: 60
33+
scaleDown:
34+
stabilizationWindowSeconds: 300
35+
policies:
36+
- type: Pods
37+
value: 1
38+
periodSeconds: 120
39+

k8s/api-gateway/service.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: api-gateway
5+
namespace: petclinic
6+
spec:
7+
selector:
8+
app: api-gateway
9+
ports:
10+
- port: 8080
11+
targetPort: 8080

k8s/customers-service/deployment.yaml

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,82 +3,69 @@ kind: Deployment
33
metadata:
44
name: customers-service
55
namespace: petclinic
6-
76
spec:
87
replicas: 1
9-
108
selector:
119
matchLabels:
1210
app: customers-service
13-
1411
template:
1512
metadata:
1613
labels:
1714
app: customers-service
18-
1915
spec:
2016
imagePullSecrets:
2117
- name: ecr-secret
22-
2318
containers:
2419
- name: customers-service
2520
image: 045810265680.dkr.ecr.us-east-1.amazonaws.com/petclinic/customers-service:9caf48e
26-
2721
ports:
28-
- containerPort: 8081 # ✅ fixed from 8080
29-
30-
envFrom:
31-
- configMapRef:
32-
name: app-config
33-
22+
- containerPort: 8080
3423
env:
24+
- name: SERVER_PORT
25+
value: "8080"
26+
- name: SPRING_PROFILES_ACTIVE
27+
value: kubernetes,mysql
28+
- name: CONFIG_SERVER_URL
29+
value: http://config-server:8888
30+
- name: SPRING_APPLICATION_JSON
31+
value: '{"eureka":{"client":{"serviceUrl":{"defaultZone":"http://discovery-server:8761/eureka/"}}}}'
3532
- name: SPRING_DATASOURCE_URL
36-
value: jdbc:mysql://customers-db:3306/customers # ✅ fixed from 'petclinic'
37-
33+
value: jdbc:mysql://customers-db:3306/petclinic
3834
- name: SPRING_DATASOURCE_USERNAME
3935
value: root
40-
4136
- name: SPRING_DATASOURCE_PASSWORD
4237
valueFrom:
4338
secretKeyRef:
4439
name: customers-db-secret
4540
key: mysql-root-password
46-
4741
readinessProbe:
4842
httpGet:
4943
path: /actuator/health
50-
port: 8081 # ✅ fixed from 8080
44+
port: 8080
5145
initialDelaySeconds: 60
5246
periodSeconds: 10
53-
failureThreshold: 10
54-
5547
livenessProbe:
5648
httpGet:
5749
path: /actuator/health
58-
port: 8081 # ✅ fixed from 8080
50+
port: 8080
5951
initialDelaySeconds: 180
6052
periodSeconds: 20
61-
failureThreshold: 3
62-
6353
resources:
6454
requests:
6555
memory: 512Mi
6656
cpu: 250m
6757
limits:
6858
memory: 768Mi
6959
cpu: 500m
70-
7160
---
7261
apiVersion: v1
7362
kind: Service
7463
metadata:
7564
name: customers-service
7665
namespace: petclinic
77-
7866
spec:
7967
selector:
8068
app: customers-service
81-
8269
ports:
83-
- port: 8081
84-
targetPort: 8081 # ✅ fixed from 8080
70+
- port: 8080
71+
targetPort: 8080

k8s/customers-service/hpa.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: autoscaling/v2
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: customers-service-hpa
5+
namespace: petclinic
6+
spec:
7+
scaleTargetRef:
8+
apiVersion: apps/v1
9+
kind: Deployment
10+
name: customers-service
11+
minReplicas: 1
12+
maxReplicas: 3
13+
metrics:
14+
- type: Resource
15+
resource:
16+
name: cpu
17+
target:
18+
type: Utilization
19+
averageUtilization: 70
20+
- type: Resource
21+
resource:
22+
name: memory
23+
target:
24+
type: Utilization
25+
averageUtilization: 80
26+
behavior:
27+
scaleUp:
28+
stabilizationWindowSeconds: 60
29+
policies:
30+
- type: Pods
31+
value: 1
32+
periodSeconds: 60
33+
scaleDown:
34+
stabilizationWindowSeconds: 300
35+
policies:
36+
- type: Pods
37+
value: 1
38+
periodSeconds: 120

k8s/genai-service/deployment.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This file defines the Kubernetes Deployment for the genai-service application.
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: genai-service
6+
namespace: petclinic
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: genai-service
12+
template:
13+
metadata:
14+
labels:
15+
app: genai-service
16+
spec:
17+
imagePullSecrets:
18+
- name: ecr-secret
19+
containers:
20+
- name: genai-service
21+
image: 045810265680.dkr.ecr.us-east-1.amazonaws.com/petclinic/genai-service:9caf48e
22+
ports:
23+
- containerPort: 8084
24+
#env:
25+
# - name: SPRING_PROFILES_ACTIVE
26+
# value: kubernetes
27+
# - name: CONFIG_SERVER_URL
28+
# value: http://config-server:8888
29+
# name: OPENAI_API_KEY
30+
#valueFrom:
31+
# secretKeyRef:
32+
# name: openai-secret
33+
# key: api-key
34+
readinessProbe:
35+
httpGet:
36+
path: /actuator/health
37+
port: 8084
38+
initialDelaySeconds: 60
39+
periodSeconds: 10
40+
livenessProbe:
41+
httpGet:
42+
path: /actuator/health
43+
port: 8084
44+
initialDelaySeconds: 120
45+
periodSeconds: 20
46+
resources:
47+
requests:
48+
memory: 512Mi
49+
cpu: 250m
50+
limits:
51+
memory: 768Mi
52+
cpu: 500m
53+
54+
55+

k8s/genai-service/service.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file defines the Kubernetes Service for the genai-service application.
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: genai-service
6+
namespace: petclinic
7+
spec:
8+
selector:
9+
app: genai-service
10+
ports:
11+
- port: 8084
12+
targetPort: 8084

0 commit comments

Comments
 (0)