2018-06-26 18:01:24 +00:00
|
|
|
apiVersion: extensions/v1beta1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: cartservice
|
|
|
|
spec:
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: cartservice
|
|
|
|
spec:
|
2018-07-02 19:41:33 +00:00
|
|
|
terminationGracePeriodSeconds: 5
|
|
|
|
initContainers:
|
|
|
|
- name: wait-redis
|
|
|
|
image: redis:alpine
|
|
|
|
command: ['sh', '-c', 'set -x;
|
2018-07-02 20:03:37 +00:00
|
|
|
until timeout -t 5 redis-cli -h "${REDIS_HOST}" -p "${REDIS_PORT}" ping; do
|
|
|
|
echo "waiting for redis at ${REDIS_HOST}:${REDIS_PORT}...";
|
2018-07-02 19:41:33 +00:00
|
|
|
sleep 2;
|
|
|
|
done;']
|
|
|
|
env:
|
|
|
|
- name: REDIS_HOST
|
|
|
|
value: "redis-cart"
|
|
|
|
- name: REDIS_PORT
|
|
|
|
value: "6379"
|
2018-06-26 18:01:24 +00:00
|
|
|
containers:
|
|
|
|
- name: server
|
|
|
|
image: cartservice
|
|
|
|
ports:
|
|
|
|
- containerPort: 7070
|
|
|
|
env:
|
|
|
|
- name: REDIS_ADDR
|
|
|
|
value: "redis-cart:6379"
|
2018-06-28 05:49:12 +00:00
|
|
|
- name: PORT
|
2018-06-26 18:01:24 +00:00
|
|
|
value: "7070"
|
2018-06-28 05:49:12 +00:00
|
|
|
- name: LISTEN_ADDR
|
2018-06-28 05:31:31 +00:00
|
|
|
value: "0.0.0.0"
|
2018-06-29 20:45:03 +00:00
|
|
|
# - name: GRPC_TRACE
|
|
|
|
# value: "all"
|
|
|
|
# - name: GRPC_VERBOSITY
|
|
|
|
# value: "debug"
|
2018-06-26 18:01:24 +00:00
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
cpu: 200m
|
|
|
|
memory: 64Mi
|
|
|
|
limits:
|
|
|
|
cpu: 300m
|
|
|
|
memory: 128Mi
|
2018-06-29 00:55:51 +00:00
|
|
|
readinessProbe:
|
|
|
|
tcpSocket:
|
|
|
|
port: 7070
|
|
|
|
livenessProbe:
|
|
|
|
tcpSocket:
|
|
|
|
port: 7070
|
2018-06-26 18:01:24 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: cartservice
|
|
|
|
spec:
|
|
|
|
type: ClusterIP
|
|
|
|
selector:
|
|
|
|
app: cartservice
|
|
|
|
ports:
|
|
|
|
- port: 7070
|
|
|
|
targetPort: 7070
|