-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproducts-api.yaml
90 lines (84 loc) · 1.86 KB
/
products-api.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
# Service to expose web frontend
apiVersion: v1
kind: Service
metadata:
name: products-api-service
spec:
selector:
app: products-api
ports:
- name: http
protocol: TCP
port: 9090
targetPort: 9090
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: products-api
automountServiceAccountToken: true
---
apiVersion: v1
kind: ConfigMap
metadata:
name: db-configmap
data:
config: |
{
"db_connection": "host=postgres port=5432 user=postgres password=password dbname=products sslmode=disable",
"bind_address": ":9090",
"metrics_address": ":9103"
}
---
# Web frontend
apiVersion: apps/v1
kind: Deployment
metadata:
name: products-api
labels:
app: products-api
spec:
replicas: 1
selector:
matchLabels:
app: products-api
template:
metadata:
labels:
app: products-api
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9102"
consul.hashicorp.com/connect-inject: "true"
consul.hashicorp.com/connect-service-upstreams: "postgres:5432"
spec:
serviceAccountName: products-api
volumes:
- name: config
configMap:
name: db-configmap
items:
- key: config
path: conf.json
containers:
- name: products-api
image: hashicorpdemoapp/product-api:v0.0.11
ports:
- containerPort: 9090
- containerPort: 9103
env:
- name: "CONFIG_FILE"
value: "/config/conf.json"
livenessProbe:
httpGet:
path: /health
port: 9090
initialDelaySeconds: 15
timeoutSeconds: 1
periodSeconds: 10
failureThreshold: 30
volumeMounts:
- name: config
mountPath: /config
readOnly: true