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

Issue #1579 TLSRoute Passthrough Conformance Test (normative) #1587

Merged

Conversation

candita
Copy link
Contributor

@candita candita commented Dec 8, 2022

Issue #1579 TLSRoute Passthrough Conformance Test (normative)

What type of PR is this?
/area conformance

What this PR does / why we need it:
This is the first test specified in the TLSRoute Passthrough Conformance Test suite, the normative test. This test may be used as reference to learn more about designing conformance tests, particularly for TLSRoute Passthrough.

Which issue(s) this PR fixes:
This addresses part of Issue #1579

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 8, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @candita. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 8, 2022
@mikemorris
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-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 Dec 8, 2022
Copy link
Contributor

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

Did you test this on any implementations?

app: infra-backend-v4
spec:
containers:
- name: infra-backend-v4
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a 4th backend (with 2 replicas)? Or can we just add TLS to the existing ones?

Copy link
Member

Choose a reason for hiding this comment

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

Agree that reusing an existing backend would be ideal here if we can.

Copy link
Contributor Author

@candita candita Dec 12, 2022

Choose a reason for hiding this comment

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

To conveniently use the existing echoserver image, I created a new backend with the environment variables TLS_SERVER_CERT and TLS_SERVER_PRIVKEY for this image to serve certificates. See https://github.com/kubernetes-sigs/ingress-controller-conformance/blob/master/images/echoserver/echoserver.go#L109.

I also had to supply access to a new secret that is created during test Setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please let me know if this is ok.

Copy link
Member

Choose a reason for hiding this comment

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

I think this could likely be added to an existing backend without breaking any conformance tests. Would be worth trying at least.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The TLS backend, infra-backend-v4, is the only one using port/targetPort 443/8443. It is also the only one setup with env variables TLS_SERVER_CERT and TLS_SERVER_PRIVKEY, which as mentioned directs it to validate certs in the echoserver app.

It works fine with 1 replica for now, and will be reused for the rest of the TLSRoute Passthrough conformance tests. I think putting all of this together, that TLSRoute Passthrough should have its own configuration with non-standard ports and env variables.

I will rename it from infra-backend-v4 to tls-backend so that it is clear that this is a specially configured backend.

Copy link
Member

Choose a reason for hiding this comment

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

I'm OK with a new backend here, but can we add this TLS listener to an existing Gateway instead of adding a new Gateway just for this test?

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks for all the work on this @candita! Looks like a great start.

conformance/tests/tlsroute-simple-same-namespace.go Outdated Show resolved Hide resolved
conformance/tests/tlsroute-simple-same-namespace.go Outdated Show resolved Hide resolved
conformance/tests/tlsroute-simple-same-namespace.go Outdated Show resolved Hide resolved
conformance/base/manifests.yaml Show resolved Hide resolved
app: infra-backend-v4
spec:
containers:
- name: infra-backend-v4
Copy link
Member

Choose a reason for hiding this comment

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

Agree that reusing an existing backend would be ideal here if we can.

conformance/utils/tls/tls.go Outdated Show resolved Hide resolved
conformance/tests/tlsroute-simple-same-namespace.yaml Outdated Show resolved Hide resolved
@candita
Copy link
Contributor Author

candita commented Dec 12, 2022

Did you test this on any implementations?

Yes, I tested on Istio, but had to tweak it to make it get past some of the condition naming updates in Gateway API.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 12, 2022
@candita candita force-pushed the 1452-tls-passthrough-conformance branch from d8212e6 to ab91a3f Compare December 20, 2022 00:43
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 20, 2022
@candita candita force-pushed the 1452-tls-passthrough-conformance branch 3 times, most recently from ffde551 to 22f2099 Compare December 20, 2022 20:37
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @candita! I haven't had a chance to run this test yet, but this looks promising from what I can tell.

conformance/conformance_test.go Outdated Show resolved Hide resolved
app: infra-backend-v4
spec:
containers:
- name: infra-backend-v4
Copy link
Member

Choose a reason for hiding this comment

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

I think this could likely be added to an existing backend without breaking any conformance tests. Would be worth trying at least.

conformance/utils/roundtripper/roundtripper.go Outdated Show resolved Hide resolved
conformance/utils/kubernetes/helpers.go Outdated Show resolved Hide resolved
conformance/utils/kubernetes/helpers.go Outdated Show resolved Hide resolved
conformance/utils/roundtripper/roundtripper.go Outdated Show resolved Hide resolved
@skriss
Copy link
Contributor

skriss commented Dec 21, 2022

