-   Notifications  
You must be signed in to change notification settings  - Fork 1.6k
 
support cli flag to enable manage backend SG rules for ALB #4145
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
|   
 
  |  
|   Welcome @shuqz!   |  
|   Hi @shuqz. Thanks for your PR. I'm waiting for a kubernetes-sigs 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-sigs/prow repository.  |  
   docs/deploy/security_groups.md  Outdated    
 | - To enable managing backend security group rules for all resources, using cli flag `--enable-manage-backend-security-group-rules` | ||
| - when set to `true`, the controller will automatically manage backend security group rules for all resources | ||
| - individual ingress annotation takes precedence over cli flag, meaning it can be overridden with annotation `alb.ingress.kubernetes.io/manage-backend-security-group-rules: "false"` | ||
| - for this to take effect, `--enable-backend-security-group` needs to be true and user explicitly specify security group using annotation: alb.ingress.kubernetes.io/security-groups | 
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.
Make sure to include the nlb annotation :) when you add support.
   pkg/ingress/model_builder.go  Outdated    
 | defaultTargetType: elbv2model.TargetType(defaultTargetType), | ||
| defaultLoadBalancerScheme: elbv2model.LoadBalancerScheme(defaultLoadBalancerScheme), | ||
| enableBackendSG: enableBackendSG, | ||
| enableManageBackendSGRules: enableManageBackendSecurityGroupRules, | 
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.
nit: can you call this defaultEnableManageBackendSGRules to denote that this is the default value.
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.
it is defined in a different package(ingress VS config), i can export it if want to. but i do not know why we want to do this. based on the current pattern we have in this function, we do not denote any default value? the default value is assigned in func (cfg *ControllerConfig) BindFlags(fs *pflag.FlagSet) let me know if i misunderstand it.
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.
synced offline, will update the name
   pkg/ingress/model_builder.go  Outdated    
 | // first check cli flag | ||
| if t.enableManageBackendSGRules { | ||
| manageSGRules = t.enableManageBackendSGRules | ||
| t.logger.Info("Enable manage backend security group rules flag is configured to be true via cli flag.") | 
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.
this log message might get noisy. Recommend removing it or adding .V(1) to the the log.
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 will update it with .V(1)
   pkg/ingress/model_builder.go  Outdated    
 | func (t *defaultModelBuildTask) buildManageSecurityGroupRulesFlag(_ context.Context) (bool, error) { | ||
| explicitManageSGRulesFlag := make(map[bool]struct{}) | ||
| manageSGRules := false | ||
| manageSGRules := false // default value | 
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.
you could save some LoC by just doing
manageSGRules := t.enableManageBackendSGRules 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.
also found a little bug for case when annotation is not specified, going to fix it
   pkg/ingress/model_builder.go  Outdated    
 | manageSGRules = rawManageSGRule | ||
| if rawManageSGRule != manageSGRules { | ||
| manageSGRules = rawManageSGRule | ||
| t.logger.Info("Override enable manage backend security group rules flag with annotation", "value: ", rawManageSGRule, "for ingress", k8s.NamespacedName(member.Ing).String(), "in ingress yaml file") | 
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.
same comment, might get noisy.
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
|   /ok-to-test  |  
remove auto-generated file address comments support enable manage backend SG rules for NLB
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
|   [APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: shuqz, zac-nixon 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   |  
|   /lgtm  |  
Issue
#4086
Description
This change introduces a new CLI flag named
--enable-manage-backend-security-group-ruleswhich takes true|false, default is false. This change applies to ALB for now, NLB will be fast follow-up.Checklist
README.md, or thedocsdirectory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