Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/test/agent/golang.or…
Browse files Browse the repository at this point in the history
…g/x/sys-0.29.0
  • Loading branch information
orsenthil authored Feb 9, 2025
2 parents 783e413 + 5b69f3e commit 9b32301
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.22.5
1.22.12
8 changes: 4 additions & 4 deletions pkg/awsutils/awssession/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ package awssession
import (
"context"
"fmt"
"net/http"
"os"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/smithy-go"

awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
smithymiddleware "github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"

Expand Down Expand Up @@ -64,10 +65,9 @@ func getHTTPTimeout() time.Duration {

// New will return aws.Config to be used by Service Clients.
func New(ctx context.Context) (aws.Config, error) {
customHTTPClient := &http.Client{
Timeout: getHTTPTimeout()}
httpClient := awshttp.NewBuildableClient().WithTimeout(getHTTPTimeout())
optFns := []func(*config.LoadOptions) error{
config.WithHTTPClient(customHTTPClient),
config.WithHTTPClient(httpClient),
config.WithRetryMaxAttempts(maxRetries),
config.WithRetryer(func() aws.Retryer {
return retry.NewStandard()
Expand Down
5 changes: 5 additions & 0 deletions pkg/ipamd/ipamd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,11 @@ func (c *IPAMContext) AnnotatePod(podName string, podNamespace string, key strin
if err == nil && pod == nil {
log.Warnf("get a nil pod for pod name %s and namespace %s", podName, podNamespace)
}
// since the GetPod() error has been decorated, we have to check key words
// releasedIP is not empty meaning del path
if releasedIP != "" && err != nil && strings.Contains(err.Error(), "not found") {
return nil
}
return err
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/ipamd/ipamd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2295,8 +2295,7 @@ func TestAnnotatePod(t *testing.T) {

// Test that delete on a non-existant pod fails without crashing
err = mockContext.AnnotatePod("no-exist-name", "no-exist-namespace", "ip-address", "", ipTwo)
assert.Error(t, err)
assert.Equal(t, fmt.Errorf("error while trying to retrieve pod info: pods \"no-exist-name\" not found"), err)
assert.NoError(t, err)
}

func TestAddFeatureToCNINode(t *testing.T) {
Expand Down

0 comments on commit 9b32301

Please sign in to comment.