-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-gateway-deployment.yaml
More file actions
75 lines (75 loc) · 2.56 KB
/
api-gateway-deployment.yaml
File metadata and controls
75 lines (75 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-gateway
namespace: banking-app
labels:
app.kubernetes.io/name: banking-app
app.kubernetes.io/component: gateway
app.kubernetes.io/service: api-gateway
spec:
replicas: 1
selector:
matchLabels:
app: api-gateway
app.kubernetes.io/name: banking-app
app.kubernetes.io/component: gateway
template:
metadata:
labels:
app: api-gateway
app.kubernetes.io/name: banking-app
app.kubernetes.io/component: gateway
app.kubernetes.io/service: api-gateway
spec:
serviceAccountName: banking-app-sa
containers:
- name: api-gateway
image: ghcr.io/speedscale/microsvc/api-gateway:v1.4.0
imagePullPolicy: Always
command: ["/bin/sh", "-c"]
args: ["exec java $JAVA_OPTS org.springframework.boot.loader.launch.JarLauncher"]
ports:
- containerPort: 8080
name: http
env:
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: jwt-secret
key: secret
- name: JAVA_OPTS
value: "-Xms64m -Xmx192m -XX:MaxMetaspaceSize=96m -XX:ReservedCodeCacheSize=32m -XX:MaxDirectMemorySize=16m -XX:+UseSerialGC -XX:+UseStringDeduplication -XX:+UseContainerSupport -Djava.security.egd=file:/dev/./urandom -Dspring.main.lazy-initialization=true"
envFrom:
- configMapRef:
name: app-config
- configMapRef:
name: api-gateway-config
resources:
requests:
memory: "128Mi"
cpu: "50m"
limits:
memory: "256Mi"
cpu: "150m"
livenessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 5
readinessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
initContainers:
- name: wait-for-services
image: busybox:1.35
command: ['sh', '-c', 'echo "[api-gateway] Waiting for microservices..."; services="user-service:80 accounts-service:80 transactions-service:80"; for service in $services; do while ! nc -z ${service%:*} ${service#*:}; do echo "[api-gateway] Waiting for $service..."; sleep 1; done; echo "[api-gateway] ✓ $service ready"; done; echo "[api-gateway] All services ready!"']