openyurt
openyurt copied to clipboard
[WIP] proposal of yurthub cache refactoring
What type of PR is this?
/kind documentation /kind design /sig storage
What this PR does / why we need it:
When implementing the feature of pool-coordinator, I encountered serval problems to be solved first. So, it is this pr. Details are in the proposal.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
other Note
@Congrool: GitHub didn't allow me to assign the following users: your_reviewer.
Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide
In response to this:
What type of PR is this?
/kind documentation /kind design /sig storage
What this PR does / why we need it:
When implementing the feature of pool-coordinator, I encountered serval problems to be solved first. So, it is this pr. Details are in the proposal.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
other Note
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.
@Congrool Maybe we should also consider the interface for reading objects from yurthub cache?
@rambohe-ch Currently we have Get/List/ListKeys only for reading objects in diskStorage. In the case of Pool-Coordiantor, the read request will be send to the APIServer in pool-coordinator, so it does not need to use the read interface to read object from cache directly.
The problem i can find is that the function of List is so weak for using.
// List will retrieve all contents whose keys have the prefix of rootKey.
// If rootKey is empty, ErrKeyIsEmpty will be returned.
// If the rootKey does not exist in the store, ErrStorageNotFound will be returned.
// If the rootKey exists in the store but no keys has the prefix of rootKey,
// an empty content slice will be returned.
List(rootKey Key) ([][]byte, error)
We can see that List only has rootKey as its parameter, which means it cannot list objects with selector. Thus, we can only support one kind of selector for each resource per component as described in #265 . It will be a problem if one component need to list the same resource with different selectors. But currently, we haven't encountered such a component. We can do this enhancement when we have to be faced with it.
@rambohe-ch Currently we have Get/List/ListKeys only for reading objects in diskStorage. In the case of Pool-Coordiantor, the read request will be send to the APIServer in pool-coordinator, so it does not need to use the read interface to read object from cache directly.
@Congrool ok, the conclusion is that pool-coordinator will not implement Get/List/ListKeys funcs for Storage interface because yurthub read from kube-apiserver of pool-coordinator directly.
need revision /hold
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: Congrool, rambohe-ch
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [rambohe-ch]
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
@qclc: changing LGTM is restricted to collaborators
In response to this:
/lgtm
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.
revised according to the newest implementation
Codecov Report
:exclamation: No coverage uploaded for pull request base (
master@475c156
). Click here to learn what that means. The diff coverage isn/a
.
@@ Coverage Diff @@
## master #897 +/- ##
=========================================
Coverage ? 49.45%
=========================================
Files ? 96
Lines ? 13054
Branches ? 0
=========================================
Hits ? 6456
Misses ? 6061
Partials ? 537
Flag | Coverage Δ | |
---|---|---|
unittests | 49.45% <0.00%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
@Congrool how about the definition of KeyBuildInfo
and Key
struct?
The definition of Key is like:
type Key interface {
Key() string
}
type KeyBuildInfo struct {
Component string
Namespace string
Name string
Resources string
Group string
Version string
}
I'll update it in this proposal.
proposal is updated with definition of Key and new interface names
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: Congrool, rambohe-ch
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [rambohe-ch]
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
/lgtm