Skip to content

Commit 4f34317

Browse files
committed
Properly handle virtual nodes and missing node pool IDs to prevent crashes
1 parent ff8a810 commit 4f34317

File tree

36 files changed

+495
-489
lines changed

36 files changed

+495
-489
lines changed

cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/awserr/error.go

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,23 @@ package awserr
1010
//
1111
// Example:
1212
//
13-
// output, err := s3manage.Upload(svc, input, opts)
14-
// if err != nil {
15-
// if awsErr, ok := err.(awserr.Error); ok {
16-
// // Get error details
17-
// log.Println("Error:", awsErr.Code(), awsErr.Message())
18-
//
19-
// // Prints out full error message, including original error if there was one.
20-
// log.Println("Error:", awsErr.Error())
21-
//
22-
// // Get original error
23-
// if origErr := awsErr.OrigErr(); origErr != nil {
24-
// // operate on original error.
25-
// }
26-
// } else {
27-
// fmt.Println(err.Error())
28-
// }
29-
// }
30-
//
13+
// output, err := s3manage.Upload(svc, input, opts)
14+
// if err != nil {
15+
// if awsErr, ok := err.(awserr.Error); ok {
16+
// // Get error details
17+
// log.Println("Error:", awsErr.Code(), awsErr.Message())
18+
//
19+
// // Prints out full error message, including original error if there was one.
20+
// log.Println("Error:", awsErr.Error())
21+
//
22+
// // Get original error
23+
// if origErr := awsErr.OrigErr(); origErr != nil {
24+
// // operate on original error.
25+
// }
26+
// } else {
27+
// fmt.Println(err.Error())
28+
// }
29+
// }
3130
type Error interface {
3231
// Satisfy the generic error interface.
3332
error
@@ -100,32 +99,31 @@ func NewBatchError(code, message string, errs []error) BatchedErrors {
10099
//
101100
// Example:
102101
//
103-
// output, err := s3manage.Upload(svc, input, opts)
104-
// if err != nil {
105-
// if reqerr, ok := err.(RequestFailure); ok {
106-
// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID())
107-
// } else {
108-
// log.Println("Error:", err.Error())
109-
// }
110-
// }
102+
// output, err := s3manage.Upload(svc, input, opts)
103+
// if err != nil {
104+
// if reqerr, ok := err.(RequestFailure); ok {
105+
// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID())
106+
// } else {
107+
// log.Println("Error:", err.Error())
108+
// }
109+
// }
111110
//
112111
// Combined with awserr.Error:
113112
//
114-
// output, err := s3manage.Upload(svc, input, opts)
115-
// if err != nil {
116-
// if awsErr, ok := err.(awserr.Error); ok {
117-
// // Generic AWS Error with Code, Message, and original error (if any)
118-
// fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
119-
//
120-
// if reqErr, ok := err.(awserr.RequestFailure); ok {
121-
// // A service error occurred
122-
// fmt.Println(reqErr.StatusCode(), reqErr.RequestID())
123-
// }
124-
// } else {
125-
// fmt.Println(err.Error())
126-
// }
127-
// }
128-
//
113+
// output, err := s3manage.Upload(svc, input, opts)
114+
// if err != nil {
115+
// if awsErr, ok := err.(awserr.Error); ok {
116+
// // Generic AWS Error with Code, Message, and original error (if any)
117+
// fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
118+
//
119+
// if reqErr, ok := err.(awserr.RequestFailure); ok {
120+
// // A service error occurred
121+
// fmt.Println(reqErr.StatusCode(), reqErr.RequestID())
122+
// }
123+
// } else {
124+
// fmt.Println(err.Error())
125+
// }
126+
// }
129127
type RequestFailure interface {
130128
Error
131129

cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/client/default_retryer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
// DefaultRetryer implements basic retry logic using exponential backoff for
1313
// most services. If you want to implement custom retry logic, you can implement the
1414
// request.Retryer interface.
15-
//
1615
type DefaultRetryer struct {
1716
// Num max Retries is the number of max retries that will be performed.
1817
// By default, this is zero.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// DO NOT EDIT
22
package corehandlers
33

4-
const isAwsInternal = ""
4+
const isAwsInternal = ""

cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/chain_provider.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,18 @@ var (
3737
// does not return any credentials ChainProvider will return the error
3838
// ErrNoValidProvidersFoundInChain
3939
//
40-
// creds := credentials.NewChainCredentials(
41-
// []credentials.Provider{
42-
// &credentials.EnvProvider{},
43-
// &ec2rolecreds.EC2RoleProvider{
44-
// Client: ec2metadata.New(sess),
45-
// },
46-
// })
47-
//
48-
// // Usage of ChainCredentials with aws.Config
49-
// svc := ec2.New(session.Must(session.NewSession(&aws.Config{
50-
// Credentials: creds,
51-
// })))
40+
// creds := credentials.NewChainCredentials(
41+
// []credentials.Provider{
42+
// &credentials.EnvProvider{},
43+
// &ec2rolecreds.EC2RoleProvider{
44+
// Client: ec2metadata.New(sess),
45+
// },
46+
// })
5247
//
48+
// // Usage of ChainCredentials with aws.Config
49+
// svc := ec2.New(session.Must(session.NewSession(&aws.Config{
50+
// Credentials: creds,
51+
// })))
5352
type ChainProvider struct {
5453
Providers []Provider
5554
curr Provider

cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/credentials.go

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,36 @@
1414
//
1515
// Example of using the environment variable credentials.
1616
//
17-
// creds := credentials.NewEnvCredentials()
17+
// creds := credentials.NewEnvCredentials()
1818
//
19-
// // Retrieve the credentials value
20-
// credValue, err := creds.Get()
21-
// if err != nil {
22-
// // handle error
23-
// }
19+
// // Retrieve the credentials value
20+
// credValue, err := creds.Get()
21+
// if err != nil {
22+
// // handle error
23+
// }
2424
//
2525
// Example of forcing credentials to expire and be refreshed on the next Get().
2626
// This may be helpful to proactively expire credentials and refresh them sooner
2727
// than they would naturally expire on their own.
2828
//
29-
// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{})
30-
// creds.Expire()
31-
// credsValue, err := creds.Get()
32-
// // New credentials will be retrieved instead of from cache.
29+
// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{})
30+
// creds.Expire()
31+
// credsValue, err := creds.Get()
32+
// // New credentials will be retrieved instead of from cache.
3333
//
34-
//
35-
// Custom Provider
34+
// # Custom Provider
3635
//
3736
// Each Provider built into this package also provides a helper method to generate
3837
// a Credentials pointer setup with the provider. To use a custom Provider just
3938
// create a type which satisfies the Provider interface and pass it to the
4039
// NewCredentials method.
4140
//
42-
// type MyProvider struct{}
43-
// func (m *MyProvider) Retrieve() (Value, error) {...}
44-
// func (m *MyProvider) IsExpired() bool {...}
45-
//
46-
// creds := credentials.NewCredentials(&MyProvider{})
47-
// credValue, err := creds.Get()
41+
// type MyProvider struct{}
42+
// func (m *MyProvider) Retrieve() (Value, error) {...}
43+
// func (m *MyProvider) IsExpired() bool {...}
4844
//
45+
// creds := credentials.NewCredentials(&MyProvider{})
46+
// credValue, err := creds.Get()
4947
package credentials
5048

5149
import (
@@ -64,10 +62,10 @@ import (
6462
// when making service API calls. For example, when accessing public
6563
// s3 buckets.
6664
//
67-
// svc := s3.New(session.Must(session.NewSession(&aws.Config{
68-
// Credentials: credentials.AnonymousCredentials,
69-
// })))
70-
// // Access public S3 buckets.
65+
// svc := s3.New(session.Must(session.NewSession(&aws.Config{
66+
// Credentials: credentials.AnonymousCredentials,
67+
// })))
68+
// // Access public S3 buckets.
7169
var AnonymousCredentials = NewStaticCredentials("", "", "")
7270

7371
// A Value is the AWS credentials value for individual credential fields.
@@ -150,10 +148,11 @@ func (p ErrorProvider) IsExpired() bool {
150148
// provider's struct.
151149
//
152150
// Example:
153-
// type EC2RoleProvider struct {
154-
// Expiry
155-
// ...
156-
// }
151+
//
152+
// type EC2RoleProvider struct {
153+
// Expiry
154+
// ...
155+
// }
157156
type Expiry struct {
158157
// The date/time when to expire on
159158
expiration time.Time

cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ const ProviderName = "EC2RoleProvider"
2525
// Example how to configure the EC2RoleProvider with custom http Client, Endpoint
2626
// or ExpiryWindow
2727
//
28-
// p := &ec2rolecreds.EC2RoleProvider{
29-
// // Pass in a custom timeout to be used when requesting
30-
// // IAM EC2 Role credentials.
31-
// Client: ec2metadata.New(sess, aws.Config{
32-
// HTTPClient: &http.Client{Timeout: 10 * time.Second},
33-
// }),
28+
// p := &ec2rolecreds.EC2RoleProvider{
29+
// // Pass in a custom timeout to be used when requesting
30+
// // IAM EC2 Role credentials.
31+
// Client: ec2metadata.New(sess, aws.Config{
32+
// HTTPClient: &http.Client{Timeout: 10 * time.Second},
33+
// }),
3434
//
35-
// // Do not use early expiry of credentials. If a non zero value is
36-
// // specified the credentials will be expired early
37-
// ExpiryWindow: 0,
38-
// }
35+
// // Do not use early expiry of credentials. If a non zero value is
36+
// // specified the credentials will be expired early
37+
// ExpiryWindow: 0,
38+
// }
3939
type EC2RoleProvider struct {
4040
credentials.Expiry
4141

cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@
77
//
88
// Static credentials will never expire once they have been retrieved. The format
99
// of the static credentials response:
10-
// {
11-
// "AccessKeyId" : "MUA...",
12-
// "SecretAccessKey" : "/7PC5om....",
13-
// }
10+
//
11+
// {
12+
// "AccessKeyId" : "MUA...",
13+
// "SecretAccessKey" : "/7PC5om....",
14+
// }
1415
//
1516
// Refreshable credentials will expire within the "ExpiryWindow" of the Expiration
1617
// value in the response. The format of the refreshable credentials response:
17-
// {
18-
// "AccessKeyId" : "MUA...",
19-
// "SecretAccessKey" : "/7PC5om....",
20-
// "Token" : "AQoDY....=",
21-
// "Expiration" : "2016-02-25T06:03:31Z"
22-
// }
18+
//
19+
// {
20+
// "AccessKeyId" : "MUA...",
21+
// "SecretAccessKey" : "/7PC5om....",
22+
// "Token" : "AQoDY....=",
23+
// "Expiration" : "2016-02-25T06:03:31Z"
24+
// }
2325
//
2426
// Errors should be returned in the following format and only returned with 400
2527
// or 500 HTTP status codes.
26-
// {
27-
// "code": "ErrorCode",
28-
// "message": "Helpful error message."
29-
// }
28+
//
29+
// {
30+
// "code": "ErrorCode",
31+
// "message": "Helpful error message."
32+
// }
3033
package endpointcreds
3134

3235
import (

0 commit comments

Comments
 (0)