-
Notifications
You must be signed in to change notification settings - Fork 918
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
response actual resource list from search api #3312
Conversation
/assign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~
Can you help post your test result?
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #3312 +/- ##
===========================================
+ Coverage 38.98% 49.10% +10.11%
===========================================
Files 207 209 +2
Lines 19365 18763 -602
===========================================
+ Hits 7549 9213 +1664
+ Misses 11360 9049 -2311
- Partials 456 501 +45
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 68 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
You mean unit test? Or something like, I make a POC demo, to make sure the idea of this pr works as expect? |
Sorry, I didn't make it clear, just referring to a simple access and return result. |
Thanks~
|
/cc @RainbowMango |
podlist.mp4type response[T runtime.Object] struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Items []T
}
func listPod(client kubernetes.Interface) {
// var raw []byte
var raw runtime.Object
var err error
if raw, err = client.CoreV1().RESTClient().Get().RequestURI(
fmt.Sprintf("/apis/search.karmada.io/v1alpha1/search/cache/api/v1/namespaces/%s/pods", "lizhen6")).
//DoRaw(context.Background()); err != nil {
Do(context.Background()).Get(); err != nil {
panic(err)
}
//var pods response[*corev1.Pod]
//if err = json.Unmarshal(raw, &pods); err != nil {
// panic(err)
//}
pods, ok := raw.(*corev1.PodList)
if !ok {
panic("not pod list")
}
fmt.Printf("===== List Pod =====\n")
for _, item := range pods.Items {
fmt.Printf("Kind: %s, Name: %s, Namespace: %s, Annotations[\"resource.karmada.io/cached-from-cluster\"]: %s\n",
kind(item), item.Name, item.Namespace, item.Annotations["resource.karmada.io/cached-from-cluster"])
}
}
func kind(obj interface{}) string {
return reflect.Indirect(reflect.ValueOf(obj)).Type().Name()
} |
@tedli, thanks very much, the test you provided was very detailed |
Do you mean add a |
An occasional error occurred in the CLI test, not related to the current modification. Hi @tedli, can you squash your two commit into one commit? |
Signed-off-by: lizhen6 <lizhen6@360.cn>
Done. |
Thanks~ |
/assign @RainbowMango |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango, XiShanYongYe-Chang 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 |
@tedli I just noticed that GitHub can't recognize you by your email in the commit(author part). |
Thanks. I've updated, adding the email in git commit to github. |
Thanks. OK now. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
response actual resource list, then client code like
client-go
can decode response body into object corresponding to pre defined api type.Which issue(s) this PR fixes:
Fixes #3311
Special notes for your reviewer:
Does this PR introduce a user-facing change?: