diff --git a/v1/instancetype.go b/v1/instancetype.go index 5401a769..77d9083d 100644 --- a/v1/instancetype.go +++ b/v1/instancetype.go @@ -337,8 +337,8 @@ func ValidateLocationalInstanceTypes(ctx context.Context, client CloudInstanceTy } // Validate that locational results are a subset of all-location results - if len(locationalTypes) >= len(allLocationTypes) { - return fmt.Errorf("locational instance types (%d) should be fewer than all-location types (%d)", + if len(locationalTypes) > len(allLocationTypes) { + return fmt.Errorf("locational instance types (%d) should not exceed all-location types (%d)", len(locationalTypes), len(allLocationTypes)) } diff --git a/v1/networking_validation.go b/v1/networking_validation.go index 45fdf716..bacbda44 100644 --- a/v1/networking_validation.go +++ b/v1/networking_validation.go @@ -491,6 +491,17 @@ func setupMicroK8sCommand(ctx context.Context, sshClient *ssh.Client, instanceID _, _, err := sshClient.RunCommand(ctx, checkCmd) if err != nil { fmt.Printf("MicroK8s not found or not ready, attempting to install on instance %s\n", instanceID) + + // Ensure snap is available, install snapd if not + _, _, snapErr := sshClient.RunCommand(ctx, "snap --version") + if snapErr != nil { + fmt.Printf("snap not found, installing snapd on instance %s\n", instanceID) + _, stderr, installErr := sshClient.RunCommand(ctx, "sudo apt-get update && sudo apt-get install -y snapd") + if installErr != nil { + return "", fmt.Errorf("failed to install snapd: %w, stderr: %s", installErr, stderr) + } + } + _, stderr, installErr := sshClient.RunCommand(ctx, "sudo snap install microk8s --classic") if installErr != nil { return "", fmt.Errorf("microk8s not available and failed to install: %w, stderr: %s", installErr, stderr) diff --git a/v1/providers/sfcompute/instancetype.go b/v1/providers/sfcompute/instancetype.go index 6858e93f..515f5efa 100644 --- a/v1/providers/sfcompute/instancetype.go +++ b/v1/providers/sfcompute/instancetype.go @@ -3,7 +3,6 @@ package v1 import ( "context" "fmt" - "slices" "strings" "time" @@ -24,8 +23,6 @@ const ( diskTypeSSD = "ssd" ) -var allowedZones = []string{"hayesvalley", "yerba"} - func makeDefaultInstanceTypePrice(amount string, currencyCode string) currency.Amount { instanceTypePrice, err := currency.NewAmount(amount, currencyCode) if err != nil { @@ -186,12 +183,7 @@ func (c *SFCClient) getZones(ctx context.Context, includeUnavailable bool) ([]sf zones := make([]sfcnodes.ZoneListResponseData, 0, len(resp.Data)) for _, zone := range resp.Data { - // If the zone is not allowed, skip it - if !slices.Contains(allowedZones, strings.ToLower(zone.Name)) { - continue - } - - // If the there is no available capacity, and skip it + // If the there is no available capacity, skip it if len(zone.AvailableCapacity) == 0 && !includeUnavailable { continue } diff --git a/v1/providers/sfcompute/validation_test.go b/v1/providers/sfcompute/validation_test.go index 196c7397..cd0a12da 100644 --- a/v1/providers/sfcompute/validation_test.go +++ b/v1/providers/sfcompute/validation_test.go @@ -16,8 +16,7 @@ func TestValidationFunctions(t *testing.T) { config := validation.ProviderConfig{ Credential: NewSFCCredential("validation-test", apiKey), StableIDs: []v1.InstanceTypeID{ - "hayesvalley-noSub-h100", - "yerba-noSub-h100", + "richmond-noSub-h100", }, }