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
feat: predefined configurableInterpreter #2768
feat: predefined configurableInterpreter #2768
Conversation
fa2cb96
to
b639f25
Compare
/cc @ikaven1024 @RainbowMango @XiShanYongYe-Chang What do you think? |
pkg/resourceinterpreter/predefinedconfigurableinterpreter/configurable.go
Outdated
Show resolved
Hide resolved
pkg/resourceinterpreter/predefinedconfigurableinterpreter/configurable.go
Outdated
Show resolved
Hide resolved
pkg/resourceinterpreter/predefinedconfigurableinterpreter/configurable.go
Outdated
Show resolved
Hide resolved
pkg/resourceinterpreter/predefinedconfigurableinterpreter/configurable.go
Outdated
Show resolved
Hide resolved
I do't understand what scene need this feature. Could you show a user case? |
Currently, the built-in interpreter only maintains K8S resources. For some well-known third-party projects, Karmada may need to do some maintenance to reduce the cost of using the ConfigurableInterpreter. For example, |
This interpreters are supplied by karmada, then why not implement them with |
Because if you use |
We can use unstructed, no need import real APIs |
This requires the maintainer of the third-party project to be familiar with the code of Karmada. On the other hand, this mechanism is convenient for the maintainer of the third-party project, not the maintainer of Kamrada. |
That's say, these script files are committed by third-party project. |
Yes, Karmada maintainer or third-party project maintainer. |
Hi @chaunceyjiang, would you like to keep this pr going? We have plans to integrate with some well-known projects. I think this pr is needed. |
Sure |
b639f25
to
7b86e50
Compare
Directory Structure
customizations.yaml
Q: Why is such a directory structure set up, and what are the benefits of doing so? |
9665531
to
a2e4d6f
Compare
No, there will be some YAML files for testing one type of resource, and each type of resource has about 10 test files. So there are about 100 types of resources. |
100 resources VS 1MB, is totally acceptable I guess. |
yes, i think so. |
Can the luavm directory be separated from configureinterpreter? |
I think keeping the luavm in |
73e4d20
to
5de9942
Compare
5de9942
to
abf20ee
Compare
Good job! Could you please post the latest test result(whether the built-in configurableInterpret takes effect and whether users can override the default third-party crds)? |
build-in third-party configurableInterpreter: users can override the third-party configurableInterpreter:
krmada control plane: ➤ k get clone -oyaml |
/lgtm |
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~
if d.IsDir() { | ||
return nil | ||
} | ||
if strings.Contains(d.Name(), "testdata") { |
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.
When is this going to happen?
Should we add a new document to describe how to use this feature?
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.
This is just to filter out test files.
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.
I'm sorry, I missed submitting my comments/questions...
abf20ee
to
c4d3726
Compare
…party projects. Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
c4d3726
to
538d8f1
Compare
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.
Just one question from me.
/assign @XiShanYongYe-Chang
replica, requires, hookEnabled, err = i.thirdpartyInterpreter.GetReplicas(object) | ||
if err != nil { | ||
return | ||
} | ||
if hookEnabled { | ||
return | ||
} |
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.
Should we put the thirdpartyInterpreter
after the defaultInterpreter
for better efficiency?
I think K8s native resources are used more often than third-party ones.
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.
Same as below.
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.
The resources interpreted by thirdpartyInterpreter
and thirdpartyInterpreter
maybe not overlap, and I agree with this point.
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.
The resources interpreted by thirdpartyInterpreter and thirdpartyInterpreter maybe not overlap
Yes, that's exactly what I was thinking.
@chaunceyjiang What do you think?
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.
In the ReflectStatus
of defaultInterpreter
, if there is no built-in handler, it will attempt to collect the whole status from '.status' filed.
If thirdpartyInterpreter
is placed after defaultInterpreter
, then the ReflectStatus
of thirdpartyInterpreter
will not take effect.
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.
@RainbowMango @XiShanYongYe-Chang What do you think?
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.
If thirdpartyInterpreter is placed after defaultInterpreter, then the ReflectStatus of thirdpartyInterpreter will not take effect.
Good point!
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.
I missed that, thank you.
/approve
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.
Generally LGTM.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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 |
Signed-off-by: chaunceyjiang chaunceyjiang@gmail.com
What type of PR is this?
/kind feature
What this PR does / why we need it:
Predefine ConfigurableInterpreter for some well-known third-party projects.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: