Skip to content

Commit

Permalink
gcp: allow users to set podvm disk-type
Browse files Browse the repository at this point in the history
Currently, the disk type for GCP PodVM creation is hard coded to
pd-standard.

Fixes #2258.

Signed-off-by: Beraldo Leal <bleal@redhat.com>
  • Loading branch information
beraldoleal committed Feb 6, 2025
1 parent a7524ff commit 4a73b2c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cloud-api-adaptor/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions src/cloud-providers/gcp/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/cloud-providers/gcp/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions src/cloud-providers/gcp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Config struct {
ImageName string
MachineType string
Network string
DiskType string
}

func (c Config) Redact() Config {
Expand Down

0 comments on commit 4a73b2c

Please sign in to comment.