Skip to content

Commit

Permalink
permissions.go: configure crendential check with installer session
Browse files Browse the repository at this point in the history
previously the credential checker created an independent session, therefore all the configuration
done by installer like increasing MaxRetries etc were skipped.
  • Loading branch information
abhinavdahiya committed Mar 15, 2020
1 parent 337fef0 commit fb58d0b
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/asset/installconfig/aws/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
package aws

import (
"fmt"

"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

ccaws "github.com/openshift/cloud-credential-operator/pkg/aws"
"github.com/openshift/installer/pkg/version"
)

// PermissionGroup is the group of permissions needed by cluster creation, operation, or teardown.
Expand Down Expand Up @@ -231,14 +229,9 @@ func ValidateCreds(ssn *session.Session, groups []PermissionGroup, region string
requiredPermissions = append(requiredPermissions, groupPerms...)
}

creds, err := ssn.Config.Credentials.Get()
if err != nil {
return errors.Wrap(err, "getting creds from session")
}

client, err := ccaws.NewClient([]byte(creds.AccessKeyID), []byte(creds.SecretAccessKey), fmt.Sprintf("OpenShift/4.x Installer/%s", version.Raw))
client, err := ccaws.NewClientFromIAMClient(iam.New(ssn))
if err != nil {
return errors.Wrap(err, "initialize cloud-credentials client")
return errors.Wrap(err, "failed to create client for permission check")
}

sParams := &ccaws.SimulateParams{
Expand Down

0 comments on commit fb58d0b

Please sign in to comment.