-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
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 Once the patch is verified, the new status will be reflected by the 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. |
httpProtocol: "Enabled" | ||
autoTLS: "Enabled" | ||
|
||
_example: | |
There was a problem hiding this comment.
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.
test/e2e-common.sh
Outdated
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 |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- auto TLS needs more setup (DNS server, real domain, static IP, etc.)
- 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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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?
/ok-to-test |
|
||
data: | ||
httpProtocol: "Enabled" | ||
autoTLS: "Enabled" |
There was a problem hiding this comment.
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.
Script-wise, the approach LGTM. |
There was a problem hiding this 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
/test pull-knative-serving-build-tests |
test/e2e-common.sh
Outdated
|
||
# 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
test/https-gateway.yaml
Outdated
hosts: | ||
- "*" | ||
tls: | ||
mode: PASSTHROUGH |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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?
@adrcunha that's correct. The option won't be enabled until we add the command with |
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. |
/assign @tcnghia |
@adrcunha @ZhiminXiang @tcnghia could you please take a look when you get a chance? |
There was a problem hiding this 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.
test/v1alpha1/service.go
Outdated
if err != nil { | ||
t.Fatalf("Failed to get Gateway %s/%s", Namespace, GatewayName) | ||
} | ||
curGateway.Spec.Servers = oldGateway.Spec.Servers |
There was a problem hiding this comment.
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.
test/v1alpha1/service.go
Outdated
}, | ||
TLS: tlsOptions, | ||
}} | ||
setupHTTPS(t, clients.KubeClient, []string{names.Service + "." + GetDomain(t, clients)}) |
There was a problem hiding this comment.
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 (
Line 36 in fdcec3b
URL *url.URL |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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!
b03952e
to
e66eb18
Compare
Thanks @ZhiminXiang @adrcunha @JRBANCEL for the review! I made a change to add transport option as a return arg for |
/lgtm |
…n with https flag on
9c9b613
to
72501ee
Compare
/retest |
test/v1alpha1/service.go
Outdated
}, | ||
TLS: tlsOptions, | ||
}} | ||
domainName := strings.SplitN(names.URL.Host, ".", 2)[1] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
/lgtm |
@ZhiminXiang thanks for the review! @adrcunha would you take another look when you get a chance? |
/lgtm |
/approve |
[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 |
/retest |
The following jobs failed:
Automatically retrying due to test flakiness... |
/lint
Part of #5148
Proposed Changes
Release Note
/cc @JRBANCEL
/cc @ZhiminXiang