Skip to content

Commit

Permalink
Only use AWS ECR auth if no secret given
Browse files Browse the repository at this point in the history
Checking for ECR whether or not there's a secret referenced means the
reconciliation can fail despite there being a valid credential. If you
are not running in EKS (or otherwise with AWS IAM permissions), but
using ECR, you will still want to be able to supply a secret.

Signed-off-by: Michael Bridgen <[email protected]>
  • Loading branch information
squaremo committed Oct 5, 2021
1 parent bbd04a3 commit 6de3efa
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions controllers/imagerepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,7 @@ func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1
return err
}
options = append(options, remote.WithAuth(auth))

}

if accountId, awsEcrRegion, ok := parseAwsImage(imageRepo.Spec.Image); ok {
} else if accountId, awsEcrRegion, ok := parseAwsImage(imageRepo.Spec.Image); ok {
if r.UseAwsEcr {
logr.FromContext(ctx).Info("Logging in to AWS ECR for " + imageRepo.Spec.Image)

Expand Down

0 comments on commit 6de3efa

Please sign in to comment.