Skip to content

Commit

Permalink
Merge branch 'master' into small-fixes-1
Browse files Browse the repository at this point in the history
  • Loading branch information
draychev authored May 9, 2022
2 parents cb1086f + 32e2109 commit d43689c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
9 changes: 2 additions & 7 deletions controllers/iamrole_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ func (r *IamroleReconciler) HandleReconcile(ctx context.Context, req ctrl.Reques
saConsistent := false
saExists, saName := utils.ParseIRSAAnnotation(ctx, iamRole)
if saExists {
// Get the service account in kubernetes
saSpec := k8s.NewK8sManagerClient(r.Client).GetServiceAccount(ctx, iamRole.Namespace, saName)
// If it exists, check the annotations are correct
if saSpec != nil {
if saSpec := k8s.NewK8sManagerClient(r.Client).GetServiceAccount(ctx, iamRole.Namespace, saName); saSpec != nil {
saConsistent = validation.CompareRoleIRSA(ctx, saSpec, *config.Props)
}
}
Expand Down Expand Up @@ -369,10 +367,7 @@ func (StatusUpdatePredicate) Update(e event.UpdateEvent) bool {
oldObj := e.ObjectOld.(*iammanagerv1alpha1.Iamrole)
newObj := e.ObjectNew.(*iammanagerv1alpha1.Iamrole)

if oldObj.Status != newObj.Status {
return false
}
return true
return oldObj.Status == newObj.Status
}

//SetupWithManager sets up manager with controller
Expand Down
7 changes: 2 additions & 5 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ func GetTrustPolicy(ctx context.Context, role *iammanagerv1alpha1.Iamrole) (stri
var statements []iammanagerv1alpha1.TrustPolicyStatement

// Is it IRSA use case
flag, saName := ParseIRSAAnnotation(ctx, role)

//Construct AssumeRoleWithWebIdentity
if flag {

// Construct AssumeRoleWithWebIdentity
if flag, saName := ParseIRSAAnnotation(ctx, role); flag {
hostPath := fmt.Sprintf("%s", strings.TrimPrefix(config.Props.OIDCIssuerUrl(), "https://"))
statement := iammanagerv1alpha1.TrustPolicyStatement{
Effect: "Allow",
Expand Down

0 comments on commit d43689c

Please sign in to comment.