karmada
karmada copied to clipboard
[refactor] Resource Interpreter Framework cache and reorganize configurations
Signed-off-by: yingjinhui [email protected]
What type of PR is this? /kind feature
What this PR does / why we need it: add framework cache and reorganize configurations Resource Interpreter
Which issue(s) this PR fixes: Part of #2371
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
NONE
cc @XiShanYongYe-Chang @jameszhangyukun @chaunceyjiang
/assign @jameszhangyukun
@XiShanYongYe-Chang: GitHub didn't allow me to assign the following users: jameszhangyukun.
Note that only karmada-io 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:
/assign @jameszhangyukun
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 for the record: this pr is refactored based on the #2719.
Hi @ikaven1024 Could you please rebase and resolve the conflicts? (#2719 has been merged)
Which one should be the next do you think? this one, or #2731?
Which one should be the next do you think? this one, or #2731?
Let #2731 go on first. I will rebase and refactor after it completed.
Let's move on.
Let's move on.
OK, I am going to fix the conflict firstly. I will assign you after it's ready.
@XiShanYongYe-Chang PTAL
Codecov Report
Merging #2733 (d97c5c1) into master (32291df) will decrease coverage by
0.52%. The diff coverage is36.41%.
@@ Coverage Diff @@
## master #2733 +/- ##
==========================================
- Coverage 37.72% 37.20% -0.53%
==========================================
Files 200 200
Lines 18435 18351 -84
==========================================
- Hits 6955 6827 -128
- Misses 11075 11136 +61
+ Partials 405 388 -17
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 37.20% <36.41%> (-0.53%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...ceinterpreter/configurableinterpreter/luavm/lua.go | 25.17% <ø> (-31.92%) |
:arrow_down: |
| ...nterpreter/configurableinterpreter/configurable.go | 17.14% <18.30%> (ø) |
|
| ...nterpreter/configurableinterpreter/executor/lua.go | 50.54% <50.54%> (ø) |
|
| ...reter/configurableinterpreter/luavm/lua_convert.go | 65.21% <0.00%> (-8.70%) |
:arrow_down: |
| ...kg/scheduler/framework/runtime/metrics_recorder.go | 82.85% <0.00%> (-5.72%) |
:arrow_down: |
| pkg/search/proxy/store/util.go | 93.36% <0.00%> (-0.95%) |
:arrow_down: |
| ...r/configurableinterpreter/configmanager/manager.go |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
I have face this error twice, but do not known why. https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:23
Run export CLUSTER_VERSION=kindest/node:v1.22.7
Preparing: 'kind' existence check - passed
Preparing: 'kubectl' existence check - passed
Preparing kindClusterConfig in path: /tmp/tmp.BXOP8AvTSD
Creating cluster karmada-host and the log file is in /tmp/karmada/karmada-host.log
Creating cluster member1 and the log file is in /tmp/karmada/member1.log
Creating cluster member2 and the log file is in /tmp/karmada/member2.log
Creating cluster member3 and the log file is in /tmp/karmada/member3.log
make: Entering directory '/home/runner/work/karmada/karmada'
set -e;\
target=$(echo karmada-aggregated-apiserver);\
make $target GOOS=linux;\
VERSION=latest REGISTRY=swr.ap-southeast-1.myhuaweicloud.com/karmada BUILD_PLATFORMS=linux/amd64 hack/docker.sh $target
make[1]: Entering directory '/home/runner/work/karmada/karmada'
yacc vendor/github.com/yuin/gopher-lua/parse/parser.go.y
vendor/github.com/yuin/gopher-lua/parse/parser.go.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr]
mv -f y.tab.c vendor/github.com/yuin/gopher-lua/parse/parser.go.c
cc -c -o vendor/github.com/yuin/gopher-lua/parse/parser.go.o vendor/github.com/yuin/gopher-lua/parse/parser.go.c
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:2:1: error: unknown type name ‘package’
2 | package parse
| ^~~~~~~
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:4:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘import’
4 | import (
| ^~~~~~
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:3[5](https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:6):3: error: unknown type name ‘token’
35 | token ast.Token
| ^~~~~
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:35:13: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token
35 | token ast.Token
| ^
y.tab.c: In function ‘yyparse’:
y.tab.c:1515:1[6](https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:7): warning: implicit declaration of function ‘yylex’ [-Wimplicit-function-declaration]
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:[7](https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:8)4:19: error: ‘YYSTYPE’ {aka ‘union YYSTYPE’} has no member named ‘stmts’
74 | $$ = $1
| ^
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:74:3[8](https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:9): error: ‘YYSTYPE’ {aka ‘union YYSTYPE’} has no member named ‘stmts’
74 | $$ = $1
| ^
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:74:45: error: expected ‘;’ before ‘if’
74 | $$ = $1
| ^
| ;
75 | if l, ok := yylex.(*Lexer); ok {
| ~~
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:75:41: error: ‘ok’ undeclared (first use in this function)
75 | if l, ok := yylex.(*Lexer); ok {
y.tab.c:2504:7: warning: implicit declaration of function ‘yyerror’; did you mean ‘yyerrok’? [-Wimplicit-function-declaration]
vendor/github.com/yuin/gopher-lua/parse/parser.go.y: At top level:
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:51[9](https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:10):1: error: unknown type name ‘func’
519 | func TokenName(c int) string {
| ^~~~
vendor/github.com/yuin/gopher-lua/parse/parser.go.y:519:[16](https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:17): error: unknown type name ‘c’
5[19](https://github.com/karmada-io/karmada/actions/runs/3417843605/jobs/5689574998#step:4:20) | func TokenName(c int) string {
| ^
make[1]: *** [<builtin>: vendor/github.com/yuin/gopher-lua/parse/parser.go.o] Error 1
rm vendor/github.com/yuin/gopher-lua/parse/parser.go.c
make[1]: Leaving directory '/home/runner/work/karmada/karmada'
make: *** [Makefile:69: image-karmada-aggregated-apiserver] Error 2
make: Leaving directory '/home/runner/work/karmada/karmada'
@XiShanYongYe-Chang PTAL
Thanks~ Let me take a study.
/assign
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: To complete the pull request process, please ask for approval from rainbowmango after the PR has been reviewed.
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
After going through this approach, I think the complexity is much more than I expected.
@XiShanYongYe-Chang How much gap do we have according to the previous approach? Can we have a workable implementation quickly?
Can we have a workable implementation quickly?
You can experience with this branch: https://github.com/ikaven1024/karmada/tree/interpret-ctl-demo
I test it on my side:
- Apply the customization:
apiVersion: config.karmada.io/v1alpha1
kind: ResourceInterpreterCustomization
metadata:
spec:
customizations:
replicaResource:
luaScript: |
function GetReplicas(obj)
replica = obj.spec.replicas + 1
requirement = {}
return replica, requirement
end
target:
apiVersion: apps/v1
kind: Deployment
-
Apply deployment with 3 replicas
-
get deployment and see 4 replicas (affected by customization)
kubectl get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 4/3 4 4 3s
@XiShanYongYe-Chang @RainbowMango Plz take a loot at the new framework. (tests are not ready)
OK. working on it.