JFYI, I was able to run this test and have it pass against Contour's implementation which has support for TLS passthrough. I haven't reviewed the code yet but will try to do so soon. Thanks!

@candita candita force-pushed the 1452-tls-passthrough-conformance branch 2 times, most recently from 0aecd97 to c2db3c5 Compare January 3, 2023 23:05
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 3, 2023
@candita candita force-pushed the 1452-tls-passthrough-conformance branch from dd79b10 to 6a39c14 Compare January 4, 2023 00:01
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 4, 2023
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 9, 2023
@robscott
Copy link
Member

Thanks @candita! This change LGTM, but would like someone else to sign off on this as well.

/cc @skriss @arkodg @shaneutt

Do any of you have time to run through this as well?

/approve

@k8s-ci-robot
Copy link
Contributor

@robscott: GitHub didn't allow me to request PR reviews from the following users: arkodg.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Thanks @candita! This change LGTM, but would like someone else to sign off on this as well.

/cc @skriss @arkodg @shaneutt

Do any of you have time to run through this as well?

/approve

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.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 11, 2023
// for MakeRequestAndExpectEventuallyConsistentResponse to consider the response "consistent"
// before making additional assertions on the response body. If this number is not reached within
// maxTimeToConsistency, the test will fail.
const requiredConsecutiveSuccesses = 3
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should this knob live closer to where maxTimeToConsistency is defined since its applies to the conformance suite in general

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. It was used in http.go as well, so I made it a global parameter of timeoutConfig in timeout.go


```shell
go test ./conformance --gateway-class my-class
go test ./conformance/... -args -gateway-class=istio
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe stick to the neutral my-class string ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. When I began this, I wasn't sure if I needed to create a new gatewayClass, and it was helpful for me to get the example for one implementation. I reworded the rest of this in an attempt to make it clearer to newcomers. Maybe at some point we could list all the gateway-class names.

@@ -43,6 +46,9 @@ type Request struct {
Method string
Headers map[string][]string
UnfollowRedirect bool
CertPem []byte
KeyPem []byte
Server string
Copy link
Contributor

Choose a reason for hiding this comment

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

can the Host field be reused ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered Host and Server to be different. Server is one of the TLSRoute.Spec.Hostnames that aligns with CertPem and KeyPem, and is passed as the TLSClientConfig.ServerName. Since TLSRoute.Spec.Hostnames can contain wildcards, it might not match the host. Ie, we could have a TLS server *.example.com but a request host abc.example.com.

Comment on lines +94 to +97
If you'd like to run a single test instead of the entire conformance suite, find your test name
`(suite.ConformanceTest.ShortName)` and use it like this:
```shell
go test ./conformance/... --run TestConformance/YOURTESTNAME --gateway-class=istio
Copy link
Member

Choose a reason for hiding this comment

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

We can use flag supported-features to specify the tests to run, for example:

go test ./conformance/... -supported-features=TLSRoute -gateway-class=my-class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, I wanted to explain how to run a single test case by name. I haven't quite figured out how to use the supported-features flag to my advantage, so I would ask for someone else to document that.

Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

test works with contour and from a quick look seems correct 👍🏽

@candita
Copy link
Contributor Author

candita commented Jan 18, 2023

@robscott @arkodg thanks for the review. I made some more changes and responded to your comments on changes I didn't make. Could you PTAL when you get a chance ?

Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !

@candita
Copy link
Contributor Author

candita commented Jan 20, 2023

@skriss @shaneutt this has been /approved by @robscott and LGTM by @arkodg. It passes for Istio and Contour. Could one of you please give it the /lgtm and allow to merge?

@candita
Copy link
Contributor Author

candita commented Jan 20, 2023

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 20, 2023
Copy link
Member

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: arkodg, candita, robscott, shaneutt

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

@k8s-ci-robot k8s-ci-robot merged commit 75a2b64 into kubernetes-sigs:main Jan 23, 2023
@k8s-ci-robot
Copy link
Contributor

@candita: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gateway-api-verify 7be6387 link unknown /test pull-gateway-api-verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@shaneutt
Copy link
Member

/retest

@shaneutt shaneutt added this to the v0.6.1 milestone Feb 6, 2023
shaneutt pushed a commit that referenced this pull request Feb 7, 2023
* Issue #1579 TLSRoute Passthrough Conformance Test (normative) rebase

* Issue #1579 TLSRoute Passthrough - PR review update - rebase

* Issue #1579 TLSRoute Passthrough - PR review update - latest
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/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", 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. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants