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

feat: Add a lua string and math lib to the resource interpreter. #3256

Merged
merged 1 commit into from Mar 11, 2023

Conversation

chaunceyjiang
Copy link
Member

@chaunceyjiang chaunceyjiang commented Mar 10, 2023

What type of PR is this?
/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #3247

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-controller-mamager`: Provided support for Lua's built-in string function in ResourceInterpreterCustomization.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 10, 2023
@karmada-bot karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 10, 2023
@chaunceyjiang
Copy link
Member Author

chaunceyjiang commented Mar 10, 2023

inpt.yaml

apiVersion: config.karmada.io/v1alpha1
kind: ResourceInterpreterCustomization
metadata:
  name: declarative-configuration-example
spec:
  target:
    apiVersion: v1
    kind: Service
  customizations:
    statusReflection:
      luaScript: >
        function ReflectStatus (observedObj)
          print(string.len("abc"))
          return observedObj.status
        end
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2023-03-06T12:24:10Z"
  labels:
    component: apiserver
    provider: kubernetes
  name: kubernetes
  namespace: default
  resourceVersion: "190"
  uid: 79febb3b-af42-4e83-aa4f-9095112771fb
spec:
  clusterIP: 10.96.0.1
  clusterIPs:
  - 10.96.0.1
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: 5443
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer:
    ingress:
    - ip: 172.1.1.1
    - ip: 192.1.3.2

image

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2023

Codecov Report

Merging #3256 (c395519) into master (e4f5b62) will increase coverage by 0.03%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3256      +/-   ##
==========================================
+ Coverage   49.15%   49.18%   +0.03%     
==========================================
  Files         206      206              
  Lines       18377    18390      +13     
==========================================
+ Hits         9033     9045      +12     
  Misses       8857     8857              
- Partials      487      488       +1     
Flag Coverage Δ
unittests 49.18% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ceinterpreter/configurableinterpreter/luavm/lua.go 57.48% <100.00%> (+0.33%) ⬆️

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@chaunceyjiang chaunceyjiang force-pushed the stringlib branch 2 times, most recently from ff4fce8 to 43be674 Compare March 10, 2023 02:56
@chaunceyjiang chaunceyjiang changed the title feat: Add a lua string lib to the resource interpreter. feat: Add a lua string and math lib to the resource interpreter. Mar 10, 2023
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
@chaunceyjiang
Copy link
Member Author

/cc @XiShanYongYe-Chang

Please take a look.

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks~
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 11, 2023
@karmada-bot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2023
@karmada-bot karmada-bot merged commit 6dc431d into karmada-io:master Mar 11, 2023
@XiShanYongYe-Chang
Copy link
Member

Hi @chaunceyjiang can you help cherry-pick this patch to the previous branch?

In addition, components karmada-agent also need to be added to the description in the release note.

karmada-bot added a commit that referenced this pull request Mar 16, 2023
…#3256-origin-release-1.5

Automated cherry pick of #3256: feat: add string and math lib for lua
karmada-bot added a commit that referenced this pull request Mar 21, 2023
…#3256-origin-release-1.4

Automated cherry pick of #3256: feat: add string and math lib for lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to use lua's built-in string function in ResourceInterpreterCustomization lua script
5 participants