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

Revisit sink prefixes: Support only 'ksvc' prefix and drop 'svc', 'service' support for knative service #896

Merged
merged 8 commits into from
Jul 14, 2020

Conversation

navidshaikh
Copy link
Collaborator

@navidshaikh navidshaikh commented Jun 19, 2020

Fixes #898

  • 'ksvc' prefix --> Knative Service (or no prefix means knative service)
  • Update all the examples and tests
  • Add examples for broker, service and URI in flag help message
  • Drop support for 'svc' and 'service' prefixes for knative service, hint in err msg if these prefixes are given

help message:

  -s, --sink string               Addressable sink for events. You can specify broker, knative service or URI. Examples: '--sink broker:nest' for 'nest' broker, '--sink
                                  https://event.receiver.uri' for an URI (identified by 'http' or 'https'), '--sink ksvc:receiver' or '--sink receiver' for 'receiver' knative service.
                                  If prefix is not provided, it is considered as knative service.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 19, 2020
@knative-prow-robot knative-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 19, 2020
@rhuss
Copy link
Contributor

rhuss commented Jun 19, 2020

Sounds good, but I'm generally not so happy with the duality of --sink service and --sink svc:service because how would we add a K8s service here ?

A suggestion would be --sink kservice and --sink ksvc:kservice + --sink svc:service for a k8s service. However this would not be backwards compatible :(

@navidshaikh
Copy link
Collaborator Author

navidshaikh commented Jun 19, 2020

However this would not be backwards compatible :(

Yes. Despite supporting prefix for k8s service, I agree that knative service prefix should be called ksvc OR kservice.

How about deprecating 'svc' and 'service' prefixes in favor of 'ksvc' and 'kservice' ?


how would we add a K8s service here ?

should we support prefixes for non-knative addressable resources ?

Giving URI or defining sink prefix for non-knative addressable should do.

It should be explicit about GVKs for non-knative addressable than hardcoding GVKs in kn and giving prefix(es) for it ?

Copy link
Contributor

@maximilien maximilien 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 once you address @dsimansk comment. Best.

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maximilien, navidshaikh

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:
  • OWNERS [maximilien,navidshaikh]

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

@navidshaikh
Copy link
Collaborator Author

/hold

for conclusion at #898

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 22, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 8, 2020
@navidshaikh navidshaikh changed the title Update description for sink flag Revisit sink prefixes: Set only 'ksvc' as prefix for knative service Jul 8, 2020
@navidshaikh
Copy link
Collaborator Author

/retest

Error: ReconcileIngressFailed: Ingress reconciliation failed

@navidshaikh
Copy link
Collaborator Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 10, 2020
@rhuss
Copy link
Contributor

rhuss commented Jul 10, 2020

Looks good but I wonder whether we should keep svc: for one or two release to point to knative service for the sake of backwards compatibility ? I mean we could remove it from all help message, but still evaluate it if present and print a deprecation warning that this will be removed.

Also we should allow overriding svc: with the config (but only this specific prefix because we will free it up later anyway).

Does this make sense ?

@navidshaikh
Copy link
Collaborator Author

navidshaikh commented Jul 10, 2020

This can be done, however I wonder if we should provide this (temporary) UX for allowing to override the default prefix via config values. Our eventing support is experimental, we may choose to put hard stop for default svc prefix and clear the path for k8s service without bringing any confusion/change-of-UX.

@navidshaikh navidshaikh reopened this Jul 10, 2020
@rhuss
Copy link
Contributor

rhuss commented Jul 10, 2020

Ok, let's do it that way for now. We will learn anyway if we get some backslash, but otherwise being overcautios is not good as well.

We make Eventing support as experimental, so I think that's fine.

But maybe we can add to error message when a user uses SVC: that this has been moved to ksvc: ?

@navidshaikh navidshaikh changed the title Revisit sink prefixes: Set only 'ksvc' as prefix for knative service Revisit sink prefixes: Support only 'ksvc' prefix and drop 'svc' and 'service' support for knative service Jul 12, 2020
@navidshaikh navidshaikh changed the title Revisit sink prefixes: Support only 'ksvc' prefix and drop 'svc' and 'service' support for knative service Revisit sink prefixes: Support only 'ksvc' prefix and drop 'svc', 'service' support for knative service Jul 12, 2020
@navidshaikh
Copy link
Collaborator Author

But maybe we can add to error message when a user uses SVC: that this has been moved to ksvc: ?

@rhuss : sure, PTAL ad8c47e

@@ -84,7 +88,10 @@ func (i *SinkFlags) ResolveSink(knclient clientdynamic.KnDynamicClient, namespac
}
typ, ok := sinkMappings[prefix]
if !ok {
return nil, fmt.Errorf("unsupported sink type: %s", i.sink)
if prefix == "svc" || prefix == "service" {
Copy link
Contributor

Choose a reason for hiding this comment

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

I have not tested it but does this also throw an error if a user configures that prefix in its configuration file ? (that should not be the case).

Copy link
Collaborator Author

@navidshaikh navidshaikh Jul 14, 2020

Choose a reason for hiding this comment

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

Nope, this check is after key lookup in sinkMapping ( typ, ok := sinkMappings[prefix]) just a couple lines before.

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/commands/flags/sink.go 57.6% 65.7% 8.1

@rhuss
Copy link
Contributor

rhuss commented Jul 14, 2020

Thanks !

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2020
@knative-prow-robot knative-prow-robot merged commit 2e1a863 into knative:master Jul 14, 2020
@navidshaikh navidshaikh deleted the pr/broker-help branch July 14, 2020 08:27
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. 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.

Discussion: Sink Mappings revisited
7 participants