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

DomainMapping Overriding the default HTTP behavior #12786

Merged
merged 7 commits into from
Apr 7, 2022
Merged

DomainMapping Overriding the default HTTP behavior #12786

merged 7 commits into from
Apr 7, 2022

Conversation

wei840222
Copy link
Contributor

@wei840222 wei840222 commented Mar 27, 2022

Fixes #12755

Proposed Changes

Support annotations 'networking.knative.dev/http-protocol' for Overriding the default HTTP behavior per service in DomainMapping CRD
https://knative.dev/docs/serving/services/http-protocol/#overriding-the-default-http-behavior

Release Note

Support annotations 'networking.knative.dev/http-protocol' for Overriding the default HTTP behavior per service in DomainMapping CRD.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 27, 2022
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wei840222
To complete the pull request process, please assign vagababov after the PR has been reviewed.
You can assign the PR to them by writing /assign @vagababov in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot
Copy link
Contributor

Welcome @wei840222! It looks like this is your first PR to knative/serving 🎉

@knative-prow-robot knative-prow-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/API API objects and controllers labels Mar 27, 2022
@knative-prow-robot
Copy link
Contributor

Hi @wei840222. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@nak3
Copy link
Contributor

nak3 commented Mar 27, 2022

/ok-to-test

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 27, 2022
@codecov
Copy link

codecov bot commented Mar 27, 2022

Codecov Report

Merging #12786 (fa8a94d) into main (ad64980) will decrease coverage by 0.02%.
The diff coverage is 80.95%.

❗ Current head fa8a94d differs from pull request most recent head 7f8fa19. Consider uploading reports for the commit 7f8fa19 to get more accurate results

@@            Coverage Diff             @@
##             main   #12786      +/-   ##
==========================================
- Coverage   87.51%   87.49%   -0.03%     
==========================================
  Files         196      196              
  Lines        9782     9795      +13     
==========================================
+ Hits         8561     8570       +9     
- Misses        934      936       +2     
- Partials      287      289       +2     
Impacted Files Coverage Δ
pkg/reconciler/domainmapping/reconciler.go 91.51% <80.95%> (-0.60%) ⬇️
pkg/reconciler/configuration/configuration.go 84.61% <0.00%> (-1.54%) ⬇️

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 ad64980...7f8fa19. Read the comment docs.

Copy link
Contributor

@nak3 nak3 left a comment

Choose a reason for hiding this comment

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

Left one tiny suggestion but LGTM.

pkg/reconciler/domainmapping/reconciler_test.go Outdated Show resolved Hide resolved
@nak3
Copy link
Contributor

nak3 commented Mar 28, 2022

Could you edit #12786 (comment) and use your description for the Release Note draft as well?

Current DRAFT:

DomainMapping Overriding the default HTTP behavior

TOBE:

Support annotations 'networking.knative.dev/http-protocol' for Overriding the default HTTP behavior per service in DomainMapping CRD.

@wei840222 wei840222 requested a review from nak3 March 28, 2022 05:26
@wei840222
Copy link
Contributor Author

hi @nak3
thx for your suggestion, and I've updated the ut code :)

@wei840222
Copy link
Contributor Author

/retest-required

@wei840222
Copy link
Contributor Author

hi @psschwei comment added

@wei840222 wei840222 requested a review from psschwei March 28, 2022 12:38
Copy link
Contributor

@psschwei psschwei left a comment

Choose a reason for hiding this comment

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

looks good to me, pending the rest of the test suite running

@ZhiminXiang
Copy link

I just realized that actually we already have the similar logic

func getHTTPProtocol(ctx context.Context, annotations map[string]string) (netv1alpha1.HTTPOption, error) {
.

Could we reuse this function? I think we could move the existing function to a shared place as a helper function so that it could be used by this file. WDYT?

@wei840222
Copy link
Contributor Author

@ZhiminXiang I tried. But I found in these lines
https://github.com/knative/serving/blob/main/pkg/reconciler/route/resources/ingress.go#L220
https://github.com/knative/serving/pull/12786/files#diff-ebdda38d8b796c4f5e3b7e5ed54460483d22b3fd1d273de3b91a739c93aa59d6R337

The *config.Config are different type knative.dev/serving/pkg/reconciler/route/config.Config & knative.dev/serving/pkg/reconciler/domainmapping/config.Config
I think if method reuse is going to happen, maybe more changes will be introduced in this change.

@ZhiminXiang
Copy link

The *config.Config are different type knative.dev/serving/pkg/reconciler/route/config.Config & knative.dev/serving/pkg/reconciler/domainmapping/config.Config
I think if method reuse is going to happen, maybe more changes will be introduced in this change.

Could we modify the helper function to getHTTPOption(networkConfig *network.Config, annotations map[string]string) (netv1alpha1.HTTPOption, error). This function could be reused by DomainMapping and Route. I am inclined to share the logic between DomainMapping and Route because essentially the logic of getting HTTP option for those two objects should be the same.

@wei840222
Copy link
Contributor Author

Hi
@ZhiminXiang I've changed the relevant code. plz check. thx :)

Copy link

@ZhiminXiang ZhiminXiang left a comment

Choose a reason for hiding this comment

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

Thanks @wei840222 for adopting the suggestion! It is in a good shape.

I left two small comments. After those two are addressed, this PR should be ready to merge. Thanks again!

pkg/reconciler/util.go Outdated Show resolved Hide resolved
pkg/reconciler/util.go Outdated Show resolved Hide resolved
@wei840222
Copy link
Contributor Author

Hi, @ZhiminXiang changes applied, plz check. thx a lot :)

Copy link

@ZhiminXiang ZhiminXiang left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2022
@knative-prow
Copy link

knative-prow bot commented Apr 7, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wei840222, ZhiminXiang

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 7, 2022
@ZhiminXiang
Copy link

Hi, @ZhiminXiang changes applied, plz check. thx a lot :)

Thanks for making the contribution!

@knative-prow knative-prow bot merged commit 39c7b5b into knative:main Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers area/networking lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DomainMapping HTTPS redirection
5 participants