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

Add option to run all e2e tests with different http and https settings #5157

Merged
merged 3 commits into from
Nov 6, 2019

Conversation

taragu
Copy link
Contributor

@taragu taragu commented Aug 14, 2019

/lint

Part of #5148

Proposed Changes

  • Add option to run all e2e tests with different http and https settings

Release Note

NONE

/cc @JRBANCEL
/cc @ZhiminXiang

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Aug 14, 2019
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 14, 2019
@knative-prow-robot
Copy link
Contributor

Hi @taragu. 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.

@knative-prow-robot knative-prow-robot added the area/test-and-release It flags unit/e2e/conformance/perf test issues for product features label Aug 14, 2019
httpProtocol: "Enabled"
autoTLS: "Enabled"

_example: |
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 to keep the _example?
It makes things less clear I feel.

if (( HTTP_ENABLED )) && (( AUTO_TLS_ENABLED )); then
ko apply ${KO_FLAGS} -f test/config-network/config-network-http-https.yaml || return 1
elif (( HTTP_ENABLED )) && (( ! AUTO_TLS_ENABLED )); then
ko apply ${KO_FLAGS} -f test/config-network/config-network-http.yaml || return 1
Copy link
Contributor

Choose a reason for hiding this comment

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

http-only might be more explicit than http.
Same with https-only vs. https.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JRBANCEL originally I was thinking of having flags that corresponded directly to the yaml values:

--http --> httpProtocol: "Enabled"
--no-http --> httpProtocol: "Disabled"
--auto-tls --> autoTLS: "Enabled"
--no-auto-tls --> autoTLS: "Disabled"

If we have flags http-only and https-only, do we need to introduce a third flag to indicate http and https?

Choose a reason for hiding this comment

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

I would prefer not introducing auto TLS into this PR if we just want to test different HTTP and HTTPS setting because:

  1. auto TLS needs more setup (DNS server, real domain, static IP, etc.)
  2. If we run all E2E tests with auto TLS enabled, we can quickly run out of TLS certificates quota.

In this PR, I think we are targeting to test the scenario that HTTP server (https://github.com/knative/serving/blob/master/config/202-gateway.yaml#L27) is removed, and HTTPS server with certificates is added (https://github.com/knative/serving/blob/master/config/202-gateway.yaml#L34). So probably one flag is enough: --https-only. WDYT?

In addition, instead of customizing config-network.yaml, I think we just need to customize https://github.com/knative/serving/blob/master/config/202-gateway.yaml because httpProtocol:Disabled only works when we turn on either flag autoTLS or reconcileExternalGateway which is bit more complex to set up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ZhiminXiang ! I've added a gateway yaml for https only at test/https-gateway.yaml. I'm not sure where to put it so please let me know if you think there's a better destination.

Copy link
Contributor

@JRBANCEL JRBANCEL left a comment

Choose a reason for hiding this comment

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

This is good, but AutoTLS won't work magically right?
We need to set up some domain name and hook it up with Let'sEncrypt for example.
We will probably hit the Let'sEncrypt limits. @ZhiminXiang can you comment on how to set this up?

@JRBANCEL
Copy link
Contributor

/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 Aug 14, 2019

data:
httpProtocol: "Enabled"
autoTLS: "Enabled"

Choose a reason for hiding this comment

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

We cannot turn on auto TLS in our E2E tests until 1) either we set up DNS servers for the real domain to get real CA signed TLS certificates or 2) we use CA issuers #4066 (comment) to get self-signed certificates.

At this point, in order to test HTTPS enabled, we may need to manually provide a self-signed certificate by using openssl and configure Gateway to support TLS.

@ZhiminXiang ZhiminXiang requested a review from adrcunha August 15, 2019 00:27
@adrcunha
Copy link
Contributor

Script-wise, the approach LGTM.
/approve

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 15, 2019
Copy link
Contributor

@mattmoor-sockpuppet mattmoor-sockpuppet left a comment

Choose a reason for hiding this comment

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

