-
Notifications
You must be signed in to change notification settings - Fork 18
/
service.yaml
66 lines (66 loc) · 2.61 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
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
annotations:
run.googleapis.com/launch-stage: BETA
name: pgadapter-sidecar-example
spec:
template:
metadata:
annotations:
run.googleapis.com/execution-environment: gen1
# This registers 'pgadapter' as a dependency of 'app' and will ensure that pgadapter starts
# before the app container.
run.googleapis.com/container-dependencies: '{"app":["pgadapter"]}'
spec:
# Create an in-memory volume that can be used for Unix domain sockets.
volumes:
- name: sockets-dir
emptyDir:
sizeLimit: 50Mi
medium: Memory
containers:
# This is the main application container.
- name: app
# TODO: Modify MY-REGION and MY-PROJECT to match your application container image.
# Example: europe-north1-docker.pkg.dev/my-test-project/cloud-run-source-deploy/pgadapter-sidecar-example
image: MY-REGION.pkg.dev/MY-PROJECT/cloud-run-source-deploy/pgadapter-sidecar-example
# TODO: Modify these environment variables to match your Cloud Spanner database.
# The PGADAPTER_HOST variable is set to point to /sockets, which is the shared in-memory volume that is used
# for Unix domain sockets.
env:
- name: SPANNER_PROJECT
value: my-project
- name: SPANNER_INSTANCE
value: my-instance
- name: SPANNER_DATABASE
value: my-database
- name: PGADAPTER_HOST
value: /sockets
- name: PGADAPTER_PORT
value: "5432"
ports:
- containerPort: 8080
volumeMounts:
- mountPath: /sockets
name: sockets-dir
# This is the PGAdapter sidecar container.
- name: pgadapter
image: gcr.io/cloud-spanner-pg-adapter/pgadapter
volumeMounts:
- mountPath: /sockets
name: sockets-dir
args:
- -dir /sockets
- -x
# Add a startup probe that checks that PGAdapter is listening on port 5432.
# NOTE: This probe will cause PGAdapter to log an EOF warning. This warning can be ignored.
# The warning is caused by the TCP probe, which will open a TCP connection to PGAdapter,
# but not send a PostgreSQL startup message, and instead just close the connection.
startupProbe:
initialDelaySeconds: 10
timeoutSeconds: 10
periodSeconds: 10
failureThreshold: 3
tcpSocket:
port: 5432