We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What happened:
For the following ResourceInterpreterCustomization resource:
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
I want to interpret the Service Status resource with the interpretStatus operation:
Service Status
interpretStatus
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
When I run with the following command:
karmadactl interpret -f reflectstatus.yaml --operation interpretStatus --observed-file service-status.yaml
I got the bellow error:
Execute InterpretStatus error: <string>:2: attempt to index a non-table object(nil) with key 'len' stack traceback: <string>:2: in main chunk [G]: ?
Then I tried other string functions, and it returned similar errors.
What you expected to happen:
The string function can be used normally.
string
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
This issue is related to lua VM initialization: pkg/resourceinterpreter/configurableinterpreter/luavm/lua.go:43
Environment:
kubectl-karmada version
karmadactl version
The text was updated successfully, but these errors were encountered:
Have you tested the #str method?
#str
Sorry, something went wrong.
Can you give me a demo usage?
/assign
Found the same problem that argo-cd had before: argoproj/argo-cd#6039
The solution is to introduce the useOpenLibs parameter, allow administrator enable lua standard library for health checks:
useOpenLibs
argoproj/argo-cd#6087
For us, opening a parameter for user settings may not be the best option.
The reason of disable lua standard library is:
karmada/pkg/util/lifted/lua_oslib_safe.go
Lines 7 to 10 in 83c7862
The lua standard libraries we want to use are string, math, so we can set up these two standard libraries additionally.
math
Add a lua string and math lib to the resource interpreter
chaunceyjiang
Successfully merging a pull request may close this issue.
What happened:
For the following ResourceInterpreterCustomization resource:
I want to interpret the
Service Status
resource with theinterpretStatus
operation:When I run with the following command:
I got the bellow error:
Then I tried other string functions, and it returned similar errors.
What you expected to happen:
The
string
function can be used normally.How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
This issue is related to lua VM initialization: pkg/resourceinterpreter/configurableinterpreter/luavm/lua.go:43
Environment:
kubectl-karmada version
orkarmadactl version
): karmada v1.4 and laterThe text was updated successfully, but these errors were encountered: