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

feat: Subscription CRUD #1013

Merged
merged 4 commits into from
Oct 1, 2020

Conversation

navidshaikh
Copy link
Collaborator

@navidshaikh navidshaikh commented Sep 15, 2020

Description

Subscription CRUD operations

Changes

  • Add subscription create, update, list, describe delete commands
  • Channel type mapping can be used while creating the subscription to refer different channel types
  • Set default channel type messaging.knative.dev/v1beta1:Channel, i.e. if no prefix is given to --channel, consider it of Channel type.

/lint

Fixes #955

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2020
@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 15, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 15, 2020
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.

/retest

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.

Any chance for an e2e test for this?

docs/cmd/kn_subscription.md Show resolved Hide resolved
pkg/kn/commands/subscription/flags.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/create.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/create_test.go Show resolved Hide resolved
pkg/kn/commands/subscription/delete.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/delete_test.go Show resolved Hide resolved
pkg/kn/commands/subscription/describe.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/subscription_test.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/update.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/update_test.go Show resolved Hide resolved
pkg/messaging/v1beta1/subscriptions_client.go Outdated Show resolved Hide resolved
pkg/messaging/v1beta1/subscriptions_client_mock.go Outdated Show resolved Hide resolved
@navidshaikh navidshaikh changed the title WIP: Subscription CRUD feat: Subscription CRUD Sep 28, 2020
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 28, 2020
@navidshaikh
Copy link
Collaborator Author

/retest

 ERROR: timeout waiting for pods to come up
 eventing-controller-56cdd9bf45-cmttb    1/1   Running            0     5m42s
 eventing-webhook-8665cc79c6-sfr9d       0/1   CrashLoopBackOff   6     5m42s

Copy link
Contributor

@rhuss rhuss 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 and is a straight forward implementation for subscriber CRUD handling.

There are two things I would still like to discuss though:

  • I know that the options UI mimic 1:1 the fields in the resources, but I wonder whether we should do this here as well. I.e. the target for where events go a called a sink for sources and triggers, but subscriber for subscriptions although they are all of the same types and share the same mappings, that we call "sink mappings". I tend to name the 'subscriber' here also --sink or at least make that option an alias. tbh I have no idea why this difference, but from a UI POV this is more than unfortunate. The same, but to a minor degree, for the difference between a --dead-letter-sink (with sink suffix) and --reply (without sink suffix, but still a sink). Ideally either both or non would have a sink prefix.

  • Should we settle on the v1 API version of subscription? I would say yes, as I think that for initial support we should use the highest available API version.

docs/cmd/kn_source_apiserver_update.md Outdated Show resolved Hide resolved
docs/cmd/kn_subscription_create.md Outdated Show resolved Hide resolved
docs/cmd/kn_subscription_create.md Outdated Show resolved Hide resolved
pkg/kn/commands/flags/sink.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/create.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/describe.go Outdated Show resolved Hide resolved
pkg/kn/commands/subscription/describe.go Outdated Show resolved Hide resolved
pkg/messaging/v1beta1/subscriptions_client.go Show resolved Hide resolved
@navidshaikh
Copy link
Collaborator Author

This is ready for another round of review, fixed the review comments and here are some notable changes:

  • Flag names revisited:

    • -s, --sink string
    • --sink-dead-letter string
    • --sink-reply string
  • Subscription list column name revisited

  • Aliases:

    • subscriptions
    • sub
  • Added shared lib:
    knative.dev/client/lib/printing

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

cool, thanks !

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 30, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

 - Add kn subscription command group and CRUDL sub-commands
 - create/update uses following flag names for better alignment:
  - --sink for subscriber
  - --sink-reply for reply
  - --sink-dead-letter for dead-letter-sink
 - Add 'subscriptions' and 'sub' aliases
 - Introduce shared library `knative.dev/client/lib/printing`
   to print Sink object in describe output
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 30, 2020
@navidshaikh
Copy link
Collaborator Author

/retest

 ERROR: timeout waiting for pods to come up

@navidshaikh
Copy link
Collaborator Author

/retest

1 similar comment
@rhuss
Copy link
Contributor

rhuss commented Sep 30, 2020

/retest

@navidshaikh
Copy link
Collaborator Author

/retest

looks like knative/eventing#4165 is flaking the CI job

@navidshaikh
Copy link
Collaborator Author

/hold

adding IMC as default channel if no prefix is given
see https://knative.slack.com/archives/CE4MVFVAQ/p1601473090002600

