Skip to content
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

feat: update an redirect annotation for ingress resource #975

Merged
merged 31 commits into from
May 11, 2022

Conversation

AlinsRan
Copy link
Contributor

@AlinsRan AlinsRan commented Apr 20, 2022

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What this PR does / why we need it:

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2022

Codecov Report

Merging #975 (c497376) into master (0f4391a) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #975      +/-   ##
==========================================
- Coverage   31.91%   31.90%   -0.01%     
==========================================
  Files          73       73              
  Lines        7953     7955       +2     
==========================================
  Hits         2538     2538              
- Misses       5139     5141       +2     
  Partials      276      276              
Impacted Files Coverage Δ
pkg/kube/translation/annotations/redirect.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f4391a...c497376. Read the comment docs.

@AlinsRan AlinsRan marked this pull request as draft April 21, 2022 00:51
@AlinsRan AlinsRan changed the title update an redirect annotation to the ingress resourceRedirect annotation feat:update an redirect annotation to the ingress resourceRedirect annotation Apr 21, 2022
@AlinsRan AlinsRan changed the title feat:update an redirect annotation to the ingress resourceRedirect annotation feat: update an redirect annotation to the ingress resourceRedirect annotation Apr 21, 2022
@AlinsRan AlinsRan changed the title feat: update an redirect annotation to the ingress resourceRedirect annotation feat: update an redirect annotation to the ingress resource Apr 21, 2022
@AlinsRan AlinsRan marked this pull request as ready for review April 21, 2022 01:48
@jwrookie
Copy link
Contributor

@AlinsRan Hi, some test error, pls have a check

@AlinsRan
Copy link
Contributor Author

@AlinsRan Hi, some test error, pls have a check

This error is suite-plugins, but I only modified suite-annotations.
I again push?

_httpToHttps = AnnotationsPrefix + "http-to-https"
_httpToHttps = AnnotationsPrefix + "http-to-https"
_permanentRedirect = AnnotationsPrefix + "permanent-redirect"
_permanentRedirectCode = AnnotationsPrefix + "permanent-redirect-code"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO since we want to make a permanent redirect, only codes 301 and 308 are allowed, in such a case, let users specify a custom HTTP status code that doesn't comply with the HTTP semantic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to add test cases for other status codes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, we should only allow users configuring 301 or 308 here. If I configure a 302 code here, it doesn't comply the HTTP semantic, because 302 is a "temporarily" redirect, but what we want is "permanent".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tokers @AlinsRan According to RFC 7231 Status codes between 300 and 308 can indicate redirection.

Considering that we will also support temporary redirection, but adding a specific implementation for it alone is not of much value, here I suggest to merge it directly and modify this annotation to http-redirect and http-redirect-code , the corresponding verification logic is, if not configured, the default is http.StatusMovedPermanently, the allowed value is between http.StatusMultipleChoices and http.StatusPermanentRedirect.

Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlinsRan AlinsRan requested a review from tokers April 29, 2022 00:54
@tao12345666333 tao12345666333 added this to the 1.5.0 milestone May 11, 2022
@tao12345666333 tao12345666333 self-assigned this May 11, 2022
@tao12345666333 tao12345666333 added enhancement New feature or request changelog Issues with this label should be added to changelog when public a new release area/controller labels May 11, 2022
@tao12345666333 tao12345666333 merged commit 78efb00 into apache:master May 11, 2022
@AlinsRan AlinsRan deleted the redirect_annotation branch June 9, 2022 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/controller changelog Issues with this label should be added to changelog when public a new release enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants