-
Notifications
You must be signed in to change notification settings - Fork 263
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
fixes(#606): adds --cluster-local / --no-cluster-local flags #629
Conversation
When specified on 'service create' the '--cluster-local' flag will make the created service 'private' by setting its config visibility to 'cluster-local'. This is done with label: serving.knative.dev/visibility: cluster-local The --no-cluster-local will remove the label.
/ok-to-test |
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 ! I one minor suggestion, see below.
Also, I think it would be cool if we could add already an E2E test to this functionality. would you mind to add a simpe one (or extend an existing one ?)
} | ||
|
||
_, present := template.Labels[config.VisibilityLabelKey] | ||
assert.Assert(t, !present) |
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.
Could we please also check for the proper value of the annotation ? Maybe also in update_test.go that the annotation gets removed when using --no-cluster-local
to complete the scenario.
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.
Actually, slight problem adding the update_test.go
. Seems like removing that label causes an API error:
Internal error occurred: admission webhook "webhook.serving.knative.dev" denied the request: mutation failed: Saw the following changes without a name change (-old +new): spec.configuration.template
{*v1alpha1.RevisionTemplateSpec}.ObjectMeta.Labels:
-: "map[serving.knative.dev/visibility:cluster-local]"
+: "map[]"
Let me know if you see something obvious. Unless my cluster is not up to date. Digging more.
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.
The issue is, that the test uses the BYO feature for revision ("Bring your own" revision name). This means you need to to change the revision name to something unique on your own (like increasing a counter). Alternatively, you can use the auto revision name generation feature from Knative serving (which results in this random prefixes, like for pods of a deployment). You can servers side name generation with -revision-name ""
(which might arguable not be the best option to use). Not sure anymore why we have settled on client side provided names by default.
However, I would expect that kn update
deals with percularity. Could you show me how you did the test ? Also, have you set the proper flag that the flag that you set also creates a new revision ? (look in the flags file how other do it)
Just a minor comment on the help text, but otherwise LGTM |
@maximilien there is a compile error in the tests:
|
/hold |
Yup. Surprised did not see this locally. Must be lost in the test output. Thanks for pasting the location. |
/retest
|
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.
Created a private service and subsequent update to service with only --cluster-local
flag generates
new revisions (while the service was already private). It should see that service is already private and consider configuration change as nil?
➜ client git:(issue606) ./kn service create private --image gcr.io/knative-samples/helloworld-go --cluster-local
Creating service 'private' in namespace 'default':
0.298s Configuration "private" is waiting for a Revision to become ready.
9.714s ...
9.769s Ingress has not yet been reconciled.
50.790s Ready to serve.
Service 'private' created to latest revision 'private-lpcgx-1' is available at URL:
http://private.default.svc.cluster.local
➜ client git:(issue606) ./kn revision list
NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON
private-lpcgx-1 private 100% 1 69s 4 OK / 4 True
➜ client git:(issue606) ./kn service update private --cluster-local
Updating Service 'private' in namespace 'default':
9.866s Traffic is not yet migrated to the latest revision.
9.894s Ingress has not yet been reconciled.
11.257s Ready to serve.
Service 'private' updated to latest revision 'private-vygmw-2' is available at URL:
http://private.default.svc.cluster.local
➜ client git:(issue606) ./kn revision list
NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON
private-vygmw-2 private 100% 2 16s 4 OK / 4 True
private-lpcgx-1 private 1 97s 3 OK / 4 True
➜ client git:(issue606) ./kn service update private --cluster-local
Updating Service 'private' in namespace 'default':
9.883s Traffic is not yet migrated to the latest revision.
9.919s Ingress has not yet been reconciled.
11.278s Ready to serve.
Service 'private' updated to latest revision 'private-dgtsx-3' is available at URL:
http://private.default.svc.cluster.local
➜ client git:(issue606) ./kn revision list
NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON
private-dgtsx-3 private 100% 3 15s 4 OK / 4 True
private-vygmw-2 private 2 36s 4 OK / 4 True
private-lpcgx-1 private 1 117s 3 OK / 4 True
/unhold |
/hold cancel |
/test pull-knative-client-integration-tests |
1 similar comment
/test pull-knative-client-integration-tests |
Looks like we are getting errors in e2e tests and it seems to consistently failing. Should not be my doing (I hope) since the commend does not use Running 'kn service create testsvc0 --image gcr.io/knative-samples/helloworld-go -n kne2etests4'...
--- PASS: TestSourceListTypes (8.02s)
--- PASS: TestSourceListTypes/List_available_source_types (0.22s)
--- PASS: TestSourceListTypes/List_available_source_types_in_YAML_format (0.14s)
Failed to successfully execute 'kn service create testsvc0 --image gcr.io/knative-samples/helloworld-go -n kne2etests8': Execution error: stderr: 'timeout: service 'testsvc0' not ready after 600 seconds
' error: 'exit status 1'FAIL knative.dev/client/test/e2e 602.359s
FAIL
Finished run, return code is 1 cc: @navidshaikh @rhuss |
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.
requested for few changes; those are causing e2e failures
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.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
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.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
@maximilien I resolved the conflict, but as @navidshaikh points out the E2E issues are rooted within this PR. I suggest that we either fix or comment out the affected E2E test for now so that we can get in this feature for 0.13.0 right now and fix the E2E afterwards. |
The following is the coverage report on the affected files.
|
@mattmoor we are using find $(echo $source_dirs) -name "*.go" -print0 | xargs -0 gofmt -s -w So, identical to your approach but more robust when it comes to file names which contains spaces. Formatting is part of our regular build and also checked in CI that it has been called. It is performed via these functions (which also add Lines 108 to 129 in 8dbf439
I suggest to switch off the format-check for the client repo as it leads to bogus suggestions as in #629 (comment) |
@maximilien there's a unit test error which you also should get with a
|
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.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
I think the integration test fails for the same reason as the unit test, i.e. that the label is not properly set on the service. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
Yup. I see there is a case when labels are nil on service. Should be good on last update. |
Yeah, optimistically pushed and went to lunch. It's all passing locally now (at least). |
Yeah, finally all green @rhuss :) |
Thanks ! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maximilien, rhuss 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 |
When specified on 'service create' the
--cluster-local
flag willmake the created service 'private' by setting its config visibility
to
cluster-local
. This is done with label:serving.knative.dev/visibility: cluster-local
The
--no-cluster-local
will remove the label.Fixes #606
Proposed Changes
--cluster-local
and--no-cluster-local
--cluster-local
is specified then create service and add label:serving.knative.dev/visibility: cluster-local