-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 FastCGI backend support (#2982) #4344
Add FastCGI backend support (#2982) #4344
Conversation
Welcome @cdemers! |
Hi @cdemers. 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. |
@cdemers thank you for working on this feature. |
/ok-to-test |
docs/user-guide/fcgi-services.md
Outdated
kubernetes.io/ingress.class: "nginx" | ||
nginx.ingress.kubernetes.io/backend-protocol: "FCGI" | ||
nginx.ingress.kubernetes.io/fastcgi-index: "index.php" | ||
nginx.ingress.kubernetes.io/fastcgi-params: "[\"SCRIPT_FILENAME /example/index.php\", \"HTTP_PROXY \\\"\\\"\"]" |
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.
We try to avoid this kind of annotation. Please use a configmap to store the configuration. Check https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#add-headers
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.
That's an excellent suggestion! We did spend some time discussing this annotation and never thought about using a config map!
@@ -1295,6 +1295,16 @@ stream { | |||
{{ range $errCode := $location.CustomHTTPErrors }} | |||
error_page {{ $errCode }} = @custom_{{ $location.DefaultBackendUpstreamName }}_{{ $errCode }};{{ end }} | |||
|
|||
{{ if (eq $location.BackendProtocol "FCGI") }} | |||
include /etc/nginx/fastcgi_params; |
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 file doesn't exist (we do not copy unnecessary files from the default directory.)
We need to copy /usr/local/openresty/nginx/conf/fastcgi_params to /etc/nginx
import ( | ||
"encoding/json" | ||
|
||
extensions "k8s.io/api/extensions/v1beta1" |
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.
We replace this with k8s.io/api/networking/v1beta1
. Make this change in all the files located in the PR
@cdemers please add e2e tests |
Thanks for the comments! We'll get back with the corrections. I'm surprised that the pull-ingress-nginx-test failed however, it did work when we ran the tests (and compiled) locally. Any way, we'll find out what's happening, thanks again |
Codecov Report
@@ Coverage Diff @@
## master #4344 +/- ##
==========================================
+ Coverage 58.5% 58.63% +0.13%
==========================================
Files 87 88 +1
Lines 6528 6569 +41
==========================================
+ Hits 3819 3852 +33
- Misses 2281 2288 +7
- Partials 428 429 +1
Continue to review full report at Codecov.
|
/approve |
@aledbf We left two commits so you could see what was changed after your comments, would you like us to squash them for the person who will /lgtm ? |
@cdemers yes, please squash the commits |
Co-authored-by: Pierrick Charron <[email protected]>
} | ||
|
||
// NewNewFastCGIHelloServerDeploymentWithReplicas creates a new deployment of the | ||
// fortune teller image in a particular namespace. Number of replicas is configurable |
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.
fortune teller image
is this actually fortune teller image?
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, sorry, we missed this in the comments
f.WaitForNginxServer(host, | ||
func(server string) bool { | ||
return Expect(server).Should(ContainSubstring("fastcgi_param SCRIPT_FILENAME \"/home/www/scripts/php$fastcgi_script_name\";")) && | ||
Expect(server).Should(ContainSubstring("fastcgi_param REDIRECT_STATUS \"200\";")) |
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.
Would it make sense to include the value of these env vars in response and assert on response (I realize that requires modifying the fastcgi hello world Go app)? IMHO that would be more "end-to-end" than asserting on configuration directive.
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.
The last test in this file is the one which does the complete end-to-end proof. We did not wish to test all the annotations end-to-end because it made the test more fragile since it also tests nginx logic. Therefore, we did one full end-to-end test and the others have a slightly smaller scope, only testing that we are generating the correct configuration. If you prefer we can modify the hello image to include those variable to have every test be end-to-end.
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 feel too strongly about this.
/lgtm Thanks for the feature! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aledbf, cdemers, 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 |
Co-authored-by: Pierrick Charron [email protected]
What this PR does / why we need it: Adds FastCGI backend support.
Which issue this PR fixes: fixes #2982
Special notes for your reviewer: This is our first implementation, any comments, insults and congratulations are very welcome.