mirror of https://github.com/k3s-io/k3s
Merge pull request #69711 from wgliang/cleanup/rename-recognize-region
AWS: unexport unnecessarily exported methods and variables about reco…pull/58/head
commit
02cca1f11a
|
@ -260,7 +260,7 @@ const MaxReadThenCreateRetries = 30
|
|||
// need hardcoded defaults.
|
||||
const DefaultVolumeType = "gp2"
|
||||
|
||||
// Used to call RecognizeWellKnownRegions just once
|
||||
// Used to call recognizeWellKnownRegions just once
|
||||
var once sync.Once
|
||||
|
||||
// AWS implements PVLabeler.
|
||||
|
@ -1063,7 +1063,7 @@ func newAWSCloud(cfg CloudConfig, awsServices Services) (*Cloud, error) {
|
|||
|
||||
// Trust that if we get a region from configuration or AWS metadata that it is valid,
|
||||
// and register ECR providers
|
||||
RecognizeRegion(regionName)
|
||||
recognizeRegion(regionName)
|
||||
|
||||
if !cfg.Global.DisableStrictZoneCheck {
|
||||
valid := isRegionValid(regionName)
|
||||
|
@ -1152,7 +1152,7 @@ func newAWSCloud(cfg CloudConfig, awsServices Services) (*Cloud, error) {
|
|||
|
||||
// Register regions, in particular for ECR credentials
|
||||
once.Do(func() {
|
||||
RecognizeWellKnownRegions()
|
||||
recognizeWellKnownRegions()
|
||||
})
|
||||
|
||||
return awsCloud, nil
|
||||
|
|
|
@ -23,9 +23,9 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
// WellKnownRegions is the complete list of regions known to the AWS cloudprovider
|
||||
// wellKnownRegions is the complete list of regions known to the AWS cloudprovider
|
||||
// and credentialprovider.
|
||||
var WellKnownRegions = [...]string{
|
||||
var wellKnownRegions = [...]string{
|
||||
// from `aws ec2 describe-regions --region us-east-1 --query Regions[].RegionName | sort`
|
||||
"ap-northeast-1",
|
||||
"ap-northeast-2",
|
||||
|
@ -53,12 +53,12 @@ var awsRegionsMutex sync.Mutex
|
|||
// awsRegions is a set of recognized regions
|
||||
var awsRegions sets.String
|
||||
|
||||
// RecognizeRegion is called for each AWS region we know about.
|
||||
// recognizeRegion is called for each AWS region we know about.
|
||||
// It currently registers a credential provider for that region.
|
||||
// There are two paths to discovering a region:
|
||||
// * we hard-code some well-known regions
|
||||
// * if a region is discovered from instance metadata, we add that
|
||||
func RecognizeRegion(region string) {
|
||||
func recognizeRegion(region string) {
|
||||
awsRegionsMutex.Lock()
|
||||
defer awsRegionsMutex.Unlock()
|
||||
|
||||
|
@ -78,10 +78,10 @@ func RecognizeRegion(region string) {
|
|||
awsRegions.Insert(region)
|
||||
}
|
||||
|
||||
// RecognizeWellKnownRegions calls RecognizeRegion on each WellKnownRegion
|
||||
func RecognizeWellKnownRegions() {
|
||||
for _, region := range WellKnownRegions {
|
||||
RecognizeRegion(region)
|
||||
// recognizeWellKnownRegions calls RecognizeRegion on each WellKnownRegion
|
||||
func recognizeWellKnownRegions() {
|
||||
for _, region := range wellKnownRegions {
|
||||
recognizeRegion(region)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
|
||||
// TestRegions does basic checking of region verification / addition
|
||||
func TestRegions(t *testing.T) {
|
||||
RecognizeWellKnownRegions()
|
||||
recognizeWellKnownRegions()
|
||||
|
||||
tests := []struct {
|
||||
Add string
|
||||
|
@ -55,7 +55,7 @@ func TestRegions(t *testing.T) {
|
|||
|
||||
for _, test := range tests {
|
||||
if test.Add != "" {
|
||||
RecognizeRegion(test.Add)
|
||||
recognizeRegion(test.Add)
|
||||
}
|
||||
|
||||
if test.Lookup != "" {
|
||||
|
|
Loading…
Reference in New Issue