Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCP: add support for C4A (ARM-based Google Axion) instance types #1662

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions provider/gcp/gcp_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,20 @@ import (
// GCPStorageURL is GCP storage path
const GCPStorageURL string = "https://storage.googleapis.com/%v/%v"

func getArchitecture(flavor string) string {
if flavor != "" {
armFlavors := []string{"t2a", "c4a"}
for _, armFlavor := range armFlavors {
if strings.HasPrefix(flavor, armFlavor) {
return "arm64"
}
}
}
return "x86_64"
}

func amendConfig(c *types.Config) {
if strings.HasPrefix(c.CloudConfig.Flavor, "t2a") {
if getArchitecture(c.CloudConfig.Flavor) == "arm64" {
c.Uefi = true
}
if c.CloudConfig.ConfidentialVM {
Expand Down Expand Up @@ -123,7 +135,7 @@ func (p *GCloud) CreateImage(ctx *lepton.Context, imagePath string) error {
})
}

if strings.HasPrefix(c.CloudConfig.Flavor, "t2a") {
if getArchitecture(c.CloudConfig.Flavor) == "arm64" {
rb.Architecture = "ARM64"
} else {
rb.GuestOsFeatures = append(rb.GuestOsFeatures, &compute.GuestOsFeature{
Expand Down