-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdetail.yaml
63 lines (61 loc) · 1.35 KB
/
detail.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
apiVersion: v1
kind: ConfigMap
metadata:
name: detail-server
namespace: sample-sms
data:
server: |
from flask import Flask, json
api = Flask(__name__)
@api.route('/', methods=['GET'])
def get():
details = [{"id": 1, "name": "Detail One"}, {"id": 2, "name": "Detail Two"}]
return json.dumps(details)
if __name__ == '__main__':
api.run()
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment-detail
namespace: sample-sms
annotations:
medinvention.dev/sms.group: detail
medinvention.dev/sms.port: "5000"
medinvention.dev/sms.service: detail-service
spec:
selector:
matchLabels:
app: detail
replicas: 1
template:
metadata:
labels:
app: detail
spec:
containers:
- name: server
image: python:3
command: ['sh', '-c', 'pip install flask && python /var/static/server']
ports:
- containerPort: 5000
volumeMounts:
- name: detail-server
mountPath: /var/static
volumes:
- name: detail-server
configMap:
name: detail-server
---
apiVersion: v1
kind: Service
metadata:
name: detail-service
namespace: sample-sms
spec:
ports:
- name: http
port: 5000
targetPort: 5000
selector:
app: detail