Skip to content

Commit

Permalink
Merge pull request #11 from Karthik-K-N/remove-upstream-k8
Browse files Browse the repository at this point in the history
Avoid importing upstream k8s packages
  • Loading branch information
Power Cloud Robot authored Jun 4, 2024
2 parents dde6dbd + c57fe5e commit 5884530
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ module github.com/ppc64le-cloud/powervs-utils
go 1.21

toolchain go1.21.4

require k8s.io/apimachinery v0.29.1
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc=
k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU=
31 changes: 10 additions & 21 deletions region.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package utils
import (
"fmt"
"strings"

"k8s.io/apimachinery/pkg/util/sets"
)

func GetRegion(zone string) (region string, err error) {
Expand Down Expand Up @@ -57,11 +55,11 @@ var Regions = map[string]Region{
Description: "Dallas, USA",
VPCRegion: "us-south",
COSRegion: "us-south",
Zones: []string{
Zones: []string{
"dal10",
"dal12",
},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980"},
},
"eu-de": {
Description: "Frankfurt, Germany",
Expand All @@ -71,7 +69,7 @@ var Regions = map[string]Region{
"eu-de-1",
"eu-de-2",
},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980"},
},
"lon": {
Description: "London, UK.",
Expand All @@ -81,17 +79,17 @@ var Regions = map[string]Region{
"lon04",
"lon06",
},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980"},
},
"mad": {
Description: "Madrid, Spain",
VPCRegion: "eu-es",
COSRegion: "eu-de", // @HACK - PowerVS says COS not supported in this region
COSRegion: "eu-de", // @HACK - PowerVS says COS not supported in this region
Zones: []string{
"mad02",
"mad04",
},
SysTypes: []string{"s1022"},
SysTypes: []string{"s1022"},
},
"mon": {
Description: "Montreal, Canada",
Expand All @@ -115,17 +113,17 @@ var Regions = map[string]Region{
"syd04",
"syd05",
},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980"},
},
"sao": {
Description: "São Paulo, Brazil",
VPCRegion: "br-sao",
COSRegion: "br-sao",
Zones: []string{
Zones: []string{
"sao01",
"sao04",
},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980"},
},
"tok": {
Description: "Tokyo, Japan",
Expand All @@ -149,7 +147,7 @@ var Regions = map[string]Region{
"wdc06",
"wdc07",
},
SysTypes: []string{"s922", "e980"},
SysTypes: []string{"s922", "e980"},
},
}

Expand Down Expand Up @@ -254,12 +252,3 @@ func AvailableSysTypes(region string) ([]string, error) {
}
return knownRegion.SysTypes, nil
}

// AllKnownSysTypes returns aggregated known system types from all regions.
func AllKnownSysTypes() sets.Set[string] {
sysTypes := sets.New[string]()
for _, region := range Regions {
sysTypes.Insert(region.SysTypes...)
}
return sysTypes
}

0 comments on commit 5884530

Please sign in to comment.