Found go linting violations, please merge: taragu#5

@taragu
Copy link
Contributor Author

taragu commented Aug 15, 2019

/test pull-knative-serving-build-tests

@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 16, 2019

# Depending on the flag `HTTPS_ONLY`, reapply the gateway yaml with https only
if (( HTTPS_ONLY )); then
ko apply ${KO_FLAGS} -f test/https-gateway.yaml || return 1

Choose a reason for hiding this comment

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

/cc @adrcunha
I think we probably want to put the yaml under test/config/https-gateway/ directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

hosts:
- "*"
tls:
mode: PASSTHROUGH

Choose a reason for hiding this comment

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

PASSTHOUGH actually does not work. Can we change it to:

tls:
      mode: SIMPLE
      credentialName: "tls-certificate"
    hosts:
    - "*"

We can think about how to generate the certificate as a TODO.

Copy link
Contributor Author

@taragu taragu Aug 19, 2019

Choose a reason for hiding this comment

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

@ZhiminXiang I just applied this config and tried running the TestHelloWorld e2e test, but looking at the logs, routes were ready but they were not https. The test failed with. Am I missing something here?

    kubelogs.go:152: I 13:03:08.438 [route-controller] [serving-tests/hello-world-uyuibzpu] Updating targeted revisions.
    kubelogs.go:152: I 13:03:08.438 [route-controller] [serving-tests/hello-world-uyuibzpu] Creating placeholder k8s services
    kubelogs.go:152: I 13:03:08.455 [route-controller] [serving-tests/hello-world-uyuibzpu] Creating Ingress.
    kubelogs.go:152: I 13:03:08.482 [route-controller] [serving-tests/hello-world-uyuibzpu] Updating placeholder k8s services with clusterIngress information
    kubelogs.go:152: I 13:03:08.482 [route-controller] [serving-tests/hello-world-uyuibzpu] Route successfully synced
    kubelogs.go:152: I 13:03:08.482 [route-controller] [serving-tests/hello-world-uyuibzpu] Reconcile succeeded. Time taken: 44.180415ms.
    service.go:133: Checking to ensure Service Status is populated for Ready service hello-world-uyuibzpu
    service.go:139: Getting latest objects Created by Service hello-world-uyuibzpu
    kubelogs.go:152: D 13:03:09.241 [kpa-class-podautoscaler-controller] [serving-tests/hello-world-uyuibzpu-qm8r9] No data to scale on yet
    service.go:142: Successfully created Service hello-world-uyuibzpu
    helloworld_test.go:66: The endpoint for Route hello-world-uyuibzpu at domain hello-world-uyuibzpu.serving-tests.169.46.25.10.xip.io didn't serve the expected text "Hello World! How about some tasty noodles?": response: status: 404, body: , headers: map[Content-Length:[0] Date:[Mon, 19 Aug 2019 13:03:09 GMT] Server:[istio-envoy] Zipkin_trace_id:[34de09e4cccf986c15324e8dc95c5bc9]] did not pass checks: status = 404, want one of: [200]

EDIT: Actually I missed setting up the CA issuer (thanks @rmoe for the instructions). The TestHelloWorld test passes now

Copy link
Contributor

@adrcunha adrcunha left a comment

Choose a reason for hiding this comment

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

This option won't be automatically tested by presubmits or CI flows. Is it intended?

@taragu
Copy link
Contributor Author

taragu commented Aug 19, 2019

@adrcunha that's correct. The option won't be enabled until we add the command with --https-only to https://github.com/knative/test-infra/blob/master/ci/prow/config_knative.yaml#L15

@ZhiminXiang
Copy link

I am not sure if all of the E2E tests will be passed under this environment. We may want to start with making it as post-submit, and then consider to make it presubmit after we fix all of E2E tests.

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 21, 2019
@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 29, 2019
@taragu
Copy link
Contributor Author

taragu commented Oct 30, 2019

/assign @tcnghia

@taragu
Copy link
Contributor Author

