mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #66327 from tanshanshan/fixcheckerror
Automatic merge from submit-queue (batch tested with PRs 66292, 66327). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. replace session.New with NewSession and remove unused variable **What this PR does / why we need it**: replace session.New with NewSession and remove unused variable found in #66303 **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
aff6daece4
@ -650,7 +650,11 @@ func (p *awsSDKProvider) Compute(regionName string) (EC2, error) {
|
|||||||
}
|
}
|
||||||
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
||||||
|
|
||||||
service := ec2.New(session.New(awsConfig))
|
sess, err := session.NewSession(awsConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to initialize AWS session: %v", err)
|
||||||
|
}
|
||||||
|
service := ec2.New(sess)
|
||||||
|
|
||||||
p.addHandlers(regionName, &service.Handlers)
|
p.addHandlers(regionName, &service.Handlers)
|
||||||
|
|
||||||
@ -667,8 +671,11 @@ func (p *awsSDKProvider) LoadBalancing(regionName string) (ELB, error) {
|
|||||||
}
|
}
|
||||||
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
||||||
|
|
||||||
elbClient := elb.New(session.New(awsConfig))
|
sess, err := session.NewSession(awsConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to initialize AWS session: %v", err)
|
||||||
|
}
|
||||||
|
elbClient := elb.New(sess)
|
||||||
p.addHandlers(regionName, &elbClient.Handlers)
|
p.addHandlers(regionName, &elbClient.Handlers)
|
||||||
|
|
||||||
return elbClient, nil
|
return elbClient, nil
|
||||||
@ -681,7 +688,11 @@ func (p *awsSDKProvider) LoadBalancingV2(regionName string) (ELBV2, error) {
|
|||||||
}
|
}
|
||||||
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
||||||
|
|
||||||
elbClient := elbv2.New(session.New(awsConfig))
|
sess, err := session.NewSession(awsConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to initialize AWS session: %v", err)
|
||||||
|
}
|
||||||
|
elbClient := elbv2.New(sess)
|
||||||
|
|
||||||
p.addHandlers(regionName, &elbClient.Handlers)
|
p.addHandlers(regionName, &elbClient.Handlers)
|
||||||
|
|
||||||
@ -695,7 +706,11 @@ func (p *awsSDKProvider) Autoscaling(regionName string) (ASG, error) {
|
|||||||
}
|
}
|
||||||
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
||||||
|
|
||||||
client := autoscaling.New(session.New(awsConfig))
|
sess, err := session.NewSession(awsConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to initialize AWS session: %v", err)
|
||||||
|
}
|
||||||
|
client := autoscaling.New(sess)
|
||||||
|
|
||||||
p.addHandlers(regionName, &client.Handlers)
|
p.addHandlers(regionName, &client.Handlers)
|
||||||
|
|
||||||
@ -703,7 +718,11 @@ func (p *awsSDKProvider) Autoscaling(regionName string) (ASG, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *awsSDKProvider) Metadata() (EC2Metadata, error) {
|
func (p *awsSDKProvider) Metadata() (EC2Metadata, error) {
|
||||||
client := ec2metadata.New(session.New(&aws.Config{}))
|
sess, err := session.NewSession(&aws.Config{})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to initialize AWS session: %v", err)
|
||||||
|
}
|
||||||
|
client := ec2metadata.New(sess)
|
||||||
p.addAPILoggingHandlers(&client.Handlers)
|
p.addAPILoggingHandlers(&client.Handlers)
|
||||||
return client, nil
|
return client, nil
|
||||||
}
|
}
|
||||||
@ -715,7 +734,11 @@ func (p *awsSDKProvider) KeyManagement(regionName string) (KMS, error) {
|
|||||||
}
|
}
|
||||||
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
|
||||||
|
|
||||||
kmsClient := kms.New(session.New(awsConfig))
|
sess, err := session.NewSession(awsConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to initialize AWS session: %v", err)
|
||||||
|
}
|
||||||
|
kmsClient := kms.New(sess)
|
||||||
|
|
||||||
p.addHandlers(regionName, &kmsClient.Handlers)
|
p.addHandlers(regionName, &kmsClient.Handlers)
|
||||||
|
|
||||||
|
@ -862,6 +862,7 @@ func TestGetInstanceByNodeNameBatching(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
instances, err := c.getInstancesByNodeNames(nodeNames)
|
instances, err := c.getInstancesByNodeNames(nodeNames)
|
||||||
|
assert.Nil(t, err, "Error getting instances by nodeNames %v: %v", nodeNames, err)
|
||||||
assert.NotEmpty(t, instances)
|
assert.NotEmpty(t, instances)
|
||||||
assert.Equal(t, 200, len(instances), "Expected 200 but got less")
|
assert.Equal(t, 200, len(instances), "Expected 200 but got less")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user