-
Notifications
You must be signed in to change notification settings - Fork 71
add IAM Auth Policy create/update/delete #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Test Coverage Report for Build 6657681222
💛 - Coveralls |
xWink
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for happy path, just a few small requests
3beaef1 to
8934787
Compare
zijun726911
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you describe some manually tests you did for the PR?
Overall LGTM, This code got rid of our old cumbersome style: ModelBuilder, StackDeployer... Hopfully all our later controller code(that handle new kind of k8s resource) could do that. I really love this new version.
| } | ||
| } else { | ||
| if controllerutil.ContainsFinalizer(k8sPolicy, authPolicyFinalizer) { | ||
| controllerutil.RemoveFinalizer(k8sPolicy, authPolicyFinalizer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When handling resouce deletion, we should do RemoveFinalizer() at very last, to avoid actual reconcile logic return err and k8s api server lose track of that IAMAuthPolicy resource?
For example, in our other controller:
aws-application-networking-k8s/controllers/route_controller.go
Lines 195 to 204 in 658bb6e
| if err := r.cleanupRouteResources(ctx, route); err != nil { | |
| return fmt.Errorf("failed to cleanup GRPCRoute %s, %s: %w", route.Name(), route.Namespace(), err) | |
| } | |
| if err := updateRouteListenerStatus(ctx, r.client, route); err != nil { | |
| return err | |
| } | |
| r.log.Infow("reconciled", "name", req.Name) | |
| return r.finalizerManager.RemoveFinalizers(ctx, route.K8sObject(), routeTypeToFinalizer[r.routeType]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RemoveFinalizer() only mutates object, but does not call kube-api. Need to do client.Update/Patch to apply changes.
In my case I do update at the very last step in Reconcile function, so until then finalizer is not added or removed
@zijun726911 updated description with manual tests |
zijun726911
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Note:
Add model and manager for IAM Auth Policy. Currently handles only happy path when SN or Svc exists. If Lattice targetRef does not exists will print NotFound exceptions and retry later.
Always change AuthPolicy for Sn and Svc to AWS_IAM on upsert.
Tests:
Created SN and Svc in Lattice console. Applied and deleted
examples/iam-auth-policy-example.yamlfor SN and Svc.