taragu commented Oct 31, 2019

@adrcunha @ZhiminXiang @tcnghia could you please take a look when you get a chance?

Copy link
Contributor

@adrcunha adrcunha left a comment

Choose a reason for hiding this comment

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

/lgtm

LGTM for the test-infra, but I would like yet another pair of eyes on the PR before approval.

if err != nil {
t.Fatalf("Failed to get Gateway %s/%s", Namespace, GatewayName)
}
curGateway.Spec.Servers = oldGateway.Spec.Servers

Choose a reason for hiding this comment

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

nit: we probably want to check if the Spec.Servers are the same btw currGateway and oldGateway. If they are the same, we don't need update.

},
TLS: tlsOptions,
}}
setupHTTPS(t, clients.KubeClient, []string{names.Service + "." + GetDomain(t, clients)})

Choose a reason for hiding this comment

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

Can we use names.URL (

URL *url.URL
) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm names.URL actually won't be set until after the service is created, so I think this is the best way.

Choose a reason for hiding this comment

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

I am not sure if we can move the part of configuring https (https://github.com/knative/serving/pull/5157/files#diff-cd1624ee494bbca6fd2e1e1a908d0dd3R131) after validateCreatedServiceStatus function (https://github.com/knative/serving/pull/5157/files#diff-cd1624ee494bbca6fd2e1e1a908d0dd3R174).
If we can, then names.URL will be available after validateCreatedServiceStatus function. And then we can use names.URL instead of using GetDomain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ZhiminXiang yes that does work. Thank you for the suggestion!

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 1, 2019
@taragu
Copy link
Contributor Author

taragu commented Nov 4, 2019

Thanks @ZhiminXiang @adrcunha @JRBANCEL for the review! I made a change to add transport option as a return arg for CreateRunLatestServiceReady as Zhimin brought up the problem of running tests in parallel. Please let me know what you think.

@JRBANCEL
Copy link
Contributor

JRBANCEL commented Nov 4, 2019

/lgtm

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Nov 4, 2019
@taragu
Copy link
Contributor Author

taragu commented Nov 5, 2019

/retest

},
TLS: tlsOptions,
}}
domainName := strings.SplitN(names.URL.Host, ".", 2)[1]

Choose a reason for hiding this comment

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

Do we still need to do the splitN here?
From what I saw, we get the suffix of names.URL.Host, and then we combine it with the service name, which is essentially the same as names.URL.Host. So I think we can use names.URL.Host directly here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I tried using names.URL.Host but it didn't work because it has the service name. domain name is serving-tests.169.48.185.45.xip.io but names.URL.Host is hello-world-gzzyzjel.serving-tests.169.48.185.45.xip.io

Choose a reason for hiding this comment

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

what I mean here is we don't need to do SplitN and then combine the domain with service name in https://github.com/knative/serving/pull/5157/files/72501eed94be585c3d9060af4eabf2183b480185#diff-cd1624ee494bbca6fd2e1e1a908d0dd3R485. Instead, we can directly pass names.URL.Host to setUpHTTPS function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah got it. That makes sense. I've just pushed up the simplification.

@ZhiminXiang
Copy link

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 6, 2019
@taragu
Copy link
Contributor Author

taragu commented Nov 6, 2019

@ZhiminXiang thanks for the review! @adrcunha would you take another look when you get a chance?

@adrcunha
Copy link
Contributor

adrcunha commented Nov 6, 2019

/lgtm
/approve

@tcnghia
Copy link
Contributor

tcnghia commented Nov 6, 2019

/approve

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adrcunha, taragu, tcnghia

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-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 6, 2019
@taragu
Copy link
Contributor Author

taragu commented Nov 6, 2019

/retest

@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-unit-tests pull-knative-serving-unit-tests 1/3

Automatically retrying due to test flakiness...
/test pull-knative-serving-unit-tests

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/test-and-release It flags unit/e2e/conformance/perf test issues for product features cla: yes Indicates the PR's author has signed the CLA. 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.