Skip to content

Commit

Permalink
updated controller to reflect muvaf PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Krish Chowdhary <krish@redhat.com>
  • Loading branch information
krishchow committed Aug 4, 2020
1 parent 5550655 commit fef3791
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions pkg/controller/s3/s3bucketpolicy/s3bucketpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,10 @@ func (e *external) Observe(ctx context.Context, mgd resource.Managed) (managed.E

cr.SetConditions(runtimev1alpha1.Available())

if !cmp.Equal(*policyData, *resp.Policy) {
return managed.ExternalObservation{
ResourceExists: true,
ResourceUpToDate: false,
}, nil
}

// If our version and the external version are the same, we return ResourceUpToDate: true
return managed.ExternalObservation{
ResourceExists: true,
ResourceUpToDate: true,
ResourceUpToDate: cmp.Equal(*policyData, *resp.Policy),
}, nil
}

Expand Down Expand Up @@ -198,8 +191,7 @@ func (e *external) Update(ctx context.Context, mgd resource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.Wrap(err, errUpdate)
}

policyString := *policyData
_, err = e.client.PutBucketPolicyRequest(&awss3.PutBucketPolicyInput{Bucket: aws.String(cr.Spec.PolicyBody.BucketName), Policy: aws.String(policyString)}).Send(context.TODO())
_, err = e.client.PutBucketPolicyRequest(&awss3.PutBucketPolicyInput{Bucket: aws.String(cr.Spec.PolicyBody.BucketName), Policy: aws.String(*policyData)}).Send(context.TODO())
return managed.ExternalUpdate{}, errors.Wrap(err, errUpdate)
}

Expand Down

0 comments on commit fef3791

Please sign in to comment.