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

Find sink and ready conditions for untyped source #911

Merged
merged 3 commits into from
Jul 2, 2020

Conversation

navidshaikh
Copy link
Collaborator

@navidshaikh navidshaikh commented Jun 29, 2020

Description

[kn source list] Improve extraction of source instance's sink and ready status

Changes

  • Look up spec.sink field in untyped source unstructured object and
    try to convert it to duck Destination object
  • Look up status.conditions field in untyped source unstructured object and
    try to convert it to duck Conditions object
  • Upon not finding the data at expected fields, return "<unknown>"

Example:

Before:

kn source list --type kafkasource
NAME         TYPE          RESOURCE                           SINK        READY
k1           KafkaSource   kafkasources.sources.knative.dev   <unknown>   <unknown>
mykafkasrc   KafkaSource   kafkasources.sources.knative.dev   <unknown>   <unknown>
seeder       KafkaSource   kafkasources.sources.knative.dev   <unknown>   <unknown>

After:

kn source list --type kafkasource
NAME         TYPE          RESOURCE                           SINK                READY
k1           KafkaSource   kafkasources.sources.knative.dev   svc:event-display   True
mykafkasrc   KafkaSource   kafkasources.sources.knative.dev                       False
seeder       KafkaSource   kafkasources.sources.knative.dev   broker:relay        True

Reference

Fixes #909

/lint

 Fixes knative#909
 - Look up spec.sink field in untyped source unstructured object and
   try to convert it to duck Destination object
 - Look up status.conditions field in untyped source unstructured object and
   try to convert it to duck Conditions object
 - Upon not finding the data at expected fields, return "<unknown>"
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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:

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 Jun 29, 2020
Copy link
Contributor

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

Choose a reason for hiding this comment

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

@navidshaikh: 0 warnings.

In response to this:

Description

[kn source list] Improve extraction of source instance's sink and ready status

Changes

  • Look up spec.sink field in untyped source unstructured object and
    try to convert it to duck Destination object
  • Look up status.conditions field in untyped source unstructured object and
    try to convert it to duck Conditions object
  • Upon not finding the data at expected fields, return ""

Example:

Before:

kn source list --type kafkasource
NAME         TYPE          RESOURCE                           SINK        READY
k1           KafkaSource   kafkasources.sources.knative.dev   <unknown>   <unknown>
mykafkasrc   KafkaSource   kafkasources.sources.knative.dev   <unknown>   <unknown>
seeder       KafkaSource   kafkasources.sources.knative.dev   <unknown>   <unknown>

After:

kn source list --type kafkasource
NAME         TYPE          RESOURCE                           SINK                READY
k1           KafkaSource   kafkasources.sources.knative.dev   svc:event-display   True
mykafkasrc   KafkaSource   kafkasources.sources.knative.dev                       False
seeder       KafkaSource   kafkasources.sources.knative.dev   broker:relay        True

Reference

Fixes #909

/lint

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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 29, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 29, 2020
Copy link
Collaborator Author

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

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

please take a look and if you have any comments about the approach?

pkg/kn/commands/source/duck/multisourcelist.go Outdated Show resolved Hide resolved
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.

Lack of testing... See comments. Perhaps not all can be easily covered but we should attempt some if possible. Thank you.

pkg/kn/commands/source/duck/multisourcelist.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 30, 2020
@maximilien
Copy link
Contributor

Nice work @navidshaikh. Please update the copyright and otherwise LGTM

@navidshaikh navidshaikh force-pushed the pr/source-list-fixes branch from 03848b5 to b5c5d71 Compare July 1, 2020 05:14
@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/source/duck/multisourcelist.go Do not exist 78.4%

@navidshaikh
Copy link
Collaborator Author

/retest

Error: Operation cannot be fulfilled on triggers.eventing.knative.dev "filtertrigger": the object has been modified; please apply your changes to the latest version and try again

@maximilien
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 2, 2020
@knative-prow-robot knative-prow-robot merged commit 4b62f20 into knative:master Jul 2, 2020
@navidshaikh navidshaikh deleted the pr/source-list-fixes branch July 2, 2020 07:08
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.

[kn source list] Improve extraction of source instance's sink and ready status
6 participants