-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
40 lines (37 loc) · 1.05 KB
/
cloudbuild.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
#
# User-defined substitutions:
# _CLOUDSDK_COMPUTE_ZONE
# _CLOUDSDK_CONTAINER_CLUSTER
#
steps:
# Generate a kubeconfig file for the given GKE cluster.
- name: 'gcr.io/cloud-builders/kubectl'
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_CLOUDSDK_COMPUTE_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_CLOUDSDK_CONTAINER_CLUSTER}'
- 'KUBECONFIG=/kube/config'
entrypoint: 'sh'
args:
- '-c'
- |
CLUSTER=$$(gcloud config get-value container/cluster)
PROJECT=$$(gcloud config get-value core/project)
ZONE=$$(gcloud config get-value compute/zone)
gcloud container clusters get-credentials "$${CLUSTER}" \
--project "$${PROJECT}" \
--zone "$${ZONE}"
volumes:
- name: 'kube'
path: /kube
# Apply the Kubernetes configuration files.
- name: 'gcr.io/cloud-builders/gcloud'
env:
- 'KUBECONFIG=/kube/config'
entrypoint: 'sh'
args:
- '-c'
- |
kubectl apply --recursive -f kubernetes
volumes:
- name: 'kube'
path: /kube