-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Annotations/AuthTLS: Allow named redirects. #13752
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
Annotations/AuthTLS: Allow named redirects. #13752
Conversation
Signed-off-by: Dean Coakley <[email protected]>
Welcome @Dean-Coakley! |
Hi @Dean-Coakley. 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-ingress-nginx canceled.
|
I drafted a test case but it does not look like many input cases are normally added. Let me know if it is desired to be included or fine as-is. diff --git a/internal/ingress/annotations/authtls/main_test.go b/internal/ingress/annotations/authtls/main_test.go
index 37342e513..acdf3a017 100644
--- a/internal/ingress/annotations/authtls/main_test.go
+++ b/internal/ingress/annotations/authtls/main_test.go
@@ -163,15 +163,38 @@ func TestAnnotations(t *testing.T) {
if u.ValidationDepth != 2 {
t.Errorf("expected %v but got %v", 2, u.ValidationDepth)
}
- if u.ErrorPage != "ok.com/error" {
- t.Errorf("expected %v but got %v", "ok.com/error", u.ErrorPage)
- }
if u.PassCertToUpstream != true {
t.Errorf("expected %v but got %v", true, u.PassCertToUpstream)
}
if u.MatchCN != "CN=(hello-app|ok|goodbye)" {
t.Errorf("expected %v but got %v", "CN=(hello-app|ok|goodbye)", u.MatchCN)
}
+
+ for _, tc := range []struct {
+ name string
+ errorPage string
+ want string
+ }{
+ {"named redirect", "@401", "@401"},
+ {"named redirect", "@four_oh_one", "@four_oh_one"},
+ {"url redirect", "ok.com/error", "ok.com/error"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ data[parser.GetAnnotationWithPrefix(annotationAuthTLSErrorPage)] = tc.errorPage
+ ing.SetAnnotations(data)
+ i, err := NewParser(fakeSecret).Parse(ing)
+ if err != nil {
+ t.Errorf("Unexpected error with ingress: %v", err)
+ }
+ u, ok := i.(*Config)
+ if !ok {
+ t.Errorf("expected *Config but got %v", u)
+ }
+ if u.ErrorPage != tc.want {
+ t.Errorf("expected %v but got %v", tc.want, u.ErrorPage)
+ }
+ })
+ }
} |
@Dean-Coakley |
True. From: https://nginx.org/en/docs/http/ngx_http_core_module.html#location
If you search around that doc for "@" you can see plenty of examples of other named rewrites. Will update |
Signed-off-by: Dean Coakley <[email protected]>
This reverts commit 7de5a59.
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.
Please implement tests for this. Thank you!
@Gacko As I mentioned, this bug currently blocks our ability to upgrade, so I'd really like a 1.13.2 release with this change. Will you backport this change to the 1.13 branch after merging? |
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.
/triage accepted
/kind bug
/priority backlog
/lgtm
/cherry-pick release-1.13 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Dean-Coakley, Gacko 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 |
/cherry-pick release-1.12 |
@Gacko: once the present PR merges, I will cherry-pick it on top of In response to this:
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. |
@Gacko: once the present PR merges, I will cherry-pick it on top of In response to this:
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. |
Some reasoning for why this is being back-ported: Annotation validation can be restrictive, but it shouldn't. At best it allows everything that's valid from an NGINX configuration point of view. And since annotation validation is breaking valid use cases here, this PR can be seen as a bug fix. |
/unhold |
@Gacko: new pull request created: #13819 In response to this:
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. |
@Gacko: new pull request created: #13820 In response to this:
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. |
What this PR does / why we need it:
fixes: #13736
nginx.ingress.kubernetes.io/auth-tls-error-page
annotation.Types of changes
Which issue/s this PR fixes
How Has This Been Tested?
Checklist: