Address review comments

This commit is contained in:
John Gardiner Myers 2023-06-15 16:22:41 -07:00
parent 1a4c7b5f3c
commit bb4e7478b7
3 changed files with 3 additions and 13 deletions

View File

@ -17,6 +17,7 @@ limitations under the License.
package aws package aws
import ( import (
"fmt"
"strings" "strings"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -24,7 +25,6 @@ import (
"github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"
"github.com/linki/instrumented_http" "github.com/linki/instrumented_http"
"github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"sigs.k8s.io/external-dns/pkg/apis/externaldns" "sigs.k8s.io/external-dns/pkg/apis/externaldns"
@ -54,7 +54,7 @@ func NewSession(awsConfig AWSSessionConfig) (*session.Session, error) {
SharedConfigState: session.SharedConfigEnable, SharedConfigState: session.SharedConfigEnable,
}) })
if err != nil { if err != nil {
return nil, errors.Wrap(err, "failed to instantiate AWS session") return nil, fmt.Errorf("instantiating AWS session: %w", err)
} }
if awsConfig.AssumeRole != "" { if awsConfig.AssumeRole != "" {

View File

@ -201,7 +201,7 @@ func (im *DynamoDBRegistry) ApplyChanges(ctx context.Context, changes *plan.Chan
key := fromDynamoKey(request.Parameters[0]) key := fromDynamoKey(request.Parameters[0])
for i, endpoint := range filteredChanges.Create { for i, endpoint := range filteredChanges.Create {
if endpoint.Key() == key { if endpoint.Key() == key {
log.Warnf("Skipping endpoint %v because owner does not match", endpoint) log.Infof("Skipping endpoint %v because owner does not match", endpoint)
filteredChanges.Create = append(filteredChanges.Create[:i], filteredChanges.Create[i+1:]...) filteredChanges.Create = append(filteredChanges.Create[:i], filteredChanges.Create[i+1:]...)
// The dynamodb insertion failed; remove from our cache. // The dynamodb insertion failed; remove from our cache.
im.removeFromCache(endpoint) im.removeFromCache(endpoint)
@ -258,10 +258,6 @@ func (im *DynamoDBRegistry) AdjustEndpoints(endpoints []*endpoint.Endpoint) []*e
return im.provider.AdjustEndpoints(endpoints) return im.provider.AdjustEndpoints(endpoints)
} }
/**
DynamoDB registry-specific private methods.
*/
func (im *DynamoDBRegistry) readLabels(ctx context.Context) error { func (im *DynamoDBRegistry) readLabels(ctx context.Context) error {
table, err := im.dynamodbAPI.DescribeTableWithContext(ctx, &dynamodb.DescribeTableInput{ table, err := im.dynamodbAPI.DescribeTableWithContext(ctx, &dynamodb.DescribeTableInput{
TableName: aws.String(im.table), TableName: aws.String(im.table),
@ -428,7 +424,6 @@ func (im *DynamoDBRegistry) addToCache(ep *endpoint.Endpoint) {
func (im *DynamoDBRegistry) removeFromCache(ep *endpoint.Endpoint) { func (im *DynamoDBRegistry) removeFromCache(ep *endpoint.Endpoint) {
if im.recordsCache == nil || ep == nil { if im.recordsCache == nil || ep == nil {
// return early.
return return
} }

View File

@ -294,10 +294,6 @@ func (im *TXTRegistry) AdjustEndpoints(endpoints []*endpoint.Endpoint) []*endpoi
return im.provider.AdjustEndpoints(endpoints) return im.provider.AdjustEndpoints(endpoints)
} }
/**
TXT registry specific private methods
*/
/** /**
nameMapper is the interface for mapping between the endpoint for the source nameMapper is the interface for mapping between the endpoint for the source
and the endpoint for the TXT record. and the endpoint for the TXT record.
@ -452,7 +448,6 @@ func (im *TXTRegistry) addToCache(ep *endpoint.Endpoint) {
func (im *TXTRegistry) removeFromCache(ep *endpoint.Endpoint) { func (im *TXTRegistry) removeFromCache(ep *endpoint.Endpoint) {
if im.recordsCache == nil || ep == nil { if im.recordsCache == nil || ep == nil {
// return early.
return return
} }