Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions v1/instancetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
11 changes: 11 additions & 0 deletions v1/networking_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 1 addition & 9 deletions v1/providers/sfcompute/instancetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package v1
import (
"context"
"fmt"
"slices"
"strings"
"time"

Expand All @@ -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 {
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence still doesn't quite make sense 😆

if len(zone.AvailableCapacity) == 0 && !includeUnavailable {
continue
}
Expand Down
3 changes: 1 addition & 2 deletions v1/providers/sfcompute/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}

Expand Down
Loading