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

get a particular service and revision based on name parameter #150

Merged
merged 1 commit into from
Jul 10, 2019

Conversation

savitaashture
Copy link
Contributor

@savitaashture savitaashture commented May 30, 2019

#143

current:

kn service list -n test autoscale-go
NAME           DOMAIN                          GENERATION   AGE    CONDITIONS   READY     REASON
autoscale-go   autoscale-go.test.example.com   1            125m   0 OK / 3     Unknown   RevisionMissing : Configuration "autoscale-go" is waiting for a Revision to become ready.
test1          test1.test.example.com          1            119m   0 OK / 3     False     RevisionMissing : Configuration "test1" does not have any ready Revision.

Expected: Should list only that perticular service.
something like below

kn service list -n test autoscale-go
NAME           DOMAIN                          GENERATION   AGE    CONDITIONS   READY     REASON
autoscale-go   autoscale-go.test.example.com   1            125m   0 OK / 3     Unknown   RevisionMissing : Configuration "autoscale-go" is waiting for a Revision to become ready.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label May 30, 2019
@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 30, 2019
@knative-prow-robot
Copy link
Contributor

Hi @savitaashture. 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 30, 2019
return nil, nil
}
revision.GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{
Group: "knative.dev",
Copy link
Contributor

Choose a reason for hiding this comment

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

The coordinates are wrong (whould be serving.knative.dev for the Group), but we should get #134 merged as soon as possible which avoids this kind of hardcoding of the GKV. @sixolet @cppforlife can we please get #134 merged soon to avoid piling up on this technical debt ?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure...Once that is merged i will rechange this

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 a lot ! I have some comments though.

On a more general level: I see a lot of duplicated code. Would it make sense to unify "revision get" and "service get" where possible ?

pkg/kn/commands/revision_get_test.go Outdated Show resolved Hide resolved

func createMockRevisionWithParams(name, svcName string, version bool) *v1alpha1.Revision {
var apiVersion string
if version {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you have different api versions ?

Copy link
Contributor Author

@savitaashture savitaashture May 31, 2019

Choose a reason for hiding this comment

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

This condition i have added to check the apiVersion
Because in the base code
when we do

kn revision get -o yaml

apiVersion: knative.dev/v1alpha1
items:
- apiVersion: serving.knative.dev/v1alpha1
  kind: Revision
  metadata:
    annotations:
      autoscaling.knative.dev/target: "10"
      serving.knative.dev/lastPinned: "1559284138"
    creationTimestamp: "2019-05-31T06:28:47Z"
    generateName: autoscale-go-
    generation: 1

If its a list then it is giving apiversion as knative.dev

and after adding my logic to get the single revision the apiversion should be serving.knative.dev
So in order to use the same function in test case i just added a boolean variable to check whether thats a get all revisions or get a revision based on name.

But as you said once after this merge
#134
GVK will be handled i think that time this condition is not required.

pkg/kn/commands/service_get.go Outdated Show resolved Hide resolved
pkg/kn/commands/service_get_test.go Outdated Show resolved Hide resolved
pkg/kn/commands/service_get_test.go Outdated Show resolved Hide resolved
@savitaashture savitaashture force-pushed the issue-143 branch 2 times, most recently from b1593c5 to a3fc452 Compare May 31, 2019 07:50
@savitaashture
Copy link
Contributor Author

savitaashture commented May 31, 2019

it make sense to unify

Found fakeRevisionGet and fakeServiceGet duplicate code modified and updated.

@rhuss rhuss mentioned this pull request Jun 2, 2019
@rhuss
Copy link
Contributor

rhuss commented Jun 6, 2019

@savitaashture thanks a lot for your updates ! Could you please rebase on latest mastrer, there has been some structural changes. Nothing big, probbaly just import conflicts.

@savitaashture
Copy link
Contributor Author

@savitaashture thanks a lot for your updates ! Could you please rebase on latest mastrer, there has been some structural changes. Nothing big, probbaly just import conflicts.

@rhuss I have rebased with latest master changes.
Thank you.

@rhuss
Copy link
Contributor

rhuss commented Jun 10, 2019

/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 Jun 10, 2019
@navidshaikh
Copy link
Collaborator

navidshaikh commented Jun 14, 2019

@savitaashture : get is now renamed to list, please rebase and update the PR.

@savitaashture savitaashture force-pushed the issue-143 branch 5 times, most recently from d9bcedb to 8eba6dd Compare June 14, 2019 19:07
@savitaashture
Copy link
Contributor Author

@savitaashture : get is not renamed to list, please rebase and update the PR.

@navidshaikh @rhuss Rebased

Copy link
Collaborator

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

Filtering a service by its name makes sense as the name is user provided, but the revision name is generated at server, how can we expect the user to remember the complicated name generated for revision and use it to filter revisions?

pkg/kn/commands/revision/revision_list_test.go Outdated Show resolved Hide resolved
@navidshaikh
Copy link
Collaborator

Maybe we should generally increase the default timeout to something like 2 mins ?

One of the candidate to land in kn config, but yes the default timeout can be increased. Another option, we can set --wait-timeout in create calls for CI (as it seems the success rate of e2e tests > flakiness).

@rhuss rhuss added this to the v0.2.0 milestone Jul 8, 2019
@rhuss
Copy link
Contributor

rhuss commented Jul 8, 2019

@savitaashture #134 has been merged. Could you please rebase ?

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 8, 2019
@savitaashture
Copy link
Contributor Author

@savitaashture #134 has been merged. Could you please rebase ?

Done

} else if !action.Matches("list", "services") {
t.Errorf("Bad action %v", action)
}
assert.Check(t, util.ContainsAll(output[0], "NAME", "DOMAIN", "GENERATION", "AGE", "CONDITIONS", "READY", "REASON"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The DOMAIN field is being replaced in #247 with URL, one of these two PRs need to rebase and update based on which gets merged first.

This PR is around since a while, probably we can consider updating #247 once this is in.
WDYT @rhuss ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with either. However I suggest to merge this PR first, and then update #247 based on this.

pkg/kn/commands/service/service_list_test.go Show resolved Hide resolved
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Indicates the PR's author has not signed the CLA. and removed cla: yes Indicates the PR's author has signed the CLA. labels Jul 9, 2019
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, thanks ! Minor nit about naming, otherwise we are good to merge.

pkg/kn/commands/revision/revision_list.go Outdated Show resolved Hide resolved
pkg/kn/commands/service/service_list.go Outdated Show resolved Hide resolved
} else if !action.Matches("list", "services") {
t.Errorf("Bad action %v", action)
}
assert.Check(t, util.ContainsAll(output[0], "NAME", "DOMAIN", "GENERATION", "AGE", "CONDITIONS", "READY", "REASON"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with either. However I suggest to merge this PR first, and then update #247 based on this.

@rhuss
Copy link
Contributor

rhuss commented Jul 10, 2019

@savitaashture if you update the docs a bit, could you also please squash the PR to a single commit and force push it again ? I hope that we then get rid of the CLA issue so that we can merge that PR. Thanks !

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels Jul 10, 2019
@knative-metrics-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/kn/commands/revision/revision_list.go 80.6% 85.7% 5.2
pkg/kn/commands/service/service_list.go 79.2% 86.7% 7.5

@rhuss
Copy link
Contributor

rhuss commented Jul 10, 2019

/approve
/lgtm

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 10, 2019
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhuss, savitaashture

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

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.

8 participants