(feat) Lua Scripting for Dynamic Kubernetes Deployments #960
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sveltos can execute Lua code stored in ConfigMap or Secret resources. To enable this functionality, these resources must be annotated with the
projectsveltos.io/lua
annotation.projectsveltos.io/lua
annotation.Sveltos provides helper functions to simplify working with resources:
resource using its identifier from the provided resource list. resources
represents all Kubernetes resources defined in the Spec.TemplateResourceRefs
section of a Sveltos profile. identifier must match an identifier previously
defined in the Spec.TemplateResourceRefs section of the profile.
specified key for a given resource.
with the specified key for a given resource.
Replace, Split, ToLower, ToUpper. We use https://github.com/chai2010/glua-strings
so full list can be found there. To use those methods
strings.ToUpper("mystring")
for instance
Sveltos allows users to extend its Lua scripting capabilities
by defining custom helper functions. These functions are packaged
as Lua code within a ConfigMap residing in the projectsveltos namespace.
For Sveltos to load and utilize these custom functions, the
lua-methods
argument must be provided to the addon-controller deployment. Once loaded,
these custom methods become available whenever Lua code is executed by Sveltos.
This PR uses:
Fixes #403