From 0e6f76c8fe3fd5490cdf2ee1c110a0df45d1723a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Wr=C3=B3blewski?= Date: Wed, 13 Nov 2024 16:22:34 +0000 Subject: [PATCH] Add flag to force remove long unregistered nodes --- .../aws/aws-sdk-go/aws/awserr/error.go | 80 +++--- .../aws-sdk-go/aws/client/default_retryer.go | 1 - .../aws/corehandlers/awsinternal.go | 2 +- .../aws/credentials/chain_provider.go | 23 +- .../aws-sdk-go/aws/credentials/credentials.go | 51 ++-- .../ec2rolecreds/ec2_role_provider.go | 20 +- .../aws/credentials/endpointcreds/provider.go | 31 +-- .../aws/credentials/plugincreds/provider.go | 94 +++---- .../aws/credentials/processcreds/provider.go | 46 ++-- .../aws/credentials/ssocreds/doc.go | 54 ++-- .../credentials/ssocreds/sso_cached_token.go | 2 +- .../aws/aws-sdk-go/aws/csm/doc.go | 58 ++--- .../aws/aws-sdk-go/aws/csm/enable.go | 22 +- .../aws/aws-sdk-go/aws/csm/reporter.go | 18 +- .../cloudprovider/aws/aws-sdk-go/aws/doc.go | 32 +-- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 8 +- .../aws/aws-sdk-go/aws/logger.go | 7 +- .../aws/aws-sdk-go/aws/request/request.go | 16 +- .../aws/request/request_pagination.go | 20 +- .../aws/request/timeout_read_closer.go | 2 +- .../aws/aws-sdk-go/aws/session/doc.go | 142 ++++++----- .../aws/aws-sdk-go/awstesting/assert.go | 2 +- .../awstesting/cmd/bucket_cleanup/main.go | 3 +- .../aws/aws-sdk-go/internal/ini/doc.go | 53 ++-- .../aws-sdk-go/internal/ini/literal_tokens.go | 6 +- .../internal/s3shared/arn/accesspoint_arn.go | 5 +- .../internal/s3shared/arn/outpost_arn.go | 10 +- .../aws/aws-sdk-go/internal/sdkmath/floor.go | 1 + .../internal/sdkmath/floor_go1.9.go | 1 + .../aws/aws-sdk-go/private/model/api/api.go | 4 +- .../private/model/api/legacy_jsonvalue.go | 142 +++++------ .../aws/aws-sdk-go/private/model/api/load.go | 10 +- .../private/model/cli/gen-endpoints/main.go | 7 +- .../eventstream/eventstreamtest/testing.go | 2 +- .../cloudprovider/cloud_provider.go | 2 +- .../config/autoscaling_options.go | 2 + cluster-autoscaler/core/static_autoscaler.go | 41 +-- .../core/static_autoscaler_test.go | 234 +++++++++--------- cluster-autoscaler/main.go | 2 + 39 files changed, 639 insertions(+), 617 deletions(-) diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/awserr/error.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/awserr/error.go index 99849c0e19c0..1e876ffe8f2c 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/awserr/error.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/awserr/error.go @@ -10,24 +10,23 @@ package awserr // // Example: // -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if awsErr, ok := err.(awserr.Error); ok { -// // Get error details -// log.Println("Error:", awsErr.Code(), awsErr.Message()) -// -// // Prints out full error message, including original error if there was one. -// log.Println("Error:", awsErr.Error()) -// -// // Get original error -// if origErr := awsErr.OrigErr(); origErr != nil { -// // operate on original error. -// } -// } else { -// fmt.Println(err.Error()) -// } -// } -// +// output, err := s3manage.Upload(svc, input, opts) +// if err != nil { +// if awsErr, ok := err.(awserr.Error); ok { +// // Get error details +// log.Println("Error:", awsErr.Code(), awsErr.Message()) +// +// // Prints out full error message, including original error if there was one. +// log.Println("Error:", awsErr.Error()) +// +// // Get original error +// if origErr := awsErr.OrigErr(); origErr != nil { +// // operate on original error. +// } +// } else { +// fmt.Println(err.Error()) +// } +// } type Error interface { // Satisfy the generic error interface. error @@ -100,32 +99,31 @@ func NewBatchError(code, message string, errs []error) BatchedErrors { // // Example: // -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if reqerr, ok := err.(RequestFailure); ok { -// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) -// } else { -// log.Println("Error:", err.Error()) -// } -// } +// output, err := s3manage.Upload(svc, input, opts) +// if err != nil { +// if reqerr, ok := err.(RequestFailure); ok { +// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) +// } else { +// log.Println("Error:", err.Error()) +// } +// } // // Combined with awserr.Error: // -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if awsErr, ok := err.(awserr.Error); ok { -// // Generic AWS Error with Code, Message, and original error (if any) -// fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) -// -// if reqErr, ok := err.(awserr.RequestFailure); ok { -// // A service error occurred -// fmt.Println(reqErr.StatusCode(), reqErr.RequestID()) -// } -// } else { -// fmt.Println(err.Error()) -// } -// } -// +// output, err := s3manage.Upload(svc, input, opts) +// if err != nil { +// if awsErr, ok := err.(awserr.Error); ok { +// // Generic AWS Error with Code, Message, and original error (if any) +// fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) +// +// if reqErr, ok := err.(awserr.RequestFailure); ok { +// // A service error occurred +// fmt.Println(reqErr.StatusCode(), reqErr.RequestID()) +// } +// } else { +// fmt.Println(err.Error()) +// } +// } type RequestFailure interface { Error diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/client/default_retryer.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/client/default_retryer.go index 4d2f7d7b100d..784a0144f0d9 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/client/default_retryer.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/client/default_retryer.go @@ -12,7 +12,6 @@ import ( // DefaultRetryer implements basic retry logic using exponential backoff for // most services. If you want to implement custom retry logic, you can implement the // request.Retryer interface. -// type DefaultRetryer struct { // Num max Retries is the number of max retries that will be performed. // By default, this is zero. diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/corehandlers/awsinternal.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/corehandlers/awsinternal.go index 140242dd1b8d..ec6fb00e6ab1 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/corehandlers/awsinternal.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/corehandlers/awsinternal.go @@ -1,4 +1,4 @@ // DO NOT EDIT package corehandlers -const isAwsInternal = "" \ No newline at end of file +const isAwsInternal = "" diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/chain_provider.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/chain_provider.go index 3348aed28124..28bad8364a97 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/chain_provider.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/chain_provider.go @@ -37,19 +37,18 @@ var ( // does not return any credentials ChainProvider will return the error // ErrNoValidProvidersFoundInChain // -// creds := credentials.NewChainCredentials( -// []credentials.Provider{ -// &credentials.EnvProvider{}, -// &ec2rolecreds.EC2RoleProvider{ -// Client: ec2metadata.New(sess), -// }, -// }) -// -// // Usage of ChainCredentials with aws.Config -// svc := ec2.New(session.Must(session.NewSession(&aws.Config{ -// Credentials: creds, -// }))) +// creds := credentials.NewChainCredentials( +// []credentials.Provider{ +// &credentials.EnvProvider{}, +// &ec2rolecreds.EC2RoleProvider{ +// Client: ec2metadata.New(sess), +// }, +// }) // +// // Usage of ChainCredentials with aws.Config +// svc := ec2.New(session.Must(session.NewSession(&aws.Config{ +// Credentials: creds, +// }))) type ChainProvider struct { Providers []Provider curr Provider diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/credentials.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/credentials.go index 89a733428b88..74f204d27a0a 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/credentials.go @@ -14,38 +14,36 @@ // // Example of using the environment variable credentials. // -// creds := credentials.NewEnvCredentials() +// creds := credentials.NewEnvCredentials() // -// // Retrieve the credentials value -// credValue, err := creds.Get() -// if err != nil { -// // handle error -// } +// // Retrieve the credentials value +// credValue, err := creds.Get() +// if err != nil { +// // handle error +// } // // Example of forcing credentials to expire and be refreshed on the next Get(). // This may be helpful to proactively expire credentials and refresh them sooner // than they would naturally expire on their own. // -// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{}) -// creds.Expire() -// credsValue, err := creds.Get() -// // New credentials will be retrieved instead of from cache. +// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{}) +// creds.Expire() +// credsValue, err := creds.Get() +// // New credentials will be retrieved instead of from cache. // -// -// Custom Provider +// # Custom Provider // // Each Provider built into this package also provides a helper method to generate // a Credentials pointer setup with the provider. To use a custom Provider just // create a type which satisfies the Provider interface and pass it to the // NewCredentials method. // -// type MyProvider struct{} -// func (m *MyProvider) Retrieve() (Value, error) {...} -// func (m *MyProvider) IsExpired() bool {...} -// -// creds := credentials.NewCredentials(&MyProvider{}) -// credValue, err := creds.Get() +// type MyProvider struct{} +// func (m *MyProvider) Retrieve() (Value, error) {...} +// func (m *MyProvider) IsExpired() bool {...} // +// creds := credentials.NewCredentials(&MyProvider{}) +// credValue, err := creds.Get() package credentials import ( @@ -64,10 +62,10 @@ import ( // when making service API calls. For example, when accessing public // s3 buckets. // -// svc := s3.New(session.Must(session.NewSession(&aws.Config{ -// Credentials: credentials.AnonymousCredentials, -// }))) -// // Access public S3 buckets. +// svc := s3.New(session.Must(session.NewSession(&aws.Config{ +// Credentials: credentials.AnonymousCredentials, +// }))) +// // Access public S3 buckets. var AnonymousCredentials = NewStaticCredentials("", "", "") // A Value is the AWS credentials value for individual credential fields. @@ -150,10 +148,11 @@ func (p ErrorProvider) IsExpired() bool { // provider's struct. // // Example: -// type EC2RoleProvider struct { -// Expiry -// ... -// } +// +// type EC2RoleProvider struct { +// Expiry +// ... +// } type Expiry struct { // The date/time when to expire on expiration time.Time diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go index ff60f4c28acd..fcb327f9959f 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go @@ -25,17 +25,17 @@ const ProviderName = "EC2RoleProvider" // Example how to configure the EC2RoleProvider with custom http Client, Endpoint // or ExpiryWindow // -// p := &ec2rolecreds.EC2RoleProvider{ -// // Pass in a custom timeout to be used when requesting -// // IAM EC2 Role credentials. -// Client: ec2metadata.New(sess, aws.Config{ -// HTTPClient: &http.Client{Timeout: 10 * time.Second}, -// }), +// p := &ec2rolecreds.EC2RoleProvider{ +// // Pass in a custom timeout to be used when requesting +// // IAM EC2 Role credentials. +// Client: ec2metadata.New(sess, aws.Config{ +// HTTPClient: &http.Client{Timeout: 10 * time.Second}, +// }), // -// // Do not use early expiry of credentials. If a non zero value is -// // specified the credentials will be expired early -// ExpiryWindow: 0, -// } +// // Do not use early expiry of credentials. If a non zero value is +// // specified the credentials will be expired early +// ExpiryWindow: 0, +// } type EC2RoleProvider struct { credentials.Expiry diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go index 1e30db39160b..f15b3e5c973c 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go @@ -7,26 +7,29 @@ // // Static credentials will never expire once they have been retrieved. The format // of the static credentials response: -// { -// "AccessKeyId" : "MUA...", -// "SecretAccessKey" : "/7PC5om....", -// } +// +// { +// "AccessKeyId" : "MUA...", +// "SecretAccessKey" : "/7PC5om....", +// } // // Refreshable credentials will expire within the "ExpiryWindow" of the Expiration // value in the response. The format of the refreshable credentials response: -// { -// "AccessKeyId" : "MUA...", -// "SecretAccessKey" : "/7PC5om....", -// "Token" : "AQoDY....=", -// "Expiration" : "2016-02-25T06:03:31Z" -// } +// +// { +// "AccessKeyId" : "MUA...", +// "SecretAccessKey" : "/7PC5om....", +// "Token" : "AQoDY....=", +// "Expiration" : "2016-02-25T06:03:31Z" +// } // // Errors should be returned in the following format and only returned with 400 // or 500 HTTP status codes. -// { -// "code": "ErrorCode", -// "message": "Helpful error message." -// } +// +// { +// "code": "ErrorCode", +// "message": "Helpful error message." +// } package endpointcreds import ( diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go index 714c13ef5e76..ebc70fb52eb3 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go @@ -7,7 +7,7 @@ // // As of Go 1.8 plugins are only supported on the Linux platform. // -// Plugin Symbol Name +// # Plugin Symbol Name // // The "GetAWSSDKCredentialProvider" is the symbol name that will be used to // lookup the credentials provider getter from the plugin. If you want to use a @@ -18,52 +18,52 @@ // retrieve the credentials, and another to determine if the credentials have // expired. // -// Plugin Symbol Signature +// # Plugin Symbol Signature // // The plugin credential provider requires the symbol to match the // following signature. // -// func() (RetrieveFn func() (key, secret, token string, err error), IsExpiredFn func() bool) +// func() (RetrieveFn func() (key, secret, token string, err error), IsExpiredFn func() bool) // -// Plugin Implementation Example +// # Plugin Implementation Example // // The following is an example implementation of a SDK credential provider using // the plugin provider in this package. See the SDK's example/aws/credential/plugincreds/plugin // folder for a runnable example of this. // -// package main +// package main // -// func main() {} +// func main() {} // -// var myCredProvider provider +// var myCredProvider provider // -// // Build: go build -o plugin.so -buildmode=plugin plugin.go -// func init() { -// // Initialize a mock credential provider with stubs -// myCredProvider = provider{"a","b","c"} -// } +// // Build: go build -o plugin.so -buildmode=plugin plugin.go +// func init() { +// // Initialize a mock credential provider with stubs +// myCredProvider = provider{"a","b","c"} +// } // -// // GetAWSSDKCredentialProvider is the symbol SDK will lookup and use to -// // get the credential provider's retrieve and isExpired functions. -// func GetAWSSDKCredentialProvider() (func() (key, secret, token string, err error), func() bool) { -// return myCredProvider.Retrieve, myCredProvider.IsExpired -// } +// // GetAWSSDKCredentialProvider is the symbol SDK will lookup and use to +// // get the credential provider's retrieve and isExpired functions. +// func GetAWSSDKCredentialProvider() (func() (key, secret, token string, err error), func() bool) { +// return myCredProvider.Retrieve, myCredProvider.IsExpired +// } // -// // mock implementation of a type that returns retrieves credentials and -// // returns if they have expired. -// type provider struct { -// key, secret, token string -// } +// // mock implementation of a type that returns retrieves credentials and +// // returns if they have expired. +// type provider struct { +// key, secret, token string +// } // -// func (p provider) Retrieve() (key, secret, token string, err error) { -// return p.key, p.secret, p.token, nil -// } +// func (p provider) Retrieve() (key, secret, token string, err error) { +// return p.key, p.secret, p.token, nil +// } // -// func (p *provider) IsExpired() bool { -// return false; -// } +// func (p *provider) IsExpired() bool { +// return false; +// } // -// Configuring SDK for Plugin Credentials +// # Configuring SDK for Plugin Credentials // // To configure the SDK to use a plugin's credential provider you'll need to first // open the plugin file using the plugin standard library package. Once you have @@ -72,24 +72,24 @@ // credentials loader of a Session or Config. See the SDK's example/aws/credential/plugincreds // folder for a runnable example of this. // -// // Open plugin, and load it into the process. -// p, err := plugin.Open("somefile.so") -// if err != nil { -// return nil, err -// } -// -// // Create a new Credentials value which will source the provider's Retrieve -// // and IsExpired functions from the plugin. -// creds, err := plugincreds.NewCredentials(p) -// if err != nil { -// return nil, err -// } -// -// // Example to configure a Session with the newly created credentials that -// // will be sourced using the plugin's functionality. -// sess := session.Must(session.NewSession(&aws.Config{ -// Credentials: creds, -// })) +// // Open plugin, and load it into the process. +// p, err := plugin.Open("somefile.so") +// if err != nil { +// return nil, err +// } +// +// // Create a new Credentials value which will source the provider's Retrieve +// // and IsExpired functions from the plugin. +// creds, err := plugincreds.NewCredentials(p) +// if err != nil { +// return nil, err +// } +// +// // Example to configure a Session with the newly created credentials that +// // will be sourced using the plugin's functionality. +// sess := session.Must(session.NewSession(&aws.Config{ +// Credentials: creds, +// })) package plugincreds import ( diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/processcreds/provider.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/processcreds/provider.go index 2097a616a78c..6047724a87bc 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/processcreds/provider.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/processcreds/provider.go @@ -15,52 +15,52 @@ location, with the `credential_process` key and the command you want to be called. You also need to set the AWS_SDK_LOAD_CONFIG environment variable (e.g., `export AWS_SDK_LOAD_CONFIG=1`) to use the shared config file. - [default] - credential_process = /command/to/call + [default] + credential_process = /command/to/call Creating a new session will use the credential process to retrieve credentials. NOTE: If there are credentials in the profile you are using, the credential process will not be used. - // Initialize a session to load credentials. - sess, _ := session.NewSession(&aws.Config{ - Region: aws.String("us-east-1")}, - ) + // Initialize a session to load credentials. + sess, _ := session.NewSession(&aws.Config{ + Region: aws.String("us-east-1")}, + ) - // Create S3 service client to use the credentials. - svc := s3.New(sess) + // Create S3 service client to use the credentials. + svc := s3.New(sess) Another way to use the `credential_process` method is by using `credentials.NewCredentials()` and providing a command to be executed to retrieve credentials: - // Create credentials using the ProcessProvider. - creds := processcreds.NewCredentials("/path/to/command") + // Create credentials using the ProcessProvider. + creds := processcreds.NewCredentials("/path/to/command") - // Create service client value configured for credentials. - svc := s3.New(sess, &aws.Config{Credentials: creds}) + // Create service client value configured for credentials. + svc := s3.New(sess, &aws.Config{Credentials: creds}) You can set a non-default timeout for the `credential_process` with another constructor, `credentials.NewCredentialsTimeout()`, providing the timeout. To set a one minute timeout: - // Create credentials using the ProcessProvider. - creds := processcreds.NewCredentialsTimeout( - "/path/to/command", - time.Duration(500) * time.Millisecond) + // Create credentials using the ProcessProvider. + creds := processcreds.NewCredentialsTimeout( + "/path/to/command", + time.Duration(500) * time.Millisecond) If you need more control, you can set any configurable options in the credentials using one or more option functions. For example, you can set a two minute timeout, a credential duration of 60 minutes, and a maximum stdout buffer size of 2k. - creds := processcreds.NewCredentials( - "/path/to/command", - func(opt *ProcessProvider) { - opt.Timeout = time.Duration(2) * time.Minute - opt.Duration = time.Duration(60) * time.Minute - opt.MaxBufSize = 2048 - }) + creds := processcreds.NewCredentials( + "/path/to/command", + func(opt *ProcessProvider) { + opt.Timeout = time.Duration(2) * time.Minute + opt.Duration = time.Duration(60) * time.Minute + opt.MaxBufSize = 2048 + }) You can also use your own `exec.Cmd`: diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/doc.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/doc.go index 18c940ab3c36..e531c45533d8 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/doc.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/doc.go @@ -5,54 +5,54 @@ // some other mechanism. The provider must find a valid non-expired access token for the AWS SSO user portal URL in // ~/.aws/sso/cache. If a cached token is not found, it is expired, or the file is malformed an error will be returned. // -// Loading AWS SSO credentials with the AWS shared configuration file +// # Loading AWS SSO credentials with the AWS shared configuration file // // You can use configure AWS SSO credentials from the AWS shared configuration file by // providing the specifying the required keys in the profile: // -// sso_account_id -// sso_region -// sso_role_name -// sso_start_url +// sso_account_id +// sso_region +// sso_role_name +// sso_start_url // // For example, the following defines a profile "devsso" and specifies the AWS SSO parameters that defines the target // account, role, sign-on portal, and the region where the user portal is located. Note: all SSO arguments must be // provided, or an error will be returned. // -// [profile devsso] -// sso_start_url = https://my-sso-portal.awsapps.com/start -// sso_role_name = SSOReadOnlyRole -// sso_region = us-east-1 -// sso_account_id = 123456789012 +// [profile devsso] +// sso_start_url = https://my-sso-portal.awsapps.com/start +// sso_role_name = SSOReadOnlyRole +// sso_region = us-east-1 +// sso_account_id = 123456789012 // // Using the config module, you can load the AWS SDK shared configuration, and specify that this profile be used to // retrieve credentials. For example: // -// sess, err := session.NewSessionWithOptions(session.Options{ -// SharedConfigState: session.SharedConfigEnable, -// Profile: "devsso", -// }) -// if err != nil { -// return err -// } +// sess, err := session.NewSessionWithOptions(session.Options{ +// SharedConfigState: session.SharedConfigEnable, +// Profile: "devsso", +// }) +// if err != nil { +// return err +// } // -// Programmatically loading AWS SSO credentials directly +// # Programmatically loading AWS SSO credentials directly // // You can programmatically construct the AWS SSO Provider in your application, and provide the necessary information // to load and retrieve temporary credentials using an access token from ~/.aws/sso/cache. // -// svc := sso.New(sess, &aws.Config{ -// Region: aws.String("us-west-2"), // Client Region must correspond to the AWS SSO user portal region -// }) +// svc := sso.New(sess, &aws.Config{ +// Region: aws.String("us-west-2"), // Client Region must correspond to the AWS SSO user portal region +// }) // -// provider := ssocreds.NewCredentialsWithClient(svc, "123456789012", "SSOReadOnlyRole", "https://my-sso-portal.awsapps.com/start") +// provider := ssocreds.NewCredentialsWithClient(svc, "123456789012", "SSOReadOnlyRole", "https://my-sso-portal.awsapps.com/start") // -// credentials, err := provider.Get() -// if err != nil { -// return err -// } +// credentials, err := provider.Get() +// if err != nil { +// return err +// } // -// Additional Resources +// # Additional Resources // // Configuring the AWS CLI to use AWS Single Sign-On: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html // diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/sso_cached_token.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/sso_cached_token.go index 54e59f0a2f81..7c8ca837432f 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/sso_cached_token.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ssocreds/sso_cached_token.go @@ -5,8 +5,8 @@ import ( "encoding/hex" "encoding/json" "fmt" - "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/shareddefaults" "io/ioutil" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/shareddefaults" "os" "path/filepath" "strconv" diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/doc.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/doc.go index 25a66d1dda22..7c7780f0616b 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/doc.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/doc.go @@ -3,7 +3,7 @@ // control options, and configuration for the CSM client. The client can be // controlled manually, or automatically via the SDK's Session configuration. // -// Enabling CSM client via SDK's Session configuration +// # Enabling CSM client via SDK's Session configuration // // The CSM client can be enabled automatically via SDK's Session configuration. // The SDK's session configuration enables the CSM client if the AWS_CSM_PORT @@ -12,39 +12,39 @@ // The configuration options for the CSM client via the SDK's session // configuration are: // -// * AWS_CSM_PORT= -// The port number the CSM agent will receive metrics on. +// - AWS_CSM_PORT= +// The port number the CSM agent will receive metrics on. // -// * AWS_CSM_HOST= -// The hostname, or IP address the CSM agent will receive metrics on. -// Without port number. +// - AWS_CSM_HOST= +// The hostname, or IP address the CSM agent will receive metrics on. +// Without port number. // -// Manually enabling the CSM client +// # Manually enabling the CSM client // // The CSM client can be started, paused, and resumed manually. The Start // function will enable the CSM client to publish metrics to the CSM agent. It // is safe to call Start concurrently, but if Start is called additional times // with different ClientID or address it will panic. // -// r, err := csm.Start("clientID", ":31000") -// if err != nil { -// panic(fmt.Errorf("failed starting CSM: %v", err)) -// } +// r, err := csm.Start("clientID", ":31000") +// if err != nil { +// panic(fmt.Errorf("failed starting CSM: %v", err)) +// } // // When controlling the CSM client manually, you must also inject its request // handlers into the SDK's Session configuration for the SDK's API clients to // publish metrics. // -// sess, err := session.NewSession(&aws.Config{}) -// if err != nil { -// panic(fmt.Errorf("failed loading session: %v", err)) -// } +// sess, err := session.NewSession(&aws.Config{}) +// if err != nil { +// panic(fmt.Errorf("failed loading session: %v", err)) +// } // -// // Add CSM client's metric publishing request handlers to the SDK's -// // Session Configuration. -// r.InjectHandlers(&sess.Handlers) +// // Add CSM client's metric publishing request handlers to the SDK's +// // Session Configuration. +// r.InjectHandlers(&sess.Handlers) // -// Controlling CSM client +// # Controlling CSM client // // Once the CSM client has been enabled the Get function will return a Reporter // value that you can use to pause and resume the metrics published to the CSM @@ -54,16 +54,16 @@ // The Pause method can be called to stop the CSM client publishing metrics to // the CSM agent. The Continue method will resume metric publishing. // -// // Get the CSM client Reporter. -// r := csm.Get() +// // Get the CSM client Reporter. +// r := csm.Get() // -// // Will pause monitoring -// r.Pause() -// resp, err = client.GetObject(&s3.GetObjectInput{ -// Bucket: aws.String("bucket"), -// Key: aws.String("key"), -// }) +// // Will pause monitoring +// r.Pause() +// resp, err = client.GetObject(&s3.GetObjectInput{ +// Bucket: aws.String("bucket"), +// Key: aws.String("key"), +// }) // -// // Resume monitoring -// r.Continue() +// // Resume monitoring +// r.Continue() package csm diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/enable.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/enable.go index 4b19e2800e3c..6f3222d43cad 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/enable.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/enable.go @@ -43,18 +43,18 @@ func AddressWithDefaults(host, port string) string { // start the metric listener once and will panic if a different // client ID or port is passed in. // -// r, err := csm.Start("clientID", "127.0.0.1:31000") -// if err != nil { -// panic(fmt.Errorf("expected no error, but received %v", err)) -// } -// sess := session.NewSession() -// r.InjectHandlers(sess.Handlers) +// r, err := csm.Start("clientID", "127.0.0.1:31000") +// if err != nil { +// panic(fmt.Errorf("expected no error, but received %v", err)) +// } +// sess := session.NewSession() +// r.InjectHandlers(sess.Handlers) // -// svc := s3.New(sess) -// out, err := svc.GetObject(&s3.GetObjectInput{ -// Bucket: aws.String("bucket"), -// Key: aws.String("key"), -// }) +// svc := s3.New(sess) +// out, err := svc.GetObject(&s3.GetObjectInput{ +// Bucket: aws.String("bucket"), +// Key: aws.String("key"), +// }) func Start(clientID string, url string) (*Reporter, error) { lock.Lock() defer lock.Unlock() diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/reporter.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/reporter.go index a5ad5999d5d7..3a1ec0f8954d 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/reporter.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/csm/reporter.go @@ -227,17 +227,17 @@ const ( // InjectHandlers is NOT safe to call concurrently. Calling InjectHandlers // multiple times may lead to unexpected behavior, (e.g. duplicate metrics). // -// // Start must be called in order to inject the correct handlers -// r, err := csm.Start("clientID", "127.0.0.1:8094") -// if err != nil { -// panic(fmt.Errorf("expected no error, but received %v", err)) -// } +// // Start must be called in order to inject the correct handlers +// r, err := csm.Start("clientID", "127.0.0.1:8094") +// if err != nil { +// panic(fmt.Errorf("expected no error, but received %v", err)) +// } // -// sess := session.NewSession() -// r.InjectHandlers(&sess.Handlers) +// sess := session.NewSession() +// r.InjectHandlers(&sess.Handlers) // -// // create a new service client with our client side metric session -// svc := s3.New(sess) +// // create a new service client with our client side metric session +// svc := s3.New(sess) func (rep *Reporter) InjectHandlers(handlers *request.Handlers) { if rep == nil { return diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/doc.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/doc.go index 4fcb6161848e..917618c75fb6 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/doc.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/doc.go @@ -1,7 +1,7 @@ // Package aws provides the core SDK's utilities and shared types. Use this package's // utilities to simplify setting and reading API operations parameters. // -// Value and Pointer Conversion Utilities +// # Value and Pointer Conversion Utilities // // This package includes a helper conversion utility for each scalar type the SDK's // API use. These utilities make getting a pointer of the scalar, and dereferencing @@ -16,33 +16,33 @@ // to get pointer of a literal string value, because getting the address of a // literal requires assigning the value to a variable first. // -// var strPtr *string +// var strPtr *string // -// // Without the SDK's conversion functions -// str := "my string" -// strPtr = &str +// // Without the SDK's conversion functions +// str := "my string" +// strPtr = &str // -// // With the SDK's conversion functions -// strPtr = aws.String("my string") +// // With the SDK's conversion functions +// strPtr = aws.String("my string") // -// // Convert *string to string value -// str = aws.StringValue(strPtr) +// // Convert *string to string value +// str = aws.StringValue(strPtr) // // In addition to scalars the aws package also includes conversion utilities for // map and slice for commonly types used in API parameters. The map and slice // conversion functions use similar naming pattern as the scalar conversion // functions. // -// var strPtrs []*string -// var strs []string = []string{"Go", "Gophers", "Go"} +// var strPtrs []*string +// var strs []string = []string{"Go", "Gophers", "Go"} // -// // Convert []string to []*string -// strPtrs = aws.StringSlice(strs) +// // Convert []string to []*string +// strPtrs = aws.StringSlice(strs) // -// // Convert []*string to []string -// strs = aws.StringValueSlice(strPtrs) +// // Convert []*string to []string +// strs = aws.StringValueSlice(strPtrs) // -// SDK Default HTTP Client +// # SDK Default HTTP Client // // The SDK will use the http.DefaultClient if a HTTP client is not provided to // the SDK's Session, or service client constructor. This means that if the diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/endpoints/defaults.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/endpoints/defaults.go index fca694c3f7c8..ce7e1169688b 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -89,10 +89,10 @@ func DefaultResolver() Resolver { // DefaultPartitions returns a list of the partitions the SDK is bundled // with. The available partitions are: AWS Standard, AWS China, AWS GovCloud (US), AWS ISO (US), AWS ISOB (US), AWS ISOE (Europe), and AWS ISOF. // -// partitions := endpoints.DefaultPartitions -// for _, p := range partitions { -// // ... inspect partitions -// } +// partitions := endpoints.DefaultPartitions +// for _, p := range partitions { +// // ... inspect partitions +// } func DefaultPartitions() []Partition { return defaultPartitions.Partitions() } diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/logger.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/logger.go index 49674cc79ebd..c8b8203e0cdc 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/logger.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/logger.go @@ -92,9 +92,10 @@ type Logger interface { // list of arguments and wrap it so the Logger interface can be used. // // Example: -// s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { -// fmt.Fprintln(os.Stdout, args...) -// })}) +// +// s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { +// fmt.Fprintln(os.Stdout, args...) +// })}) type LoggerFunc func(...interface{}) // Log calls the wrapped function with the arguments provided diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request.go index 5ab5fddd0121..b7532f35fa3f 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request.go @@ -182,11 +182,11 @@ type Option func(*Request) // // This Option can be used multiple times with a single API operation. // -// var id2, versionID string -// svc.PutObjectWithContext(ctx, params, -// request.WithGetResponseHeader("x-amz-id-2", &id2), -// request.WithGetResponseHeader("x-amz-version-id", &versionID), -// ) +// var id2, versionID string +// svc.PutObjectWithContext(ctx, params, +// request.WithGetResponseHeader("x-amz-id-2", &id2), +// request.WithGetResponseHeader("x-amz-version-id", &versionID), +// ) func WithGetResponseHeader(key string, val *string) Option { return func(r *Request) { r.Handlers.Complete.PushBack(func(req *Request) { @@ -199,8 +199,8 @@ func WithGetResponseHeader(key string, val *string) Option { // headers from the HTTP response and assign them to the passed in headers // variable. The passed in headers pointer must be non-nil. // -// var headers http.Header -// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) +// var headers http.Header +// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) func WithGetResponseHeaders(headers *http.Header) Option { return func(r *Request) { r.Handlers.Complete.PushBack(func(req *Request) { @@ -212,7 +212,7 @@ func WithGetResponseHeaders(headers *http.Header) Option { // WithLogLevel is a request option that will set the request to use a specific // log level when the request is made. // -// svc.PutObjectWithContext(ctx, params, request.WithLogLevel(aws.LogDebugWithHTTPBody) +// svc.PutObjectWithContext(ctx, params, request.WithLogLevel(aws.LogDebugWithHTTPBody) func WithLogLevel(l aws.LogLevelType) Option { return func(r *Request) { r.Config.LogLevel = aws.LogLevel(l) diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request_pagination.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request_pagination.go index 3a043a962002..ef1d71f1ed2f 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request_pagination.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/request_pagination.go @@ -17,14 +17,14 @@ import ( // does the pagination between API operations, and Paginator defines the // configuration that will be used per page request. // -// for p.Next() { -// data := p.Page().(*s3.ListObjectsOutput) -// // process the page's data -// // ... -// // break out of loop to stop fetching additional pages -// } +// for p.Next() { +// data := p.Page().(*s3.ListObjectsOutput) +// // process the page's data +// // ... +// // break out of loop to stop fetching additional pages +// } // -// return p.Err() +// return p.Err() // // See service client API operation Pages methods for examples how the SDK will // use the Pagination type. @@ -237,9 +237,9 @@ func (r *Request) NextPage() *Request { // EachPage iterates over each page of a paginated request object. The fn // parameter should be a function with the following sample signature: // -// func(page *T, lastPage bool) bool { -// return true // return false to stop iterating -// } +// func(page *T, lastPage bool) bool { +// return true // return false to stop iterating +// } // // Where "T" is the structure type matching the output structure of the given // operation. For example, a request object generated by diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/timeout_read_closer.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/timeout_read_closer.go index 694d154b1dfe..a04a20374bf8 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/timeout_read_closer.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/request/timeout_read_closer.go @@ -71,7 +71,7 @@ func adaptToResponseTimeoutError(req *Request) { // This will allow for per read timeouts. If a timeout occurred, we will return the // ErrCodeResponseTimeout. // -// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) +// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) func WithResponseReadTimeout(duration time.Duration) Option { return func(r *Request) { diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/session/doc.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/session/doc.go index ff3cc012ae37..3e53a8746113 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/session/doc.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/session/doc.go @@ -9,7 +9,7 @@ files each time the Session is created. Sharing the Session value across all of your service clients will ensure the configuration is loaded the fewest number of times possible. -Sessions options from Shared Config +# Sessions options from Shared Config By default NewSession will only load credentials from the shared credentials file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is @@ -19,27 +19,27 @@ values from the shared config (~/.aws/config) and shared credentials SharedConfigState set to SharedConfigEnable will create the session as if the AWS_SDK_LOAD_CONFIG environment variable was set. -Credential and config loading order +# Credential and config loading order The Session will attempt to load configuration and credentials from the environment, configuration files, and other credential sources. The order configuration is loaded in is: - * Environment Variables - * Shared Credentials file - * Shared Configuration file (if SharedConfig is enabled) - * EC2 Instance Metadata (credentials only) + - Environment Variables + - Shared Credentials file + - Shared Configuration file (if SharedConfig is enabled) + - EC2 Instance Metadata (credentials only) The Environment variables for credentials will have precedence over shared config even if SharedConfig is enabled. To override this behavior, and use shared config credentials instead specify the session.Options.Profile, (e.g. when using credential_source=Environment to assume a role). - sess, err := session.NewSessionWithOptions(session.Options{ - Profile: "myProfile", - }) + sess, err := session.NewSessionWithOptions(session.Options{ + Profile: "myProfile", + }) -Creating Sessions +# Creating Sessions Creating a Session without additional options will load credentials region, and profile loaded from the environment and shared config automatically. See, @@ -49,7 +49,6 @@ by Session. // Create Session sess, err := session.NewSession() - When creating Sessions optional aws.Config values can be passed in that will override the default, or loaded, config values the Session is being created with. This allows you to provide additional, or case based, configuration @@ -82,7 +81,7 @@ profile, or override the shared config state, (AWS_SDK_LOAD_CONFIG). SharedConfigState: session.SharedConfigEnable, }) -Adding Handlers +# Adding Handlers You can add handlers to a session to decorate API operation, (e.g. adding HTTP headers). All clients that use the Session receive a copy of the Session's @@ -99,7 +98,7 @@ every requests made. r.ClientInfo.ServiceName, r.Operation, r.Params) }) -Shared Config Fields +# Shared Config Fields By default the SDK will only load the shared credentials file's (~/.aws/credentials) credentials values, and all other config is provided by @@ -131,7 +130,7 @@ other two fields. ; region only supported if SharedConfigEnabled. region = us-east-1 -Assume Role configuration +# Assume Role configuration The role_arn field allows you to configure the SDK to assume an IAM role using a set of credentials from another source. Such as when paired with static @@ -146,19 +145,18 @@ specified, such as "source_profile", "credential_source", or mfa_serial = role_session_name = session_name - The SDK supports assuming a role with MFA token. If "mfa_serial" is set, you must also set the Session Option.AssumeRoleTokenProvider. The Session will fail to load if the AssumeRoleTokenProvider is not specified. - sess := session.Must(session.NewSessionWithOptions(session.Options{ - AssumeRoleTokenProvider: stscreds.StdinTokenProvider, - })) + sess := session.Must(session.NewSessionWithOptions(session.Options{ + AssumeRoleTokenProvider: stscreds.StdinTokenProvider, + })) To setup Assume Role outside of a session see the stscreds.AssumeRoleProvider documentation. -Environment Variables +# Environment Variables When a Session is created several environment variables can be set to adjust how the SDK functions, and what configuration data it loads when creating @@ -208,7 +206,7 @@ env values as well. AWS_SDK_LOAD_CONFIG=1 -Custom Shared Config and Credential Files +# Custom Shared Config and Credential Files Shared credentials file path can be set to instruct the SDK to use an alternative file for the shared credentials. If not set the file will be loaded from @@ -224,7 +222,7 @@ $HOME/.aws/config on Linux/Unix based systems, and AWS_CONFIG_FILE=$HOME/my_shared_config -Custom CA Bundle +# Custom CA Bundle Path to a custom Credentials Authority (CA) bundle PEM file that the SDK will use instead of the default system's root CA bundle. Use this only @@ -246,7 +244,7 @@ Setting a custom HTTPClient in the aws.Config options will override this setting To use this option and custom HTTP client, the HTTP client needs to be provided when creating the session. Not the service client. -Custom Client TLS Certificate +# Custom Client TLS Certificate The SDK supports the environment and session option being configured with Client TLS certificates that are sent as a part of the client's TLS handshake @@ -267,26 +265,26 @@ This can also be configured via the session.Options ClientTLSCert and ClientTLSK ClientTLSKey: myKeyFile, }) -Custom EC2 IMDS Endpoint +# Custom EC2 IMDS Endpoint The endpoint of the EC2 IMDS client can be configured via the environment variable, AWS_EC2_METADATA_SERVICE_ENDPOINT when creating the client with a Session. See Options.EC2IMDSEndpoint for more details. - AWS_EC2_METADATA_SERVICE_ENDPOINT=http://169.254.169.254 + AWS_EC2_METADATA_SERVICE_ENDPOINT=http://169.254.169.254 If using an URL with an IPv6 address literal, the IPv6 address component must be enclosed in square brackets. - AWS_EC2_METADATA_SERVICE_ENDPOINT=http://[::1] + AWS_EC2_METADATA_SERVICE_ENDPOINT=http://[::1] The custom EC2 IMDS endpoint can also be specified via the Session options. - sess, err := session.NewSessionWithOptions(session.Options{ - EC2MetadataEndpoint: "http://[::1]", - }) + sess, err := session.NewSessionWithOptions(session.Options{ + EC2MetadataEndpoint: "http://[::1]", + }) -FIPS and DualStack Endpoints +# FIPS and DualStack Endpoints The SDK can be configured to resolve an endpoint with certain capabilities such as FIPS and DualStack. @@ -296,36 +294,36 @@ or programmatically. To configure a FIPS endpoint set the environment variable set the AWS_USE_FIPS_ENDPOINT to true or false to enable or disable FIPS endpoint resolution. - AWS_USE_FIPS_ENDPOINT=true + AWS_USE_FIPS_ENDPOINT=true To configure a FIPS endpoint using shared config, set use_fips_endpoint to true or false to enable or disable FIPS endpoint resolution. - [profile myprofile] - region=us-west-2 - use_fips_endpoint=true + [profile myprofile] + region=us-west-2 + use_fips_endpoint=true To configure a FIPS endpoint programmatically - // Option 1: Configure it on a session for all clients - sess, err := session.NewSessionWithOptions(session.Options{ - UseFIPSEndpoint: endpoints.FIPSEndpointStateEnabled, - }) - if err != nil { - // handle error - } + // Option 1: Configure it on a session for all clients + sess, err := session.NewSessionWithOptions(session.Options{ + UseFIPSEndpoint: endpoints.FIPSEndpointStateEnabled, + }) + if err != nil { + // handle error + } - client := s3.New(sess) + client := s3.New(sess) - // Option 2: Configure it per client - sess, err := session.NewSession() - if err != nil { - // handle error - } + // Option 2: Configure it per client + sess, err := session.NewSession() + if err != nil { + // handle error + } - client := s3.New(sess, &aws.Config{ - UseFIPSEndpoint: endpoints.FIPSEndpointStateEnabled, - }) + client := s3.New(sess, &aws.Config{ + UseFIPSEndpoint: endpoints.FIPSEndpointStateEnabled, + }) You can configure a DualStack endpoint using an environment variable, shared config ($HOME/.aws/config), or programmatically. @@ -333,35 +331,35 @@ or programmatically. To configure a DualStack endpoint set the environment variable set the AWS_USE_DUALSTACK_ENDPOINT to true or false to enable or disable DualStack endpoint resolution. - AWS_USE_DUALSTACK_ENDPOINT=true + AWS_USE_DUALSTACK_ENDPOINT=true To configure a DualStack endpoint using shared config, set use_dualstack_endpoint to true or false to enable or disable DualStack endpoint resolution. - [profile myprofile] - region=us-west-2 - use_dualstack_endpoint=true + [profile myprofile] + region=us-west-2 + use_dualstack_endpoint=true To configure a DualStack endpoint programmatically - // Option 1: Configure it on a session for all clients - sess, err := session.NewSessionWithOptions(session.Options{ - UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled, - }) - if err != nil { - // handle error - } - - client := s3.New(sess) - - // Option 2: Configure it per client - sess, err := session.NewSession() - if err != nil { - // handle error - } - - client := s3.New(sess, &aws.Config{ - UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled, - }) + // Option 1: Configure it on a session for all clients + sess, err := session.NewSessionWithOptions(session.Options{ + UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled, + }) + if err != nil { + // handle error + } + + client := s3.New(sess) + + // Option 2: Configure it per client + sess, err := session.NewSession() + if err != nil { + // handle error + } + + client := s3.New(sess, &aws.Config{ + UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled, + }) */ package session diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/assert.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/assert.go index cc7e22a9aa95..0bd7c0c4a635 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/assert.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/assert.go @@ -154,7 +154,7 @@ func objectsAreEqual(expected, actual interface{}) bool { // Equal asserts that two objects are equal. // -// assert.Equal(t, 123, 123, "123 and 123 should be equal") +// assert.Equal(t, 123, 123, "123 and 123 should be equal") // // Returns whether the assertion was successful (true) or not (false). // diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go index 8771ee330311..2af49f1287ea 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go @@ -18,7 +18,8 @@ import ( // to confirm bucket should be deleted. Positive confirmation is required. // // Usage: -// go run deleteBuckets.go +// +// go run deleteBuckets.go func main() { sess := session.Must(session.NewSession()) diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/doc.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/doc.go index 1e55bbd07b91..fdd5321b4c64 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/doc.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/doc.go @@ -13,30 +13,31 @@ // } // // Below is the BNF that describes this parser -// Grammar: -// stmt -> section | stmt' -// stmt' -> epsilon | expr -// expr -> value (stmt)* | equal_expr (stmt)* -// equal_expr -> value ( ':' | '=' ) equal_expr' -// equal_expr' -> number | string | quoted_string -// quoted_string -> " quoted_string' -// quoted_string' -> string quoted_string_end -// quoted_string_end -> " -// -// section -> [ section' -// section' -> section_value section_close -// section_value -> number | string_subset | boolean | quoted_string_subset -// quoted_string_subset -> " quoted_string_subset' -// quoted_string_subset' -> string_subset quoted_string_end -// quoted_string_subset -> " -// section_close -> ] -// -// value -> number | string_subset | boolean -// string -> ? UTF-8 Code-Points except '\n' (U+000A) and '\r\n' (U+000D U+000A) ? -// string_subset -> ? Code-points excepted by grammar except ':' (U+003A), '=' (U+003D), '[' (U+005B), and ']' (U+005D) ? -// -// SkipState will skip (NL WS)+ -// -// comment -> # comment' | ; comment' -// comment' -> epsilon | value +// +// Grammar: +// stmt -> section | stmt' +// stmt' -> epsilon | expr +// expr -> value (stmt)* | equal_expr (stmt)* +// equal_expr -> value ( ':' | '=' ) equal_expr' +// equal_expr' -> number | string | quoted_string +// quoted_string -> " quoted_string' +// quoted_string' -> string quoted_string_end +// quoted_string_end -> " +// +// section -> [ section' +// section' -> section_value section_close +// section_value -> number | string_subset | boolean | quoted_string_subset +// quoted_string_subset -> " quoted_string_subset' +// quoted_string_subset' -> string_subset quoted_string_end +// quoted_string_subset -> " +// section_close -> ] +// +// value -> number | string_subset | boolean +// string -> ? UTF-8 Code-Points except '\n' (U+000A) and '\r\n' (U+000D U+000A) ? +// string_subset -> ? Code-points excepted by grammar except ':' (U+003A), '=' (U+003D), '[' (U+005B), and ']' (U+005D) ? +// +// SkipState will skip (NL WS)+ +// +// comment -> # comment' | ; comment' +// comment' -> epsilon | value package ini diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/literal_tokens.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/literal_tokens.go index b1b686086a9c..6deb8ae4fb4d 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/literal_tokens.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/ini/literal_tokens.go @@ -153,7 +153,7 @@ func (v ValueType) String() string { // ValueType enums const ( - NoneType = ValueType(iota) + NoneType = ValueType(iota) DecimalType // deprecated IntegerType // deprecated StringType @@ -166,9 +166,9 @@ type Value struct { Type ValueType raw []rune - integer int64 // deprecated + integer int64 // deprecated decimal float64 // deprecated - boolean bool // deprecated + boolean bool // deprecated str string } diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/accesspoint_arn.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/accesspoint_arn.go index 24648493d4ba..7b6778e0bd67 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/accesspoint_arn.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/accesspoint_arn.go @@ -21,9 +21,8 @@ func (a AccessPointARN) GetARN() arn.ARN { // AccessPoint resource. // // Supported Access point resource format: -// - Access point format: arn:{partition}:s3:{region}:{accountId}:accesspoint/{accesspointName} -// - example: arn.aws.s3.us-west-2.012345678901:accesspoint/myaccesspoint -// +// - Access point format: arn:{partition}:s3:{region}:{accountId}:accesspoint/{accesspointName} +// - example: arn.aws.s3.us-west-2.012345678901:accesspoint/myaccesspoint func ParseAccessPointResource(a arn.ARN, resParts []string) (AccessPointARN, error) { if len(a.Region) == 0 { return AccessPointARN{}, InvalidARNError{ARN: a, Reason: "region not set"} diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/outpost_arn.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/outpost_arn.go index e2fafd1a8f9f..d06f1f18d994 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/outpost_arn.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/s3shared/arn/outpost_arn.go @@ -17,15 +17,14 @@ type OutpostARN interface { // // Currently supported outpost ARN formats: // * Outpost AccessPoint ARN format: -// - ARN format: arn:{partition}:s3-outposts:{region}:{accountId}:outpost/{outpostId}/accesspoint/{accesspointName} -// - example: arn:aws:s3-outposts:us-west-2:012345678901:outpost/op-1234567890123456/accesspoint/myaccesspoint +// - ARN format: arn:{partition}:s3-outposts:{region}:{accountId}:outpost/{outpostId}/accesspoint/{accesspointName} +// - example: arn:aws:s3-outposts:us-west-2:012345678901:outpost/op-1234567890123456/accesspoint/myaccesspoint // // * Outpost Bucket ARN format: -// - ARN format: arn:{partition}:s3-outposts:{region}:{accountId}:outpost/{outpostId}/bucket/{bucketName} -// - example: arn:aws:s3-outposts:us-west-2:012345678901:outpost/op-1234567890123456/bucket/mybucket +// - ARN format: arn:{partition}:s3-outposts:{region}:{accountId}:outpost/{outpostId}/bucket/{bucketName} +// - example: arn:aws:s3-outposts:us-west-2:012345678901:outpost/op-1234567890123456/bucket/mybucket // // Other outpost ARN formats may be supported and added in the future. -// func ParseOutpostARNResource(a arn.ARN, resParts []string) (OutpostARN, error) { if len(a.Region) == 0 { return nil, InvalidARNError{ARN: a, Reason: "region not set"} @@ -109,7 +108,6 @@ func (o OutpostBucketARN) GetARN() arn.ARN { // bucket resource id. // // parseBucketResource only parses the bucket resource id. -// func parseBucketResource(a arn.ARN, resParts []string) (bucketName string, err error) { if len(resParts) == 0 { return bucketName, InvalidARNError{ARN: a, Reason: "bucket resource-id not set"} diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor.go index a8452878324d..326efc9eca31 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor.go @@ -8,6 +8,7 @@ import "math" // Round returns the nearest integer, rounding half away from zero. // // Special cases are: +// // Round(±0) = ±0 // Round(±Inf) = ±Inf // Round(NaN) = NaN diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go index a3ae3e5dba8c..24232660dd2c 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go @@ -19,6 +19,7 @@ const ( // Round returns the nearest integer, rounding half away from zero. // // Special cases are: +// // Round(±0) = ±0 // Round(±Inf) = ±Inf // Round(NaN) = NaN diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/api.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/api.go index 738b31ecd792..deb0cb674d72 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/api.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/api.go @@ -95,11 +95,11 @@ type Metadata struct { EndpointsID string ServiceID string - NoResolveEndpoint bool + NoResolveEndpoint bool AWSQueryCompatible *awsQueryCompatible } -type awsQueryCompatible struct {} +type awsQueryCompatible struct{} // ProtocolSettings define how the SDK should handle requests in the context // of of a protocol. diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/legacy_jsonvalue.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/legacy_jsonvalue.go index 4d59ebf31890..6e424bd52950 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/legacy_jsonvalue.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/legacy_jsonvalue.go @@ -11,196 +11,196 @@ type legacyJSONValues struct { } var legacyJSONValueShapes = map[string]map[string]legacyJSONValues{ - "braket": map[string]legacyJSONValues{ - "CreateQuantumTaskRequest": legacyJSONValues{ + "braket": { + "CreateQuantumTaskRequest": { Type: "structure", StructMembers: map[string]struct{}{ - "action": struct{}{}, - "deviceParameters": struct{}{}, + "action": {}, + "deviceParameters": {}, }, }, - "GetDeviceResponse": legacyJSONValues{ + "GetDeviceResponse": { Type: "structure", StructMembers: map[string]struct{}{ - "deviceCapabilities": struct{}{}, + "deviceCapabilities": {}, }, }, - "GetQuantumTaskResponse": legacyJSONValues{ + "GetQuantumTaskResponse": { Type: "structure", StructMembers: map[string]struct{}{ - "deviceParameters": struct{}{}, + "deviceParameters": {}, }, }, }, - "cloudwatchrum": map[string]legacyJSONValues{ - "RumEvent": legacyJSONValues{ + "cloudwatchrum": { + "RumEvent": { Type: "structure", StructMembers: map[string]struct{}{ - "details": struct{}{}, - "metadata": struct{}{}, + "details": {}, + "metadata": {}, }, }, }, - "lexruntimeservice": map[string]legacyJSONValues{ - "PostContentRequest": legacyJSONValues{ + "lexruntimeservice": { + "PostContentRequest": { Type: "structure", StructMembers: map[string]struct{}{ - "requestAttributes": struct{}{}, + "requestAttributes": {}, //"ActiveContexts": struct{}{}, - Disabled because JSON List - "sessionAttributes": struct{}{}, + "sessionAttributes": {}, }, }, - "PostContentResponse": legacyJSONValues{ + "PostContentResponse": { Type: "structure", StructMembers: map[string]struct{}{ // "alternativeIntents": struct{}{}, - Disabled because JSON List - "sessionAttributes": struct{}{}, - "nluIntentConfidence": struct{}{}, - "slots": struct{}{}, + "sessionAttributes": {}, + "nluIntentConfidence": {}, + "slots": {}, //"activeContexts": struct{}{}, - Disabled because JSON List }, }, - "PutSessionResponse": legacyJSONValues{ + "PutSessionResponse": { Type: "structure", StructMembers: map[string]struct{}{ // "activeContexts": struct{}{}, - Disabled because JSON List - "slots": struct{}{}, - "sessionAttributes": struct{}{}, + "slots": {}, + "sessionAttributes": {}, }, }, }, - "lookoutequipment": map[string]legacyJSONValues{ - "DatasetSchema": legacyJSONValues{ + "lookoutequipment": { + "DatasetSchema": { Type: "structure", StructMembers: map[string]struct{}{ - "InlineDataSchema": struct{}{}, + "InlineDataSchema": {}, }, }, - "DescribeDatasetResponse": legacyJSONValues{ + "DescribeDatasetResponse": { Type: "structure", StructMembers: map[string]struct{}{ - "Schema": struct{}{}, + "Schema": {}, }, }, - "DescribeModelResponse": legacyJSONValues{ + "DescribeModelResponse": { Type: "structure", StructMembers: map[string]struct{}{ - "Schema": struct{}{}, - "ModelMetrics": struct{}{}, + "Schema": {}, + "ModelMetrics": {}, }, }, }, - "networkmanager": map[string]legacyJSONValues{ - "CoreNetworkPolicy": legacyJSONValues{ + "networkmanager": { + "CoreNetworkPolicy": { Type: "structure", StructMembers: map[string]struct{}{ - "PolicyDocument": struct{}{}, + "PolicyDocument": {}, }, }, - "GetResourcePolicyResponse": legacyJSONValues{ + "GetResourcePolicyResponse": { Type: "structure", StructMembers: map[string]struct{}{ - "PolicyDocument": struct{}{}, + "PolicyDocument": {}, }, }, - "PutCoreNetworkPolicyRequest": legacyJSONValues{ + "PutCoreNetworkPolicyRequest": { Type: "structure", StructMembers: map[string]struct{}{ - "PolicyDocument": struct{}{}, + "PolicyDocument": {}, }, }, - "PutResourcePolicyRequest": legacyJSONValues{ + "PutResourcePolicyRequest": { Type: "structure", StructMembers: map[string]struct{}{ - "PolicyDocument": struct{}{}, + "PolicyDocument": {}, }, }, }, - "personalizeevents": map[string]legacyJSONValues{ - "Event": legacyJSONValues{ + "personalizeevents": { + "Event": { Type: "structure", StructMembers: map[string]struct{}{ - "properties": struct{}{}, + "properties": {}, }, }, - "Item": legacyJSONValues{ + "Item": { Type: "structure", StructMembers: map[string]struct{}{ - "properties": struct{}{}, + "properties": {}, }, }, - "User": legacyJSONValues{ + "User": { Type: "structure", StructMembers: map[string]struct{}{ - "properties": struct{}{}, + "properties": {}, }, }, }, - "pricing": map[string]legacyJSONValues{ - "PriceListJsonItems": legacyJSONValues{ + "pricing": { + "PriceListJsonItems": { Type: "list", ListMemberRef: true, }, }, - "rekognition": map[string]legacyJSONValues{ - "HumanLoopActivationOutput": legacyJSONValues{ + "rekognition": { + "HumanLoopActivationOutput": { Type: "structure", StructMembers: map[string]struct{}{ - "HumanLoopActivationConditionsEvaluationResults": struct{}{}, + "HumanLoopActivationConditionsEvaluationResults": {}, }, }, }, - "sagemaker": map[string]legacyJSONValues{ - "HumanLoopActivationConditionsConfig": legacyJSONValues{ + "sagemaker": { + "HumanLoopActivationConditionsConfig": { Type: "structure", StructMembers: map[string]struct{}{ - "HumanLoopActivationConditions": struct{}{}, + "HumanLoopActivationConditions": {}, }, }, }, - "schemas": map[string]legacyJSONValues{ - "GetResourcePolicyResponse": legacyJSONValues{ + "schemas": { + "GetResourcePolicyResponse": { Type: "structure", StructMembers: map[string]struct{}{ - "Policy": struct{}{}, + "Policy": {}, }, }, - "PutResourcePolicyRequest": legacyJSONValues{ + "PutResourcePolicyRequest": { Type: "structure", StructMembers: map[string]struct{}{ - "Policy": struct{}{}, + "Policy": {}, }, }, - "PutResourcePolicyResponse": legacyJSONValues{ + "PutResourcePolicyResponse": { Type: "structure", StructMembers: map[string]struct{}{ - "Policy": struct{}{}, + "Policy": {}, }, }, - "GetResourcePolicyOutput": legacyJSONValues{ + "GetResourcePolicyOutput": { Type: "structure", StructMembers: map[string]struct{}{ - "Policy": struct{}{}, + "Policy": {}, }, }, - "PutResourcePolicyInput": legacyJSONValues{ + "PutResourcePolicyInput": { Type: "structure", StructMembers: map[string]struct{}{ - "Policy": struct{}{}, + "Policy": {}, }, }, - "PutResourcePolicyOutput": legacyJSONValues{ + "PutResourcePolicyOutput": { Type: "structure", StructMembers: map[string]struct{}{ - "Policy": struct{}{}, + "Policy": {}, }, }, }, - "textract": map[string]legacyJSONValues{ - "HumanLoopActivationOutput": legacyJSONValues{ + "textract": { + "HumanLoopActivationOutput": { Type: "structure", StructMembers: map[string]struct{}{ - "HumanLoopActivationConditionsEvaluationResults": struct{}{}, + "HumanLoopActivationConditionsEvaluationResults": {}, }, }, }, diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/load.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/load.go index 2ff3614d1caf..a9091d77aa01 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/load.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/api/load.go @@ -123,11 +123,11 @@ func attachModelFiles(modelPath string, modelFiles ...modelLoader) error { // pattern passed in. Returns the path of the model file to be loaded. Includes // all versions of a service model. // -// e.g: -// models/apis/*/*/api-2.json +// e.g: +// models/apis/*/*/api-2.json // -// Or with specific model file: -// models/apis/service/version/api-2.json +// Or with specific model file: +// models/apis/service/version/api-2.json func ExpandModelGlobPath(globs ...string) ([]string, error) { modelPaths := []string{} @@ -150,7 +150,7 @@ func ExpandModelGlobPath(globs ...string) ([]string, error) { // Uses the third from last path element to determine unique service. Only one // service version will be included. // -// models/apis/service/version/api-2.json +// models/apis/service/version/api-2.json func TrimModelServiceVersions(modelPaths []string) (include, exclude []string) { sort.Strings(modelPaths) diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/cli/gen-endpoints/main.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/cli/gen-endpoints/main.go index f686c03231df..ed33fbce3656 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/cli/gen-endpoints/main.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/model/cli/gen-endpoints/main.go @@ -4,7 +4,7 @@ // Command gen-endpoints parses a JSON description of the AWS endpoint // discovery logic and generates a Go file which returns an endpoint. // -// aws-gen-goendpoints apis/_endpoints.json aws/endpoints_map.go +// aws-gen-goendpoints apis/_endpoints.json aws/endpoints_map.go package main import ( @@ -18,8 +18,9 @@ import ( // Generates the endpoints from json description // // Args: -// -model The definition file to use -// -out The output file to generate +// +// -model The definition file to use +// -out The output file to generate func main() { var modelName, outName string flag.StringVar(&modelName, "model", "", "Endpoints definition model") diff --git a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/protocol/eventstream/eventstreamtest/testing.go b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/protocol/eventstream/eventstreamtest/testing.go index 74d6bb420ba3..aeff141263ce 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/protocol/eventstream/eventstreamtest/testing.go +++ b/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/protocol/eventstream/eventstreamtest/testing.go @@ -16,12 +16,12 @@ import ( "testing" "time" + "golang.org/x/net/http2" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/session" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/awstesting/unit" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/protocol" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/private/protocol/eventstream" - "golang.org/x/net/http2" ) const ( diff --git a/cluster-autoscaler/cloudprovider/cloud_provider.go b/cluster-autoscaler/cloudprovider/cloud_provider.go index 1a4b01576aa6..623e9bd345d2 100644 --- a/cluster-autoscaler/cloudprovider/cloud_provider.go +++ b/cluster-autoscaler/cloudprovider/cloud_provider.go @@ -129,7 +129,7 @@ type CloudProvider interface { // created on the cloud provider side. The node group is not returned by NodeGroups() until it is created. // Implementation optional. NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, - taints []apiv1.Taint, extraResources map[string]resource.Quantity) (NodeGroup, error) + taints []apiv1.Taint, extraResources map[string]resource.Quantity) (NodeGroup, error) // GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.). GetResourceLimiter() (*ResourceLimiter, error) diff --git a/cluster-autoscaler/config/autoscaling_options.go b/cluster-autoscaler/config/autoscaling_options.go index d3d6fdbfa3f0..aa902058c184 100644 --- a/cluster-autoscaler/config/autoscaling_options.go +++ b/cluster-autoscaler/config/autoscaling_options.go @@ -307,6 +307,8 @@ type AutoscalingOptions struct { CheckCapacityProvisioningRequestMaxBatchSize int // CheckCapacityProvisioningRequestBatchTimebox is the maximum time to spend processing a batch of provisioning requests CheckCapacityProvisioningRequestBatchTimebox time.Duration + // ForceDeleteLongUnregisteredNodes is used to enable/disable ignoring min size constraints during removal of long unregistered nodes + ForceDeleteLongUnregisteredNodes bool } // KubeClientOptions specify options for kube client diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index 216a684ee304..b8417c85d63c 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -785,29 +785,38 @@ func (a *StaticAutoscaler) removeOldUnregisteredNodes(allUnregisteredNodes []clu nodeGroup := nodeGroups[nodeGroupId] klog.V(0).Infof("Removing %v unregistered nodes for node group %v", len(unregisteredNodesToDelete), nodeGroupId) - size, err := nodeGroup.TargetSize() - if err != nil { - klog.Warningf("Failed to get node group size; nodeGroup=%v; err=%v", nodeGroup.Id(), err) - continue - } - possibleToDelete := size - nodeGroup.MinSize() - if possibleToDelete <= 0 { - klog.Warningf("Node group %s min size reached, skipping removal of %v unregistered nodes", nodeGroupId, len(unregisteredNodesToDelete)) - continue - } - if len(unregisteredNodesToDelete) > possibleToDelete { - klog.Warningf("Capping node group %s unregistered node removal to %d nodes, removing all %d would exceed min size constaint", nodeGroupId, possibleToDelete, len(unregisteredNodesToDelete)) - unregisteredNodesToDelete = unregisteredNodesToDelete[:possibleToDelete] + if !a.ForceDeleteLongUnregisteredNodes { + size, err := nodeGroup.TargetSize() + if err != nil { + klog.Warningf("Failed to get node group size; nodeGroup=%v; err=%v", nodeGroup.Id(), err) + continue + } + possibleToDelete := size - nodeGroup.MinSize() + if possibleToDelete <= 0 { + klog.Warningf("Node group %s min size reached, skipping removal of %v unregistered nodes", nodeGroupId, len(unregisteredNodesToDelete)) + continue + } + if len(unregisteredNodesToDelete) > possibleToDelete { + klog.Warningf("Capping node group %s unregistered node removal to %d nodes, removing all %d would exceed min size constaint", nodeGroupId, possibleToDelete, len(unregisteredNodesToDelete)) + unregisteredNodesToDelete = unregisteredNodesToDelete[:possibleToDelete] + } } - nodesToDelete := toNodes(unregisteredNodesToDelete) - nodesToDelete, err = overrideNodesToDeleteForZeroOrMax(a.NodeGroupDefaults, nodeGroup, nodesToDelete) + nodesToDelete := toNodes(unregisteredNodesToDelete) + nodesToDelete, err := overrideNodesToDeleteForZeroOrMax(a.NodeGroupDefaults, nodeGroup, nodesToDelete) if err != nil { klog.Warningf("Failed to remove unregistered nodes from node group %s: %v", nodeGroupId, err) continue } - err = nodeGroup.DeleteNodes(nodesToDelete) + if a.ForceDeleteLongUnregisteredNodes { + err = nodeGroup.ForceDeleteNodes(nodesToDelete) + if err == cloudprovider.ErrNotImplemented { + err = nodeGroup.DeleteNodes(nodesToDelete) + } + } else { + err = nodeGroup.DeleteNodes(nodesToDelete) + } csr.InvalidateNodeInstancesCacheEntry(nodeGroup) if err != nil { klog.Warningf("Failed to remove %v unregistered nodes from node group %s: %v", len(nodesToDelete), nodeGroupId, err) diff --git a/cluster-autoscaler/core/static_autoscaler_test.go b/cluster-autoscaler/core/static_autoscaler_test.go index fcff16331eef..84815eee4028 100644 --- a/cluster-autoscaler/core/static_autoscaler_test.go +++ b/cluster-autoscaler/core/static_autoscaler_test.go @@ -876,134 +876,144 @@ func TestStaticAutoscalerRunOnceWithAutoprovisionedEnabled(t *testing.T) { } func TestStaticAutoscalerRunOnceWithALongUnregisteredNode(t *testing.T) { - readyNodeLister := kubernetes.NewTestNodeLister(nil) - allNodeLister := kubernetes.NewTestNodeLister(nil) - allPodListerMock := &podListerMock{} - podDisruptionBudgetListerMock := &podDisruptionBudgetListerMock{} - daemonSetListerMock := &daemonSetListerMock{} - onScaleUpMock := &onScaleUpMock{} - onScaleDownMock := &onScaleDownMock{} - deleteFinished := make(chan bool, 1) - - now := time.Now() - later := now.Add(1 * time.Minute) + for _, forceDeleteLongUnregisteredNodes := range []bool{false, true} { + t.Run(fmt.Sprintf("forceDeleteLongUnregisteredNodes=%v", forceDeleteLongUnregisteredNodes), func(t *testing.T) { + readyNodeLister := kubernetes.NewTestNodeLister(nil) + allNodeLister := kubernetes.NewTestNodeLister(nil) + allPodListerMock := &podListerMock{} + podDisruptionBudgetListerMock := &podDisruptionBudgetListerMock{} + daemonSetListerMock := &daemonSetListerMock{} + onScaleUpMock := &onScaleUpMock{} + onScaleDownMock := &onScaleDownMock{} + deleteFinished := make(chan bool, 1) + + now := time.Now() + later := now.Add(1 * time.Minute) + + n1 := BuildTestNode("n1", 1000, 1000) + SetNodeReadyState(n1, true, time.Now()) + n2 := BuildTestNode("n2", 1000, 1000) + SetNodeReadyState(n2, true, time.Now()) + + p1 := BuildTestPod("p1", 600, 100) + p1.Spec.NodeName = "n1" + p2 := BuildTestPod("p2", 600, 100, MarkUnschedulable()) + + provider := testprovider.NewTestCloudProvider( + func(id string, delta int) error { + return onScaleUpMock.ScaleUp(id, delta) + }, func(id string, name string) error { + ret := onScaleDownMock.ScaleDown(id, name) + deleteFinished <- true + return ret + }) + provider.AddNodeGroup("ng1", 2, 10, 2) + provider.AddNode("ng1", n1) - n1 := BuildTestNode("n1", 1000, 1000) - SetNodeReadyState(n1, true, time.Now()) - n2 := BuildTestNode("n2", 1000, 1000) - SetNodeReadyState(n2, true, time.Now()) + // broken node, that will be just hanging out there during + // the test (it can't be removed since that would validate group min size) + brokenNode := BuildTestNode("broken", 1000, 1000) + provider.AddNode("ng1", brokenNode) - p1 := BuildTestPod("p1", 600, 100) - p1.Spec.NodeName = "n1" - p2 := BuildTestPod("p2", 600, 100, MarkUnschedulable()) + ng1 := reflect.ValueOf(provider.GetNodeGroup("ng1")).Interface().(*testprovider.TestNodeGroup) + assert.NotNil(t, ng1) + assert.NotNil(t, provider) - provider := testprovider.NewTestCloudProvider( - func(id string, delta int) error { - return onScaleUpMock.ScaleUp(id, delta) - }, func(id string, name string) error { - ret := onScaleDownMock.ScaleDown(id, name) - deleteFinished <- true - return ret - }) - provider.AddNodeGroup("ng1", 2, 10, 2) - provider.AddNode("ng1", n1) + // Create context with mocked lister registry. + options := config.AutoscalingOptions{ + NodeGroupDefaults: config.NodeGroupAutoscalingOptions{ + ScaleDownUnneededTime: time.Minute, + ScaleDownUnreadyTime: time.Minute, + ScaleDownUtilizationThreshold: 0.5, + MaxNodeProvisionTime: 10 * time.Second, + }, + EstimatorName: estimator.BinpackingEstimatorName, + ScaleDownEnabled: true, + MaxNodesTotal: 10, + MaxCoresTotal: 10, + MaxMemoryTotal: 100000, + ForceDeleteLongUnregisteredNodes: forceDeleteLongUnregisteredNodes, + } + processorCallbacks := newStaticAutoscalerProcessorCallbacks() - // broken node, that will be just hanging out there during - // the test (it can't be removed since that would validate group min size) - brokenNode := BuildTestNode("broken", 1000, 1000) - provider.AddNode("ng1", brokenNode) + context, err := NewScaleTestAutoscalingContext(options, &fake.Clientset{}, nil, provider, processorCallbacks, nil) + assert.NoError(t, err) - ng1 := reflect.ValueOf(provider.GetNodeGroup("ng1")).Interface().(*testprovider.TestNodeGroup) - assert.NotNil(t, ng1) - assert.NotNil(t, provider) + setUpScaleDownActuator(&context, options) - // Create context with mocked lister registry. - options := config.AutoscalingOptions{ - NodeGroupDefaults: config.NodeGroupAutoscalingOptions{ - ScaleDownUnneededTime: time.Minute, - ScaleDownUnreadyTime: time.Minute, - ScaleDownUtilizationThreshold: 0.5, - MaxNodeProvisionTime: 10 * time.Second, - }, - EstimatorName: estimator.BinpackingEstimatorName, - ScaleDownEnabled: true, - MaxNodesTotal: 10, - MaxCoresTotal: 10, - MaxMemoryTotal: 100000, - } - processorCallbacks := newStaticAutoscalerProcessorCallbacks() + listerRegistry := kube_util.NewListerRegistry(allNodeLister, readyNodeLister, allPodListerMock, + podDisruptionBudgetListerMock, daemonSetListerMock, + nil, nil, nil, nil) + context.ListerRegistry = listerRegistry - context, err := NewScaleTestAutoscalingContext(options, &fake.Clientset{}, nil, provider, processorCallbacks, nil) - assert.NoError(t, err) + clusterStateConfig := clusterstate.ClusterStateRegistryConfig{ + OkTotalUnreadyCount: 1, + } + processors := processorstest.NewTestProcessors(&context) - setUpScaleDownActuator(&context, options) + clusterState := clusterstate.NewClusterStateRegistry(provider, clusterStateConfig, context.LogRecorder, NewBackoff(), nodegroupconfig.NewDefaultNodeGroupConfigProcessor(options.NodeGroupDefaults), processors.AsyncNodeGroupStateChecker) + // broken node detected as unregistered - listerRegistry := kube_util.NewListerRegistry(allNodeLister, readyNodeLister, allPodListerMock, - podDisruptionBudgetListerMock, daemonSetListerMock, - nil, nil, nil, nil) - context.ListerRegistry = listerRegistry + nodes := []*apiv1.Node{n1} + // nodeInfos, _ := getNodeInfosForGroups(nodes, provider, listerRegistry, []*appsv1.DaemonSet{}, context.PredicateChecker) + clusterState.UpdateNodes(nodes, nil, now) - clusterStateConfig := clusterstate.ClusterStateRegistryConfig{ - OkTotalUnreadyCount: 1, - } - processors := processorstest.NewTestProcessors(&context) + // broken node failed to register in time + clusterState.UpdateNodes(nodes, nil, later) - clusterState := clusterstate.NewClusterStateRegistry(provider, clusterStateConfig, context.LogRecorder, NewBackoff(), nodegroupconfig.NewDefaultNodeGroupConfigProcessor(options.NodeGroupDefaults), processors.AsyncNodeGroupStateChecker) - // broken node detected as unregistered + sdPlanner, sdActuator := newScaleDownPlannerAndActuator(&context, processors, clusterState, nil) + suOrchestrator := orchestrator.New() + suOrchestrator.Initialize(&context, processors, clusterState, newEstimatorBuilder(), taints.TaintConfig{}) - nodes := []*apiv1.Node{n1} - // nodeInfos, _ := getNodeInfosForGroups(nodes, provider, listerRegistry, []*appsv1.DaemonSet{}, context.PredicateChecker) - clusterState.UpdateNodes(nodes, nil, now) + autoscaler := &StaticAutoscaler{ + AutoscalingContext: &context, + clusterStateRegistry: clusterState, + lastScaleUpTime: time.Now(), + lastScaleDownFailTime: time.Now(), + scaleDownPlanner: sdPlanner, + scaleDownActuator: sdActuator, + scaleUpOrchestrator: suOrchestrator, + processors: processors, + loopStartNotifier: loopstart.NewObserversList(nil), + processorCallbacks: processorCallbacks, + } - // broken node failed to register in time - clusterState.UpdateNodes(nodes, nil, later) + // If deletion of unregistered nodes is not forced, we need to simulate + // additional scale-up to respect min size constraints. + if !forceDeleteUnregisteredNodes { + // Scale up. + readyNodeLister.SetNodes(nodes) + allNodeLister.SetNodes(nodes) + allPodListerMock.On("List").Return([]*apiv1.Pod{p1, p2}, nil).Twice() + daemonSetListerMock.On("List", labels.Everything()).Return([]*appsv1.DaemonSet{}, nil).Once() + podDisruptionBudgetListerMock.On("List").Return([]*policyv1.PodDisruptionBudget{}, nil).Once() + onScaleUpMock.On("ScaleUp", "ng1", 1).Return(nil).Once() + + err = autoscaler.RunOnce(later.Add(time.Hour)) + assert.NoError(t, err) + mock.AssertExpectationsForObjects(t, allPodListerMock, + podDisruptionBudgetListerMock, daemonSetListerMock, onScaleUpMock, onScaleDownMock) + + nodes = append(nodes, n2) + provider.AddNode("ng1", n2) + ng1.SetTargetSize(3) + } - sdPlanner, sdActuator := newScaleDownPlannerAndActuator(&context, processors, clusterState, nil) - suOrchestrator := orchestrator.New() - suOrchestrator.Initialize(&context, processors, clusterState, newEstimatorBuilder(), taints.TaintConfig{}) + // Remove broken node + readyNodeLister.SetNodes(nodes) + allNodeLister.SetNodes(nodes) + allPodListerMock.On("List").Return([]*apiv1.Pod{}, nil).Twice() + onScaleDownMock.On("ScaleDown", "ng1", "broken").Return(nil).Once() + daemonSetListerMock.On("List", labels.Everything()).Return([]*appsv1.DaemonSet{}, nil).Once() + podDisruptionBudgetListerMock.On("List").Return([]*policyv1.PodDisruptionBudget{}, nil).Once() - autoscaler := &StaticAutoscaler{ - AutoscalingContext: &context, - clusterStateRegistry: clusterState, - lastScaleUpTime: time.Now(), - lastScaleDownFailTime: time.Now(), - scaleDownPlanner: sdPlanner, - scaleDownActuator: sdActuator, - scaleUpOrchestrator: suOrchestrator, - processors: processors, - loopStartNotifier: loopstart.NewObserversList(nil), - processorCallbacks: processorCallbacks, + err = autoscaler.RunOnce(later.Add(2 * time.Hour)) + waitForDeleteToFinish(t, deleteFinished) + assert.NoError(t, err) + mock.AssertExpectationsForObjects(t, allPodListerMock, + podDisruptionBudgetListerMock, daemonSetListerMock, onScaleUpMock, onScaleDownMock) + }) } - - // Scale up. - readyNodeLister.SetNodes([]*apiv1.Node{n1}) - allNodeLister.SetNodes([]*apiv1.Node{n1}) - allPodListerMock.On("List").Return([]*apiv1.Pod{p1, p2}, nil).Twice() - daemonSetListerMock.On("List", labels.Everything()).Return([]*appsv1.DaemonSet{}, nil).Once() - podDisruptionBudgetListerMock.On("List").Return([]*policyv1.PodDisruptionBudget{}, nil).Once() - onScaleUpMock.On("ScaleUp", "ng1", 1).Return(nil).Once() - - err = autoscaler.RunOnce(later.Add(time.Hour)) - assert.NoError(t, err) - mock.AssertExpectationsForObjects(t, allPodListerMock, - podDisruptionBudgetListerMock, daemonSetListerMock, onScaleUpMock, onScaleDownMock) - - // Remove broken node after going over min size - provider.AddNode("ng1", n2) - ng1.SetTargetSize(3) - - readyNodeLister.SetNodes([]*apiv1.Node{n1, n2}) - allNodeLister.SetNodes([]*apiv1.Node{n1, n2}) - allPodListerMock.On("List").Return([]*apiv1.Pod{p1, p2}, nil).Twice() - onScaleDownMock.On("ScaleDown", "ng1", "broken").Return(nil).Once() - daemonSetListerMock.On("List", labels.Everything()).Return([]*appsv1.DaemonSet{}, nil).Once() - podDisruptionBudgetListerMock.On("List").Return([]*policyv1.PodDisruptionBudget{}, nil).Once() - - err = autoscaler.RunOnce(later.Add(2 * time.Hour)) - waitForDeleteToFinish(t, deleteFinished) - assert.NoError(t, err) - mock.AssertExpectationsForObjects(t, allPodListerMock, - podDisruptionBudgetListerMock, daemonSetListerMock, onScaleUpMock, onScaleDownMock) } func TestStaticAutoscalerRunOncePodsWithPriorities(t *testing.T) { diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index d50cc0cebde4..cf3ca31ccbe5 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -279,6 +279,7 @@ var ( checkCapacityBatchProcessing = flag.Bool("check-capacity-batch-processing", false, "Whether to enable batch processing for check capacity requests.") checkCapacityProvisioningRequestMaxBatchSize = flag.Int("check-capacity-provisioning-request-max-batch-size", 10, "Maximum number of provisioning requests to process in a single batch.") checkCapacityProvisioningRequestBatchTimebox = flag.Duration("check-capacity-provisioning-request-batch-timebox", 10*time.Second, "Maximum time to process a batch of provisioning requests.") + forceDeleteLongUnregisteredNodes = flag.Bool("force-delete-unregistered-nodes", false, "Whether to enable force deletion of long unregistered nodes, regardless of the min size of the node group the belong to.") ) func isFlagPassed(name string) bool { @@ -457,6 +458,7 @@ func createAutoscalingOptions() config.AutoscalingOptions { CheckCapacityBatchProcessing: *checkCapacityBatchProcessing, CheckCapacityProvisioningRequestMaxBatchSize: *checkCapacityProvisioningRequestMaxBatchSize, CheckCapacityProvisioningRequestBatchTimebox: *checkCapacityProvisioningRequestBatchTimebox, + ForceDeleteLongUnregisteredNodes: *forceDeleteLongUnregisteredNodes, } }