Skip to content

Add support for namespace for all commands that takes a --sink option - #1264

Merged
knative-prow-robot merged 1 commit into
knative:mainfrom
Kaustubh-pande:sink-ns-support
Mar 18, 2021
Merged

knative-prow-robot merged 1 commit into
knative:mainfrom
Kaustubh-pande:sink-ns-support

Conversation

@Kaustubh-pande

Copy link
Copy Markdown
Contributor

Description

This PR will add support for the namespace that takes a '--sink' option currently, we only resolve sink references in the current namespace but, with this PR user can able to refer the sink in another namespace.
if users pass the namespace --sink ksvc:mysvc:my-namespace which creates a destination that points to the my-namespace namespace, namespace support is optional, if the user not provided the namespace then-current namespace will be used

Changes

  • Add support for namespaces for all commands that take a --sink option

Reference

Fixes #1143

@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 15, 2021

@knative-prow-robot knative-prow-robot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Kaustubh-pande: 0 warnings.

Details

In response to this:

Description

This PR will add support for the namespace that takes a '--sink' option currently, we only resolve sink references in the current namespace but, with this PR user can able to refer the sink in another namespace.
if users pass the namespace --sink ksvc:mysvc:my-namespace which creates a destination that points to the my-namespace namespace, namespace support is optional, if the user not provided the namespace then-current namespace will be used

Changes

  • Add support for namespaces for all commands that take a --sink option

Reference

Fixes #1143

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 15, 2021
@knative-prow-robot

Copy link
Copy Markdown
Contributor

Hi @Kaustubh-pande. 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.

Details

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 15, 2021
@dsimansk

Copy link
Copy Markdown
Contributor

Thanks!
/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 Mar 15, 2021
@navidshaikh

Copy link
Copy Markdown
Contributor

@Kaustubh-pande We should add e2e tests for this. e2e tests under dir test/e2e/ operate under same namespace, so you can add one in smoke tests in test/e2e-tests.sh

@maximilien maximilien left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this and adding all tests. Leaving it to others to review since I did not have a need for it but I can see the value

@dsimansk dsimansk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@navidshaikh could take a final look pls?

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2021
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dsimansk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 Mar 18, 2021
@dsimansk

dsimansk commented Mar 18, 2021 •

Copy link
Copy Markdown
Contributor

/hold

Adding hold for other to take a look.

@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 Mar 18, 2021

@navidshaikh navidshaikh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

a nit otherwise lgtm

Comment thread pkg/kn/commands/flags/sink.go Resolved
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2021
@knative-metrics-robot

Copy link
Copy Markdown

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 75.0% 76.2% 1.2

@dsimansk

Copy link
Copy Markdown
Contributor

It should be good to go as Navid's last comment was addressed.
/lgtm
/unhold

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 18, 2021
@knative-prow-robot
knative-prow-robot merged commit 431637a into knative:main Mar 18, 2021
@rhuss

rhuss commented Mar 23, 2021

Copy link
Copy Markdown
Contributor

@dsimansk @navidshaikh @Kaustubh-pande I see an issue here when using a sink without a prefix (which is a ksvc) with a namespace. How to distinguish this from the case prefix + service without namespace ?

I.e. given a:b, is a a prefix and b the name of the object or is a a KService name and b a namespace ?

@navidshaikh

Copy link
Copy Markdown
Contributor

@rhuss : Correct. When referring to knative service without prefix, it has to be in the same namespace else for knative service in different namespace, prefix:name:namespace combination must be provided. We'd need to update the help message for the flag.

@dsimansk

Copy link
Copy Markdown
Contributor

@rhuss nice catch! We should probably update the error message as well.

navidshaikh added a commit to navidshaikh/client that referenced this pull request Mar 23, 2021
 for referring to a Knative service in another namespace by
 'ksvc' prefix explicitly, for e.g. 'ksvc:name:namespace'
 xref: knative#1264
navidshaikh added a commit to navidshaikh/client that referenced this pull request Mar 23, 2021
 for referring to a Knative service in another namespace by
 'ksvc' prefix explicitly, for e.g. 'ksvc:name:namespace'
 xref: knative#1264
@rhuss

rhuss commented Mar 23, 2021

Copy link
Copy Markdown
Contributor

@rhuss : Correct. When referring to knative service without prefix, it has to be in the same namespace else for knative service in different namespace, prefix:name:namespace combination must be provided. We'd need to update the help message for the flag.

Do we get also an error when our service is called broker ? I.e. for broker:bla (i.e. referring to a service "broker" in namespace "bla") we don't get an error even we should, right ? but that's hard to detect.

@navidshaikh

Copy link
Copy Markdown
Contributor

Do we get also an error when our service is called broker ? I.e. for broker:bla (i.e. referring to a service "broker" in namespace "bla") we don't get an error even we should, right ?

In this case, it'd try to resolve broker bla, and upon not finding one it'd fail with not found error.

knative-prow-robot pushed a commit that referenced this pull request Mar 30, 2021
for referring to a Knative service in another namespace by
 'ksvc' prefix explicitly, for e.g. 'ksvc:name:namespace'
 xref: #1264
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. 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.

Add support for namespaces for all commands that take a --sink option

7 participants