-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Add force-enable-realip-module #5887
Add force-enable-realip-module #5887
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
Welcome @dschwar! |
Hi @dschwar. Thanks for your PR. I'm waiting for a kubernetes 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. |
/ok-to-test |
/check-cla |
6ea6599
to
41bf982
Compare
@aledbf what do you think of the naming? The idea here is to be able to control enablement of Real IP module independent UseForwardedHeaders and Proxy Protocol. Because sometimes we need to configure Real IP module only, but not trust X-Forwarded-Host and X-Forwarded-Proto headers. |
@dschwar can you also add another test case that tests this new setting in combination with UseForwardedHeaders setting? |
@dschwar we will also need a docs adjustment once we agree on the change. Alternative to this would be relying on https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#proxy-real-ip-cidr to toggle the configuration of Real IP module. But that would be implicit and would introduce backward incompatibility. |
57e07ad
to
5fa73d9
Compare
Given we have Also @dschwar I think it would be a lot cleaner to implement @XaF's idea about setting the value of Once these two things are addressed we can merge this PR (you will also need to squash the commits). |
I played around with this and I feel like it introduces a lot of complexity and fragility to determine if we should enable realip. I'd prefer not to go with this. We'd end up with code like
which isn't cleaner IMO. |
75d0aed
to
4a5536b
Compare
@@ -712,6 +715,7 @@ func NewDefault() Configuration { | |||
EnableUnderscoresInHeaders: false, | |||
ErrorLogLevel: errorLevel, | |||
UseForwardedHeaders: false, | |||
EnableRealIp: 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.
Not sure if this is needed, @ElvinEfendi can you confirm?
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, we want to default this to false
. (It probably defaults to false
when unset but better be explicit)
3448126
to
21c3620
Compare
980fe74
to
d52141c
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dschwar, ElvinEfendi 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 |
/hold |
I will remove the hold after the 0.34.1 release |
@aledbf assuming this release is for the bug fix and will happen shortly? |
Yes |
I usually prefer logic in code than in templates. Code is for logic, templates not as much. Wouldn't a loop solve the readability complexity here? enableRealIpParameters := []..{useForwardedHeaders, useProxyProtocol, enableRealIp}
shouldEnableRealIp := false
for _, parameter := range enableRealIpParameters {
if val, ok := conf[parameter]; ok {
b, _ := strconv.ParseBool(val)
if b {
shouldEnableRealIp = true
}
}
} Not feeling too strongly about this though, as long as the feature is there! |
@aledbf it looks like 0.34.1 has been released, can we merge this? |
/hold cancel |
What this PR does / why we need it:
Types of changes
Which issue/s this PR fixes
How Has This Been Tested?
Checklist: