From eccf398c525787440319dbfa6e94ead99b662803 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 11 Jul 2018 15:39:57 +0200 Subject: [PATCH] Support disk size and machine type for GCB Signed-off-by: David Gageot --- examples/annotated-skaffold.yaml | 5 ++++- pkg/skaffold/build/container_builder.go | 4 ++++ pkg/skaffold/schema/v1alpha2/config.go | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/annotated-skaffold.yaml b/examples/annotated-skaffold.yaml index d5e4b7b38c8..c563d7fde5e 100644 --- a/examples/annotated-skaffold.yaml +++ b/examples/annotated-skaffold.yaml @@ -137,5 +137,8 @@ profiles: - name: gcb build: googleCloudBuild: - projectId: k8s-skaffold # Google Cloud Build's project id + projectId: k8s-skaffold + # diskSizeGb: 200 + # machineType: "N1_HIGHCPU_8"|"N1_HIGHCPU_32" + diff --git a/pkg/skaffold/build/container_builder.go b/pkg/skaffold/build/container_builder.go index 11eb7f021a4..de280239bfb 100644 --- a/pkg/skaffold/build/container_builder.go +++ b/pkg/skaffold/build/container_builder.go @@ -148,6 +148,10 @@ func (cb *GoogleCloudBuilder) buildArtifact(ctx context.Context, out io.Writer, }, }, Images: []string{artifact.ImageName}, + Options: &cloudbuild.BuildOptions{ + DiskSizeGb: cb.DiskSizeGb, + MachineType: cb.MachineType, + }, }) op, err := call.Context(ctx).Do() if err != nil { diff --git a/pkg/skaffold/schema/v1alpha2/config.go b/pkg/skaffold/schema/v1alpha2/config.go index f6a0f9daa84..6038786fe57 100644 --- a/pkg/skaffold/schema/v1alpha2/config.go +++ b/pkg/skaffold/schema/v1alpha2/config.go @@ -85,7 +85,9 @@ type LocalBuild struct { // GoogleCloudBuild contains the fields needed to do a remote build on // Google Container Builder. type GoogleCloudBuild struct { - ProjectID string `yaml:"projectId"` + ProjectID string `yaml:"projectId"` + DiskSizeGb int64 `yaml:"diskSizeGb,omitempty"` + MachineType string `yaml:"machineType,omitempty"` } // KanikoBuild contains the fields needed to do a on-cluster build using