-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added support for setting Proxy protocol per target group based on ServicePort #4079
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
Added support for setting Proxy protocol per target group based on ServicePort #4079
Conversation
Hi @pthak94. 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. |
862e07e
to
800bb02
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.
Thank you for the contribution. Please consider my comment.
docs/guide/service/annotations.md
Outdated
| [service.beta.kubernetes.io/aws-load-balancer-internal](#lb-internal) | boolean | false | deprecated, in favor of [aws-load-balancer-scheme](#lb-scheme) | | ||
| [service.beta.kubernetes.io/aws-load-balancer-scheme](#lb-scheme) | string | internal | | | ||
| [service.beta.kubernetes.io/aws-load-balancer-proxy-protocol](#proxy-protocol-v2) | string | | Set to `"*"` to enable | | ||
| [service.beta.kubernetes.io/aws-load-balancer-proxy-protocol-per-target-group](#proxy-protocol-v2) | string | | If specified,configures proxy protocol per targrt group based on ServicePort. For example `"80, true, 443, true, 22, false"` will disable proxy protocol for port 22 only. This annotation is overriden by `"service.beta.kubernetes.io/aws-load-balancer-proxy-protocol"` | |
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 don't think this is the correct way to model this information. How about just using a single list 80,443
to denote that those ports should have proxy protocol enabled.
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.
hmm, that indeed makes it simpler. I'll work on your suggestions shortly. Thanks!
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.
@zac-nixon added a new commit with the updated logic. Tweaked the tests and doc as well. Pls take a look.
if _, enabled := enabledPorts[currentPortStr]; enabled { | ||
rawAttributes[tgAttrsProxyProtocolV2Enabled] = "true" | ||
} else { | ||
rawAttributes[tgAttrsProxyProtocolV2Enabled] = "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.
to keep existing behavior, can you remove this line? the default for this attribute is false anyways.
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.
@zac-nixon I'm assuming you meant remove only the else block and not the whole line. I can't think of any scenario where this can break the existing behavior. Can you please help me understand?
The intention of having the else block is for a situation where these attributes are set:
"service.beta.kubernetes.io/aws-load-balancer-target-group-attributes": tgAttrsProxyProtocolV2Enabled + "=true"
"service.beta.kubernetes.io/aws-load-balancer-proxy-protocol-per-target-group": "80, 443"
in this case, our new annotation will not do what we say it does, that is disable proxy_protocol for unspecified port 22. It will just enable it for all.
"service.beta.kubernetes.io/aws-load-balancer-proxy-protocol": "*"
still overrides everything as the documentation says.
Do let me know what you think?
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.
Thanks for the explanation. I was just thinking that it would be nice to not have the false
value set when we didn't need it. But I'm happy with the implementation as-is and I appreciate the work you did here :)
overall looks pretty good. please consider my comment. i appreciate the contribution! |
/ok-to-test |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: pthak94 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 |
Thanks @zac-nixon :) Do you know when this will be released? we'd like to deploy it on our production environments. |
Issue
#3877
Description
Introduced a new annotation "service.beta.kubernetes.io/aws-load-balancer-proxy-protocol-per-target-group" with which, proxy protocol setting can be configured for each target group individually. Example usage is "80, 443", which will enable proxy protocols for the target groups associated to port 80 and 443 listeners. And disable for the rest, for example port 22.
To achieve this, when target group is created, it's service port is compared to the value of this annotation, if it's found, it's value is set to true, otherwise set to false.
"service.beta.kubernetes.io/aws-load-balancer-proxy-protocol" annotation still overrides this new annotation.
Added test cases to check if the new annotation works, and that it is still overriden by "service.beta.kubernetes.io/aws-load-balancer-proxy-protocol" annotation.
Finally, added documentation regarding this new annotation.
This version of controller is tested in my EKS testing environment.
-->
Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