-
Notifications
You must be signed in to change notification settings - Fork 50
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
Support security groups with cyclic references #213
Support security groups with cyclic references #213
Conversation
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.
Great work on this Tibi, thank you!
I left a few comments/questions below
helm/values.yaml
Outdated
featureGates: {} | ||
# featureGate1: true | ||
# featureGate2: false | ||
featureGates: | ||
CARMv2: false |
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.
I think we need #214 before merging this
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.
Agreed
ec2_validator.assert_security_group(resource_id_1, exists=False) | ||
ec2_validator.assert_security_group(resource_id_2, exists=False) | ||
ec2_validator.assert_security_group(resource_id_3, exists=False) |
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.
Can we also assert the the kubernetes resources are marked as ACKSynced=true?
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.
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.
Ohhh correct, my eyes were looking for this call https://github.com/aws-controllers-k8s/test-infra/blob/main/src/acktest/k8s/condition.py#L69 - but your appraoch is correct as well
sgCpy := r.ko.DeepCopy() | ||
sgCpy.Spec.IngressRules = nil | ||
sgCpy.Spec.EgressRules = nil | ||
if err := rm.syncSGRules(ctx, &resource{ko: sgCpy}, r); err != nil { | ||
return nil, err |
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.
Do we need to detach the rules before SG deletion?
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.
Yes, otherwise we constantly run into a circular DependencyViolation
error.
3c79f32
to
2aac5ea
Compare
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.
Great stuff! 🎉
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, TiberiuGC The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue #, if available: aws-controllers-k8s/community#2119 Description of changes: Cyclic references support is done via. the following workflow: 1. skip runtime reference state validations by setting `SecurityGroup.Rules.UserIDGroupPairs.GroupID.skip_resource_state_validations: true` (see aws-controllers-k8s/code-generator#544). This allows runtime to proceed with the `sdkCreate` call. 2. inside `sdkCreate` and `sdkUpdate` add custom logic that checks whether referenced security groups are being created on AWS end (i.e. `groupID != nil`). If the checks succeed, move forward with syncing SG rules. Otherwise, requeue and wait for all referenced SGs to be created. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: aws-controllers-k8s/community#2119
Description of changes:
Cyclic references support is done via. the following workflow:
SecurityGroup.Rules.UserIDGroupPairs.GroupID.skip_resource_state_validations: true
(see Allow skipping state validations for resources that support cyclic references code-generator#544). This allows runtime to proceed with thesdkCreate
call.sdkCreate
andsdkUpdate
add custom logic that checks whether referenced security groups are being created on AWS end (i.e.groupID != nil
). If the checks succeed, move forward with syncing SG rules. Otherwise, requeue and wait for all referenced SGs to be created.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.