Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a9beb4f9
Commit
a9beb4f9
authored
Oct 12, 2018
by
Guoliang Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AWS: unexport unnecessarily exported methods and variables about recognize region
parent
cdf264ca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
aws.go
pkg/cloudprovider/providers/aws/aws.go
+3
-3
regions.go
pkg/cloudprovider/providers/aws/regions.go
+8
-8
regions_test.go
pkg/cloudprovider/providers/aws/regions_test.go
+2
-2
No files found.
pkg/cloudprovider/providers/aws/aws.go
View file @
a9beb4f9
...
...
@@ -260,7 +260,7 @@ const MaxReadThenCreateRetries = 30
// need hardcoded defaults.
const
DefaultVolumeType
=
"gp2"
// Used to call
R
ecognizeWellKnownRegions just once
// Used to call
r
ecognizeWellKnownRegions 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
R
ecognizeRegion
(
regionName
)
r
ecognizeRegion
(
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
()
{
R
ecognizeWellKnownRegions
()
r
ecognizeWellKnownRegions
()
})
return
awsCloud
,
nil
...
...
pkg/cloudprovider/providers/aws/regions.go
View file @
a9beb4f9
...
...
@@ -23,9 +23,9 @@ import (
"sync"
)
//
W
ellKnownRegions is the complete list of regions known to the AWS cloudprovider
//
w
ellKnownRegions is the complete list of regions known to the AWS cloudprovider
// and credentialprovider.
var
W
ellKnownRegions
=
[
...
]
string
{
var
w
ellKnownRegions
=
[
...
]
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
//
R
ecognizeRegion is called for each AWS region we know about.
//
r
ecognizeRegion 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
R
ecognizeRegion
(
region
string
)
{
func
r
ecognizeRegion
(
region
string
)
{
awsRegionsMutex
.
Lock
()
defer
awsRegionsMutex
.
Unlock
()
...
...
@@ -78,10 +78,10 @@ func RecognizeRegion(region string) {
awsRegions
.
Insert
(
region
)
}
//
R
ecognizeWellKnownRegions calls RecognizeRegion on each WellKnownRegion
func
R
ecognizeWellKnownRegions
()
{
for
_
,
region
:=
range
W
ellKnownRegions
{
R
ecognizeRegion
(
region
)
//
r
ecognizeWellKnownRegions calls RecognizeRegion on each WellKnownRegion
func
r
ecognizeWellKnownRegions
()
{
for
_
,
region
:=
range
w
ellKnownRegions
{
r
ecognizeRegion
(
region
)
}
}
...
...
pkg/cloudprovider/providers/aws/regions_test.go
View file @
a9beb4f9
...
...
@@ -22,7 +22,7 @@ import (
// TestRegions does basic checking of region verification / addition
func
TestRegions
(
t
*
testing
.
T
)
{
R
ecognizeWellKnownRegions
()
r
ecognizeWellKnownRegions
()
tests
:=
[]
struct
{
Add
string
...
...
@@ -55,7 +55,7 @@ func TestRegions(t *testing.T) {
for
_
,
test
:=
range
tests
{
if
test
.
Add
!=
""
{
R
ecognizeRegion
(
test
.
Add
)
r
ecognizeRegion
(
test
.
Add
)
}
if
test
.
Lookup
!=
""
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment