karmada
                                
                                 karmada copied to clipboard
                                
                                    karmada copied to clipboard
                            
                            
                            
                        Improve access to member-cluster resources that use pb/json protocol …
…and allow users to set qps, burst values.
What type of PR is this?
/kind feature What this PR does / why we need it: In the large cluster, reasonable qps and burst values need to be set when accessing resources. to improve speed to resources.And use the pb/jsion protocol to improve the communication speed of sub-clusters for resources.
We design a compatibiity processing. when a null pointer is passed in qps and burst are not set.
Which issue(s) this PR fixes: Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
In the large cluster, reasonable qps and burst values need to be set when accessing resources. to improve speed to resources.And use the pb/jsion protocol to improve the communication speed of sub-clusters for resources.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by:
To complete the pull request process, please assign xishanyongye-chang after the PR has been reviewed.
You can assign the PR to them by writing /assign @xishanyongye-chang in a comment when ready.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Codecov Report
Attention: Patch coverage is 42.10526% with 11 lines in your changes are missing coverage. Please review.
Project coverage is 53.17%. Comparing base (
3232c52) to head (f4c8fc5). Report is 76 commits behind head on master.
| Files | Patch % | Lines | 
|---|---|---|
| pkg/util/membercluster_client.go | 31.25% | 5 Missing and 6 partials :warning: | 
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4936      +/-   ##
==========================================
+ Coverage   53.05%   53.17%   +0.11%     
==========================================
  Files         250      252       +2     
  Lines       20396    20520     +124     
==========================================
+ Hits        10822    10911      +89     
- Misses       8855     8884      +29     
- Partials      719      725       +6     
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 53.17% <42.10%> (+0.11%) | :arrow_up: | 
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
/retest
@wangxf1987: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
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.
Just retested it manually. Sorry for the inconvenience.
The /retest command is not working now, but we are working on it.
Another way to retrigger the test is to rebase PR and force push again.
/retest
@wangxf1987 Do you still need it?
@wangxf1987 Do you still need it?
I need this feature. I've tried karamada-search v1.12.3, and still got the error:
E0214 08:14:12.024022       1 writers.go:122] "Unhandled Error" err="apiserver was unable to write a JSON response: object *unstructured.Unstructured does not implement the protobuf marshalling interface and cannot be encoded to a protobuf message"
@iamyeka Hi, do you know in what scenario this log appears?
@iamyeka Hi, do you know in what scenario this log appears?
- Install karmada-search by default config
- Init a clientSet by default config
	restConfig, err := config.ClientConfig()
	if err != nil {
		return err
	}
	restConfig = metadata.ConfigFor(restConfig)
	clientSet, err := kubernetes.NewForConfig(restConfig)
	if err != nil {
		return err
	}
- Exec a command like below
pod, err := kubeClientset.CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})
If i specify the restConfig like this: restConfig.AcceptContentTypes = "application/json", the problem is gone.
The default AcceptContentTypes is like this:
// ConfigFor returns a copy of the provided config with the
// appropriate metadata client defaults set.
func ConfigFor(inConfig *rest.Config) *rest.Config {
	config := rest.CopyConfig(inConfig)
	config.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json"
	config.ContentType = "application/vnd.kubernetes.protobuf"
	config.NegotiatedSerializer = metainternalversionscheme.Codecs.WithoutConversion()
	if config.UserAgent == "" {
		config.UserAgent = rest.DefaultKubernetesUserAgent()
	}
	return config
}