You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/12/04 11:30:18 UTC

[GitHub] [apisix-ingress-controller] An-DJ opened a new pull request, #1487: feat: support annotation of response-rewrite

An-DJ opened a new pull request, #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487

   <!-- Please answer these questions before submitting a pull request -->
   
   ### Type of change:
   
   <!-- Please delete options that are not relevant. -->
   
   - [ ] Bugfix
   - [X] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   Support 4 annotations of response-rewrite:
   * k8s.apisix.apache.org/enable-response-rewrite
   * k8s.apisix.apache.org/response-rewrite-status-code
   * k8s.apisix.apache.org/response-rewrite-body
   * k8s.apisix.apache.org/response-rewrite-body-base64
   
   Close #575
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the requirements:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. Use "request review" to notify the reviewer once you have resolved the review
   -->
   
   * [X] Did you explain what problem does this PR solve? Or what new features have been added?
   * [X] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [X] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix-ingress-controller#community) first**
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] An-DJ commented on a diff in pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
An-DJ commented on code in PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#discussion_r1040416636


##########
pkg/providers/ingress/translation/annotations/plugins/response_rewrite.go:
##########
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package plugins
+
+import (
+	"github.com/apache/apisix-ingress-controller/pkg/providers/ingress/translation/annotations"
+	apisixv1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+	"strconv"
+)
+
+type responseRewrite struct{}
+
+// NewResponseRewriteFHandler creates a handler to convert annotations about
+// ResponseRewrite to APISIX response-rewrite plugin.
+func NewResponseRewriteFHandler() PluginAnnotationsHandler {

Review Comment:
   > What does the F mean here?
   
   Sorry for my spelling mistake... It has been corrected in the new commit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] An-DJ commented on pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
An-DJ commented on PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#issuecomment-1336387750

   @tao12345666333 PTAL


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] lingsamuel commented on a diff in pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
lingsamuel commented on code in PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#discussion_r1039090929


##########
pkg/providers/ingress/translation/annotations/plugins/response_rewrite.go:
##########
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package plugins
+
+import (
+	"github.com/apache/apisix-ingress-controller/pkg/providers/ingress/translation/annotations"
+	apisixv1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+	"strconv"
+)
+
+type responseRewrite struct{}
+
+// NewResponseRewriteFHandler creates a handler to convert annotations about
+// ResponseRewrite to APISIX response-rewrite plugin.
+func NewResponseRewriteFHandler() PluginAnnotationsHandler {

Review Comment:
   What does the F mean here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] tao12345666333 commented on pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#issuecomment-1336431995

   Thanks
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] tao12345666333 merged pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
tao12345666333 merged PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] lingsamuel commented on pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
lingsamuel commented on PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#issuecomment-1336646438

   Please fix the linter errors.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] An-DJ commented on a diff in pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
An-DJ commented on code in PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#discussion_r1040415179


##########
test/e2e/suite-annotations/response_rewrite.go:
##########
@@ -0,0 +1,136 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package annotations
+
+import (
+	"fmt"
+	"net/http"
+	"time"
+
+	ginkgo "github.com/onsi/ginkgo/v2"
+	"github.com/stretchr/testify/assert"
+
+	"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
+)
+
+// suite-annotations: response-rewrite annotations
+var _ = ginkgo.Describe("suite-annotations: response-rewrite", func() {
+	s := scaffold.NewDefaultScaffold()
+
+	ginkgo.It("enable in ingress networking/v1", func() {

Review Comment:
   > Please add test case to cover `networking/v1beta1` and `extensions/v1beta1`. Although they are old, we still support their use
   
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] codecov-commenter commented on pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#issuecomment-1336432642

   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1487?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1487](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1487?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (003a70a) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/ed92690f5aabb4ece4b92d860d72d85bdfa23db0?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ed92690) will **increase** coverage by `0.09%`.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1487      +/-   ##
   ==========================================
   + Coverage   41.26%   41.35%   +0.09%     
   ==========================================
     Files          83       84       +1     
     Lines        7365     7377      +12     
   ==========================================
   + Hits         3039     3051      +12     
     Misses       3972     3972              
     Partials      354      354              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1487?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ingress/translation/annotations/plugins/plugins.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1487/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3Byb3ZpZGVycy9pbmdyZXNzL3RyYW5zbGF0aW9uL2Fubm90YXRpb25zL3BsdWdpbnMvcGx1Z2lucy5nbw==) | `0.00% <ø> (ø)` | |
   | [...ranslation/annotations/plugins/response\_rewrite.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1487/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3Byb3ZpZGVycy9pbmdyZXNzL3RyYW5zbGF0aW9uL2Fubm90YXRpb25zL3BsdWdpbnMvcmVzcG9uc2VfcmV3cml0ZS5nbw==) | `100.00% <100.00%> (ø)` | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] An-DJ commented on pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
An-DJ commented on PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#issuecomment-1338697826

   > Please fix the linter errors.
   
   Done. It's like the first-time contributor can't actively trigger the test workflows, could you approve them? : )


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] tao12345666333 commented on a diff in pull request #1487: feat: support annotation of response-rewrite

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on code in PR #1487:
URL: https://github.com/apache/apisix-ingress-controller/pull/1487#discussion_r1039080812


##########
test/e2e/suite-annotations/response_rewrite.go:
##########
@@ -0,0 +1,136 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package annotations
+
+import (
+	"fmt"
+	"net/http"
+	"time"
+
+	ginkgo "github.com/onsi/ginkgo/v2"
+	"github.com/stretchr/testify/assert"
+
+	"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
+)
+
+// suite-annotations: response-rewrite annotations
+var _ = ginkgo.Describe("suite-annotations: response-rewrite", func() {
+	s := scaffold.NewDefaultScaffold()
+
+	ginkgo.It("enable in ingress networking/v1", func() {

Review Comment:
   Please add test case to cover `networking/v1beta1` and `extensions/v1beta1`. Although they are old, we still support their use



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org