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

Skip LatestReadyRevisionName if Revision is Pending or Unknown #825

Merged
merged 1 commit into from
May 7, 2020

Conversation

danielhelfand
Copy link
Contributor

Description

This pull request adds a check for if LatestReadyRevisionName is "" with kn service describe, indicating the Revision is in a Pending or Unknown state. This will prevent kn service describe from returning an error message of resource name may not be empty due to LatestReadyRevisionName being an empty string when passed to the GetRevision function in completeWithLatestRevisions.

Changes

Add a check for if revisionName == "" and continue to the next loop iteration if true. Also added a unit test for this case and edited helper functions.

Open to any different interpretation of how to treat this case as far as whether the revisionName should be skipped or other details should be returned.

Reference

Fixes #823

/lint

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label May 5, 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.

@danielhelfand: 2 warnings.

In response to this:

Description

This pull request adds a check for if LatestReadyRevisionName is "" with kn service describe, indicating the Revision is in a Pending or Unknown state. This will prevent kn service describe from returning an error message of resource name may not be empty due to LatestReadyRevisionName being an empty string when passed to the GetRevision function in completeWithLatestRevisions.

Changes

Add a check for if revisionName == "" and continue to the next loop iteration if true. Also added a unit test for this case and edited helper functions.

Open to any different interpretation of how to treat this case as far as whether the revisionName should be skipped or other details should be returned.

Reference

Fixes #823

/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.

annoMap["anno2"] = "aval2"
annoMap["anno3"] = "very_long_value_which_should_be_truncated_in_normal_output_if_we_make_it_even_longer"

serviceUrl, _ := apis.ParseURL(fmt.Sprintf("https://%s.default.svc.cluster.local", name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Golint naming: var serviceUrl should be serviceURL. More info.

annoMap["anno3"] = "very_long_value_which_should_be_truncated_in_normal_output_if_we_make_it_even_longer"

serviceUrl, _ := apis.ParseURL(fmt.Sprintf("https://%s.default.svc.cluster.local", name))
addressUrl, _ := apis.ParseURL(fmt.Sprintf("https://%s.default.example.com", name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Golint naming: var addressUrl should be addressURL. More info.

@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 May 5, 2020
@knative-prow-robot
Copy link
Contributor

Hi @danielhelfand. 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.

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 May 5, 2020
@rhuss
Copy link
Contributor

rhuss commented May 5, 2020

/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 May 5, 2020
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.

Thanks !

Looks good with some minor cosmetic suggestion.

@@ -294,7 +294,7 @@ func orderByConfigurationGeneration(descs []*revisionDesc) []*revisionDesc {

func completeWithLatestRevisions(client clientservingv1.KnServingClient, service *servingv1.Service, revisionsSeen sets.String, descs []*revisionDesc) ([]*revisionDesc, error) {
for _, revisionName := range []string{service.Status.LatestCreatedRevisionName, service.Status.LatestReadyRevisionName} {
if revisionsSeen.Has(revisionName) {
if revisionsSeen.Has(revisionName) || revisionName == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would move the check for revisionName == "" to the first position as it doesn't make sense to check for an empty name in the has anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Addressed.

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.

Please address the golint messages. Otherwise LGTM

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2020
@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/service/describe.go 82.2% 82.8% 0.6

@rhuss
Copy link
Contributor

rhuss commented May 7, 2020

Thanks !

/lgtm

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

rhuss commented May 7, 2020

/approve

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

@knative-prow-robot knative-prow-robot merged commit 0a65978 into knative:master May 7, 2020
coryrc pushed a commit to coryrc/client that referenced this pull request May 14, 2020
change receivers name to make more sense
@navidshaikh navidshaikh modified the milestone: v0.15.0 May 27, 2020
dsimansk added a commit to dsimansk/client that referenced this pull request Nov 9, 2021
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.

Confusing Error Message from kn service describe When Revision Not Available
7 participants