diff --git a/src/cloud-api-adaptor/entrypoint.sh b/src/cloud-api-adaptor/entrypoint.sh index 25cade483..d511da3ec 100755 --- a/src/cloud-api-adaptor/entrypoint.sh +++ b/src/cloud-api-adaptor/entrypoint.sh @@ -99,6 +99,7 @@ gcp() { [[ "${GCP_ZONE}" ]] && optionals+="-zone ${GCP_ZONE} " # if not set retrieved from IMDS [[ "${GCP_MACHINE_TYPE}" ]] && optionals+="-machine-type ${GCP_MACHINE_TYPE} " # default e2-medium [[ "${GCP_NETWORK}" ]] && optionals+="-network ${GCP_NETWORK} " # defaults to 'default' + [[ "${GCP_DISK_TYPE}" ]] && optionals+="-disk-type ${GCP_DISK_TYPE} " # defaults to 'pd-standard' set -x exec cloud-api-adaptor gcp \ diff --git a/src/cloud-providers/gcp/manager.go b/src/cloud-providers/gcp/manager.go index 83cd435b9..5871630d0 100644 --- a/src/cloud-providers/gcp/manager.go +++ b/src/cloud-providers/gcp/manager.go @@ -25,6 +25,7 @@ func (_ *Manager) ParseCmd(flags *flag.FlagSet) { flags.StringVar(&gcpcfg.ImageName, "image-name", "", "Pod VM image name") flags.StringVar(&gcpcfg.MachineType, "machine-type", "e2-medium", "Pod VM instance type") flags.StringVar(&gcpcfg.Network, "network", "", "Network ID to be used for the Pod VMs") + flags.StringVar(&gcpcfg.DiskType, "disk-type", "pd-standard", "Any GCP disk type (pd-standard, pd-ssd, pd-balanced or pd-extreme)") } func (_ *Manager) LoadEnv() { diff --git a/src/cloud-providers/gcp/provider.go b/src/cloud-providers/gcp/provider.go index 03c691097..5f2dbd250 100644 --- a/src/cloud-providers/gcp/provider.go +++ b/src/cloud-providers/gcp/provider.go @@ -115,7 +115,7 @@ func (p *gcpProvider) CreateInstance(ctx context.Context, podName, sandboxID str InitializeParams: &computepb.AttachedDiskInitializeParams{ DiskSizeGb: proto.Int64(20), SourceImage: srcImage, - DiskType: proto.String(fmt.Sprintf("zones/%s/diskTypes/pd-standard", p.serviceConfig.Zone)), + DiskType: proto.String(fmt.Sprintf("zones/%s/diskTypes/%s", p.serviceConfig.Zone, p.serviceConfig.DiskType)), }, AutoDelete: proto.Bool(true), Boot: proto.Bool(true), diff --git a/src/cloud-providers/gcp/types.go b/src/cloud-providers/gcp/types.go index 617b431d0..0b46bf92f 100644 --- a/src/cloud-providers/gcp/types.go +++ b/src/cloud-providers/gcp/types.go @@ -14,6 +14,7 @@ type Config struct { ImageName string MachineType string Network string + DiskType string } func (c Config) Redact() Config {