@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 Sep 30, 2020
 i.e. if no prefix is given to `--channel`, consider it of `Channel` type
Copy link
Contributor

@rhuss rhuss 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, some suggestion for a more condensed wording in the help message. I would not mention any concrete build int mappings here but defer that more or less to the channel documentation,

pkg/kn/flags/channel_types.go Outdated Show resolved Hide resolved
@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 65.7% 75.0% 9.3
pkg/kn/commands/subscription/create.go Do not exist 84.1%
pkg/kn/commands/subscription/delete.go Do not exist 92.9%
pkg/kn/commands/subscription/describe.go Do not exist 80.5%
pkg/kn/commands/subscription/flags.go Do not exist 56.0%
pkg/kn/commands/subscription/list.go Do not exist 80.0%
pkg/kn/commands/subscription/subscription.go Do not exist 59.1%
pkg/kn/commands/subscription/update.go Do not exist 80.0%

@rhuss
Copy link
Contributor

rhuss commented Sep 30, 2020

/retest

@navidshaikh
Copy link
Collaborator Author

/retest

   result_collector.go:75: ERROR: Error: ReconcileIngressFailed: Ingress reconciliation failed

@rhuss
Copy link
Contributor

rhuss commented Oct 1, 2020

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 1, 2020
@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 Oct 1, 2020
@rhuss
Copy link
Contributor

rhuss commented Oct 1, 2020

/retest

@knative-prow-robot knative-prow-robot merged commit ce519b5 into knative:master Oct 1, 2020
@navidshaikh navidshaikh deleted the pr/subscriptions branch October 1, 2020 16:58
@navidshaikh navidshaikh added the backport/pr A backport PR which is target to a release branch. label Oct 2, 2020
navidshaikh added a commit to navidshaikh/client that referenced this pull request Oct 2, 2020
* feat: Add subscription CRUD

 - Add kn subscription command group and CRUDL sub-commands
 - create/update uses following flag names for better alignment:
  - --sink for subscriber
  - --sink-reply for reply
  - --sink-dead-letter for dead-letter-sink
 - Add 'subscriptions' and 'sub' aliases
 - Introduce shared library `knative.dev/client/lib/printing`
   to print Sink object in describe output

* Set default channel type messaging.knative.dev/v1beta1:Channel

 i.e. if no prefix is given to `--channel`, consider it of `Channel` type

* Update e2e tests

* Update channel flag description
@navidshaikh navidshaikh added backport/candidate Consider this PR to be backported to the release branch and removed backport/pr A backport PR which is target to a release branch. labels Oct 2, 2020
knative-prow-robot pushed a commit that referenced this pull request Oct 2, 2020
* Fix channel create example with inbuilt alias for imcv1beta1 (#1005)

use `imcv1beta1` alias reference in the example

* feat: Subscription CRUD (#1013)

* feat: Add subscription CRUD

 - Add kn subscription command group and CRUDL sub-commands
 - create/update uses following flag names for better alignment:
  - --sink for subscriber
  - --sink-reply for reply
  - --sink-dead-letter for dead-letter-sink
 - Add 'subscriptions' and 'sub' aliases
 - Introduce shared library `knative.dev/client/lib/printing`
   to print Sink object in describe output

* Set default channel type messaging.knative.dev/v1beta1:Channel

 i.e. if no prefix is given to `--channel`, consider it of `Channel` type

* Update e2e tests

* Update channel flag description

* CHANGELOG for v0.17.1

* Conform with k8s.io/api v0.17.6
rhuss pushed a commit to rhuss/knative-client that referenced this pull request Oct 5, 2020
* feat: Add subscription CRUD

 - Add kn subscription command group and CRUDL sub-commands
 - create/update uses following flag names for better alignment:
  - --sink for subscriber
  - --sink-reply for reply
  - --sink-dead-letter for dead-letter-sink
 - Add 'subscriptions' and 'sub' aliases
 - Introduce shared library `knative.dev/client/lib/printing`
   to print Sink object in describe output

* Set default channel type messaging.knative.dev/v1beta1:Channel

 i.e. if no prefix is given to `--channel`, consider it of `Channel` type

* Update e2e tests

* Update channel flag description
@navidshaikh navidshaikh added backported-to/0.17 and removed backport/candidate Consider this PR to be backported to the release branch labels Oct 12, 2020
mgencur pushed a commit to openshift-knative/client that referenced this pull request Nov 21, 2022
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Subscription CRUD operations
8 participants