| 1 |
# Copyright 2021 Google LLC |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
apiVersion: apps/v1 |
| 16 |
kind: Deployment |
| 17 |
metadata: |
| 18 |
name: <YOUR-DEPLOYMENT-NAME> |
| 19 |
spec: |
| 20 |
selector: |
| 21 |
matchLabels: |
| 22 |
app: <YOUR-APPLICATION-NAME> |
| 23 |
template: |
| 24 |
metadata: |
| 25 |
labels: |
| 26 |
app: <YOUR-APPLICATION-NAME> |
| 27 |
spec: |
| 28 |
containers: |
| 29 |
- name: <YOUR-APPLICATION-NAME> |
| 30 |
# ... other container configuration |
| 31 |
env: |
| 32 |
- name: DB_USER |
| 33 |
valueFrom: |
| 34 |
secretKeyRef: |
| 35 |
name: <YOUR-DB-SECRET> |
| 36 |
key: username |
| 37 |
- name: DB_PASS |
| 38 |
valueFrom: |
| 39 |
secretKeyRef: |
| 40 |
name: <YOUR-DB-SECRET> |
| 41 |
key: password |
| 42 |
- name: DB_NAME |
| 43 |
valueFrom: |
| 44 |
secretKeyRef: |
| 45 |
name: <YOUR-DB-SECRET> |
| 46 |
key: database |
| 47 |
# [START cloud_sql_proxy_secret_host] |
| 48 |
- name: DB_HOST |
| 49 |
valueFrom: |
| 50 |
secretKeyRef: |
| 51 |
name: <YOUR-PRIVATE-IP-SECRET> |
| 52 |
key: db_host |
| 53 |
# [END cloud_sql_proxy_secret_host] |