-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.yaml
118 lines (118 loc) · 4.39 KB
/
service.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
apiVersion: serving.knative.dev/v1
kind: Service
# [START cloudrun_mc_hello_sidecar_step_metadata]
metadata:
name: "deeno-backend-services"
labels:
cloud.googleapis.com/location: "us-east1"
annotations:
# Required to use Cloud Run multi-containers (preview feature)
run.googleapis.com/launch-stage: BETA
run.googleapis.com/description: Deeno backend services
# Externally available
run.googleapis.com/ingress: all
# [END cloudrun_mc_hello_sidecar_step_metadata]
# [START cloudrun_mc_hello_sidecar_step_deps]
spec:
template:
metadata:
annotations:
# Defines container startup order within multi-container service.
# Below requires hello container to spin up before nginx container,
# which depends on the hello container.
# https://cloud.google.com/run/docs/configuring/containers#container-ordering
run.googleapis.com/container-dependencies: "{nginx: [deenoui]}"
# [END cloudrun_mc_hello_sidecar_step_deps]
# [START cloudrun_mc_hello_sidecar_step_serving]
spec:
containers:
# A) Serving ingress container "nginx" listening at PORT 8080
# Main entrypoint of multi-container service.
# Source is stored in nginx_config secret in Secret Manager.
# Any pings to this container will proxy over to hello container at PORT 8888.
# https://cloud.google.com/run/docs/container-contract#port
- image: nginx
name: nginx
ports:
- name: http1
containerPort: 8080
resources:
limits:
cpu: 500m
memory: 256Mi
# Referencing declared volume below,
# Declaring volume to mount in current ingress container's filesystem
# https://cloud.google.com/run/docs/reference/rest/v2/Container#volumemount
volumeMounts:
- name: nginx-conf-secret
readOnly: true
mountPath: /etc/nginx/conf.d/
startupProbe:
timeoutSeconds: 240
periodSeconds: 240
failureThreshold: 1
tcpSocket:
port: 8080
# [END cloudrun_mc_hello_sidecar_step_serving]
# B) Sidecar container "hello" listening at PORT 8888,
# which can only be accessed by serving ingress container
# [START cloudrun_mc_hello_sidecar_step_sidecar]
# - image: us-east1-docker.pkg.dev/deeno-417616/cloud-run-source-deploy/autocomplete-service
# name: autocomplete
# env:
# - name: PORT
# value: "8888"
# resources:
# limits:
# cpu: 1000m
# memory: 512Mi
# startupProbe:
# timeoutSeconds: 240
# periodSeconds: 240
# failureThreshold: 1
# tcpSocket:
# port: 8888
# - image: us-east1-docker.pkg.dev/deeno-417616/cloud-run-source-deploy/flask-aisearch
# name: aisearch
# env:
# - name: PORT
# value: "8889"
# resources:
# limits:
# cpu: 1000m
# memory: 4096Mi
# startupProbe:
# timeoutSeconds: 240
# periodSeconds: 240
# failureThreshold: 1
# tcpSocket:
# port: 8889
- image: us-east1-docker.pkg.dev/deeno-417616/cloud-run-source-deploy/deeno-ui:latest
name: deenoui
env:
- name: PORT
value: "8890"
resources:
limits:
cpu: 1000m
memory: 4096Mi
startupProbe:
timeoutSeconds: 240
periodSeconds: 240
failureThreshold: 1
tcpSocket:
port: 8890
# [END cloudrun_mc_hello_sidecar_step_sidecar]
# us-east1-docker.pkg.dev/deeno-417616/cloud-run-source-deploy/deeno-ui:latest
# Named volume pointing to
# nginx_config secret in secret manager
# [START cloudrun_mc_hello_sidecar_step_secret]
# us-east1-docker.pkg.dev/deeno-417616/cloud-run-source-deploy/flask-aisearch
volumes:
- name: nginx-conf-secret
secret:
secretName: nginx_config
items:
- key: latest
path: default.conf
# [END cloudrun_mc_hello_sidecar_step_secret]