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

proposal of yurthub cache refactoring #897

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

Congrool
Copy link
Member

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

@openyurt-bot
Copy link
Collaborator

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

@rambohe-ch
Copy link
Member

@Congrool Maybe we should also consider the interface for reading objects from yurthub cache?

@Congrool
Copy link
Member Author

Congrool commented Jun 30, 2022

@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
Copy link
Member

rambohe-ch commented Jul 1, 2022

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

@Congrool
Copy link
Member Author

need revision
/hold

@openyurt-bot openyurt-bot added the approved approved label Jul 26, 2022
@Congrool Congrool changed the title proposal of yurthub cache refactoring [WIP] proposal of yurthub cache refactoring Aug 29, 2022
@openyurt-bot openyurt-bot added the do-not-merge/work-in-progress do-not-merge/work-in-progress label Aug 29, 2022
@openyurt-bot
Copy link
Collaborator

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

@Congrool Congrool changed the title [WIP] proposal of yurthub cache refactoring proposal of yurthub cache refactoring Nov 3, 2022
@openyurt-bot openyurt-bot removed the do-not-merge/work-in-progress do-not-merge/work-in-progress label Nov 3, 2022
@Congrool
Copy link
Member Author

Congrool commented Nov 3, 2022

revised according to the newest implementation

@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@475c156). Click here to learn what that means.
The diff coverage is n/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.

@rambohe-ch
Copy link
Member

@Congrool how about the definition of KeyBuildInfo and Key struct?

@Congrool
Copy link
Member Author

Congrool commented Nov 4, 2022

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.

Signed-off-by: Congrool <chpzhangyifei@zju.edu.cn>
@Congrool
Copy link
Member Author

Congrool commented Nov 4, 2022

proposal is updated with definition of Key and new interface names

@openyurt-bot
Copy link
Collaborator

[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

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

@rambohe-ch
Copy link
Member

/lgtm

@openyurt-bot openyurt-bot added the lgtm lgtm label Nov 4, 2022
@rambohe-ch rambohe-ch merged commit 1c09ee3 into openyurtio:master Nov 4, 2022
@Congrool Congrool deleted the refactor-doc branch November 7, 2022 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved approved kind/design kind/design kind/documentation kind/documentation lgtm lgtm sig/storage sig/storage size/L size/L: 100-499
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants