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 confidential-containers#2258.

Signed-off-by: Beraldo Leal <bleal@redhat.com>
  • Loading branch information
beraldoleal committed Jan 29, 2025
1 parent c8f827b commit 8c5413c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cloud-providers/gcp/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func (_ *Manager) ParseCmd(flags *flag.FlagSet) {
flags.StringVar(&gcpcfg.ImageId, "imageid", "", "Pod VM image id that is available at GCP Images. Usually a name like 'podvm-image'")
flags.StringVar(&gcpcfg.InstanceType, "instance-type", "e2-medium", "Pod VM instance type")
flags.StringVar(&gcpcfg.SubnetId, "subnetid", "default", "Network Subnet ID for the 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 @@ -107,7 +107,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.GcpZone)),
DiskType: proto.String(fmt.Sprintf("zones/%s/diskTypes/%s", p.serviceConfig.GcpZone, 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 @@ -17,6 +17,7 @@ type Config struct {
// CAA configuration
ImageId string
InstanceType string
DiskType string
}

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

0 comments on commit 8c5413c

Please sign in to comment.