-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.yaml
More file actions
51 lines (51 loc) · 1.67 KB
/
Copy pathservice.yaml
File metadata and controls
51 lines (51 loc) · 1.67 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
# Knative service manifest for Google Cloud Run.
#
# Deploy with:
# gcloud run services replace deploy/cloudrun/service.yaml \
# --region "$GCP_REGION" --project "$GCP_PROJECT"
#
# The `image` below is a placeholder — deploy/cloudrun/deploy.sh substitutes the
# real pushed tag before applying. Edit the resource values to taste.
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: document-ocr
labels:
app: document-ocr
annotations:
run.googleapis.com/ingress: all
spec:
template:
metadata:
annotations:
# OCR is CPU-bound and serialized inside the process (Semaphore(1)), so
# one request per instance — let Cloud Run scale out horizontally.
autoscaling.knative.dev/minScale: '0'
autoscaling.knative.dev/maxScale: '10'
# CPU is only allocated during requests (scale-to-zero friendly). The
# first request after a cold start downloads/loads models, so allow a
# generous startup window via the readiness probe below.
run.googleapis.com/cpu-throttling: 'true'
spec:
containerConcurrency: 1
timeoutSeconds: 300
containers:
- image: IMAGE_PLACEHOLDER
ports:
- name: http1
containerPort: 8000
resources:
limits:
cpu: '2'
memory: 2Gi
startupProbe:
httpGet:
path: /ready
# Models load on startup; /ready returns 503 until they are ready.
periodSeconds: 5
failureThreshold: 30
timeoutSeconds: 3
livenessProbe:
httpGet:
path: /health
periodSeconds: 30