- 
                Notifications
    
You must be signed in to change notification settings  - Fork 60
 
Add support for ManagedPrefixLists in EC2 controller #295
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
base: main
Are you sure you want to change the base?
Conversation
| 
           Hi @alexcristi. Thanks for your PR. I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with  Once the patch is verified, the new status will be reflected by the  I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.  | 
    
| 
           [APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: alexcristi The full list of commands accepted by this bot can be found here. 
Needs approval from an approver in each of these files:
 
      Approvers can indicate their approval by writing   | 
    
| 
           /ok-to-test  | 
    
| 
           @alexcristi: It looks like there's some compilation issues with these changes. Any chance there's some un-pushed commits?  | 
    
| 
           Thank you for taking time to look at this @knottnt, really appreciate it!  | 
    
| 
           Hold on, I need to test it again  | 
    
        
          
                templates/hooks/managed_prefix_list/sdk_update_pre_build_request.go.tpl
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | // If we don't have an ID yet, filter by both owner ID and prefix list name | ||
| // This prevents matching against AWS-managed prefix lists | ||
| // and other user-owned prefix lists with different names | ||
| filters := []svcsdktypes.Filter{ | 
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.
Q: Is this combination guaranteed to be unique?
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.
No, it is not, the only primary key is prefixListID. If there is already a prefix list in the target account, we should either adopt it or change the prefix list name in our manifest - I know, this is a "new contract" we artificially introduce so that the prefix list names must be unique; and yes, the controller will error out with the "resource already exists" message.
However, if we rely only on prefix list ID as the filter, how do we prevent resource leaks/resource storm in case of AWS issues and we don't get a response back, or the response is malformed/missing the ID? Would you point me on how you guys solved it for different resources, please? Can we use UUID tags, for example?
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.
Looking at the other EC2 resources we check are currently checking if the resource has an ID set in the status and if that hasn't been set yet we are assuming it is a new resource. You can see an example of this in the DHCP Options. Generally, we don't want to enforce ACK specific contracts on top of the AWS Service API.
For the case of never hearing back from AWS I don't think we currently have a good solution for that if it happens during the Create operation. Right now, the controller will see a timeout failure of the Create api call and will retry on the next reconciliation loop. Solving the issue will likely require one or more improvements to the ACK runtime since we'll need to store information across reconciliation loops and potentially handle recovery when a "leaked" create is detected. Coming up with a general solution across a service/resource is also difficult since support for tagging, filtering by tag, and idempotency tokens varies between services and by resources within services.
In this case storing a UUID as a tag and then filtering the DescribeManagedPrefixLists response by that tag could work since that API does return tags for the resource. However, we'd need to add a way to store/retrieve this the UUID across reconciliation loops which seems out of scope for this PR.
        
          
                templates/hooks/managed_prefix_list/sdk_create_post_set_output.go.tpl
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | 
           /retest  | 
    
| 
           @alexcristi: The following test failed, say  
 Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.  | 
    
| 
           @knottnt - Also, what do you want me to do with   | 
    
          
 @alexcristi That's a new optional PR check that we're testing out. Right now it's just informational for the reviewer. Since, the ec2-controller hasn't been rebuilt with   | 
    
Issue #, if available: aws-controllers-k8s/community#2665
Description of changes:
Added support for ManagedPrefixLists. This was validated with a KIND local cluster, and here are the results: