fix format of lua script in karmada api
Signed-off-by: chaosi-zju <chaosi@zju.edu.cn>
This commit is contained in:
parent
ed07dad2d4
commit
7bc10af1e9
|
@ -20639,7 +20639,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
"description": "LuaScript holds the Lua script that is used to interpret the dependencies of a specific resource. The script should implement a function as follows:\n luaScript: \u003e\n function GetDependencies(desiredObj)\n dependencies = {}\n if desiredObj.spec.serviceAccountName ~= nil and desiredObj.spec.serviceAccountName ~= \"default\" then\n dependency = {}\n dependency.apiVersion = \"v1\"\n dependency.kind = \"ServiceAccount\"\n dependency.name = desiredObj.spec.serviceAccountName\n dependency.namespace = desiredObj.namespace\n dependencies[1] = {}\n dependencies[1] = dependency\n end\n return dependencies\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe returned value should be expressed by a slice of DependentObjectReference.",
|
"description": "LuaScript holds the Lua script that is used to interpret the dependencies of a specific resource. The script should implement a function as follows:\n\n```\n luaScript: \u003e\n function GetDependencies(desiredObj)\n dependencies = {}\n if desiredObj.spec.serviceAccountName ~= nil and desiredObj.spec.serviceAccountName ~= \"default\" then\n dependency = {}\n dependency.apiVersion = \"v1\"\n dependency.kind = \"ServiceAccount\"\n dependency.name = desiredObj.spec.serviceAccountName\n dependency.namespace = desiredObj.namespace\n dependencies[1] = {}\n dependencies[1] = dependency\n end\n return dependencies\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe returned value should be expressed by a slice of DependentObjectReference.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
|
@ -20653,7 +20653,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
"description": "LuaScript holds the Lua script that is used to assess the health state of a specific resource. The script should implement a function as follows:\n luaScript: \u003e\n function InterpretHealth(observedObj)\n if observedObj.status.readyReplicas == observedObj.spec.replicas then\n return true\n end\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned boolean value indicates the health status.",
|
"description": "LuaScript holds the Lua script that is used to assess the health state of a specific resource. The script should implement a function as follows:\n\n```\n luaScript: \u003e\n function InterpretHealth(observedObj)\n if observedObj.status.readyReplicas == observedObj.spec.replicas then\n return true\n end\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned boolean value indicates the health status.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
|
@ -20667,7 +20667,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
"description": "LuaScript holds the Lua script that is used to retain runtime values to the desired specification.\n\nThe script should implement a function as follows:\n luaScript: \u003e\n function Retain(desiredObj, observedObj)\n desiredObj.spec.fieldFoo = observedObj.spec.fieldFoo\n return desiredObj\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned object should be a retained configuration which will be applied to member cluster eventually.",
|
"description": "LuaScript holds the Lua script that is used to retain runtime values to the desired specification.\n\nThe script should implement a function as follows:\n\n```\n luaScript: \u003e\n function Retain(desiredObj, observedObj)\n desiredObj.spec.fieldFoo = observedObj.spec.fieldFoo\n return desiredObj\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned object should be a retained configuration which will be applied to member cluster eventually.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
|
@ -20681,7 +20681,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
"description": "LuaScript holds the Lua script that is used to discover the resource's replica as well as resource requirements\n\nThe script should implement a function as follows:\n luaScript: \u003e\n function GetReplicas(desiredObj)\n replica = desiredObj.spec.replicas\n requirement = {}\n requirement.nodeClaim = {}\n requirement.nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector\n requirement.nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations\n requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits\n return replica, requirement\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe function expects two return values:\n - replica: the declared replica number\n - requirement: the resource required by each replica expressed with a\n ResourceBindingSpec.ReplicaRequirements.\nThe returned values will be set into a ResourceBinding or ClusterResourceBinding.",
|
"description": "LuaScript holds the Lua script that is used to discover the resource's replica as well as resource requirements\n\nThe script should implement a function as follows:\n\n```\n luaScript: \u003e\n function GetReplicas(desiredObj)\n replica = desiredObj.spec.replicas\n requirement = {}\n requirement.nodeClaim = {}\n requirement.nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector\n requirement.nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations\n requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits\n return replica, requirement\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe function expects two return values:\n - replica: the declared replica number\n - requirement: the resource required by each replica expressed with a\n ResourceBindingSpec.ReplicaRequirements.\nThe returned values will be set into a ResourceBinding or ClusterResourceBinding.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
|
@ -20695,7 +20695,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
"description": "LuaScript holds the Lua script that is used to revise replicas in the desired specification. The script should implement a function as follows:\n luaScript: \u003e\n function ReviseReplica(desiredObj, desiredReplica)\n desiredObj.spec.replicas = desiredReplica\n return desiredObj\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - desiredReplica: the replica number should be applied with.\n\nThe returned object should be a revised configuration which will be applied to member cluster eventually.",
|
"description": "LuaScript holds the Lua script that is used to revise replicas in the desired specification. The script should implement a function as follows:\n\n```\n luaScript: \u003e\n function ReviseReplica(desiredObj, desiredReplica)\n desiredObj.spec.replicas = desiredReplica\n return desiredObj\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - desiredReplica: the replica number should be applied with.\n\nThe returned object should be a revised configuration which will be applied to member cluster eventually.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
|
@ -20955,7 +20955,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
"description": "LuaScript holds the Lua script that is used to aggregate decentralized statuses to the desired specification. The script should implement a function as follows:\n luaScript: \u003e\n function AggregateStatus(desiredObj, statusItems)\n for i = 1, #statusItems do\n desiredObj.status.readyReplicas = desiredObj.status.readyReplicas + items[i].readyReplicas\n end\n return desiredObj\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents a resource template.\n - statusItems: the slice of status expressed with AggregatedStatusItem.\n\nThe returned object should be a whole object with status aggregated.",
|
"description": "LuaScript holds the Lua script that is used to aggregate decentralized statuses to the desired specification. The script should implement a function as follows:\n\n```\n luaScript: \u003e\n function AggregateStatus(desiredObj, statusItems)\n for i = 1, #statusItems do\n desiredObj.status.readyReplicas = desiredObj.status.readyReplicas + items[i].readyReplicas\n end\n return desiredObj\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents a resource template.\n - statusItems: the slice of status expressed with AggregatedStatusItem.\n\nThe returned object should be a whole object with status aggregated.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
|
@ -20969,7 +20969,7 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
"description": "LuaScript holds the Lua script that is used to get the status from the observed specification. The script should implement a function as follows:\n luaScript: \u003e\n function ReflectStatus(observedObj)\n status = {}\n status.readyReplicas = observedObj.status.observedObj\n return status\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned status could be the whole status or part of it and will be set into both Work and ResourceBinding(ClusterResourceBinding).",
|
"description": "LuaScript holds the Lua script that is used to get the status from the observed specification. The script should implement a function as follows:\n\n```\n luaScript: \u003e\n function ReflectStatus(observedObj)\n status = {}\n status.readyReplicas = observedObj.status.observedObj\n return status\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned status could be the whole status or part of it and will be set into both Work and ResourceBinding(ClusterResourceBinding).",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,14 @@ spec:
|
||||||
luaScript:
|
luaScript:
|
||||||
description: "LuaScript holds the Lua script that is used
|
description: "LuaScript holds the Lua script that is used
|
||||||
to interpret the dependencies of a specific resource. The
|
to interpret the dependencies of a specific resource. The
|
||||||
script should implement a function as follows: luaScript:
|
script should implement a function as follows: \n ``` luaScript:
|
||||||
> function GetDependencies(desiredObj) dependencies = {}
|
> function GetDependencies(desiredObj) dependencies = {}
|
||||||
if desiredObj.spec.serviceAccountName ~= nil and desiredObj.spec.serviceAccountName
|
if desiredObj.spec.serviceAccountName ~= nil and desiredObj.spec.serviceAccountName
|
||||||
~= \"default\" then dependency = {} dependency.apiVersion
|
~= \"default\" then dependency = {} dependency.apiVersion
|
||||||
= \"v1\" dependency.kind = \"ServiceAccount\" dependency.name
|
= \"v1\" dependency.kind = \"ServiceAccount\" dependency.name
|
||||||
= desiredObj.spec.serviceAccountName dependency.namespace
|
= desiredObj.spec.serviceAccountName dependency.namespace
|
||||||
= desiredObj.namespace dependencies[1] = {} dependencies[1]
|
= desiredObj.namespace dependencies[1] = {} dependencies[1]
|
||||||
= dependency end return dependencies end \n The content
|
= dependency end return dependencies end ``` \n The content
|
||||||
of the LuaScript needs to be a whole function including
|
of the LuaScript needs to be a whole function including
|
||||||
both declaration and implementation. \n The parameters will
|
both declaration and implementation. \n The parameters will
|
||||||
be supplied by the system: - desiredObj: the object represents
|
be supplied by the system: - desiredObj: the object represents
|
||||||
|
@ -75,10 +75,10 @@ spec:
|
||||||
luaScript:
|
luaScript:
|
||||||
description: "LuaScript holds the Lua script that is used
|
description: "LuaScript holds the Lua script that is used
|
||||||
to assess the health state of a specific resource. The script
|
to assess the health state of a specific resource. The script
|
||||||
should implement a function as follows: luaScript: > function
|
should implement a function as follows: \n ``` luaScript:
|
||||||
InterpretHealth(observedObj) if observedObj.status.readyReplicas
|
> function InterpretHealth(observedObj) if observedObj.status.readyReplicas
|
||||||
== observedObj.spec.replicas then return true end end \n
|
== observedObj.spec.replicas then return true end end ```
|
||||||
The content of the LuaScript needs to be a whole function
|
\n The content of the LuaScript needs to be a whole function
|
||||||
including both declaration and implementation. \n The parameters
|
including both declaration and implementation. \n The parameters
|
||||||
will be supplied by the system: - observedObj: the object
|
will be supplied by the system: - observedObj: the object
|
||||||
represents the configuration that is observed from a specific
|
represents the configuration that is observed from a specific
|
||||||
|
@ -100,14 +100,14 @@ spec:
|
||||||
luaScript:
|
luaScript:
|
||||||
description: "LuaScript holds the Lua script that is used
|
description: "LuaScript holds the Lua script that is used
|
||||||
to discover the resource's replica as well as resource requirements
|
to discover the resource's replica as well as resource requirements
|
||||||
\n The script should implement a function as follows: luaScript:
|
\n The script should implement a function as follows: \n
|
||||||
> function GetReplicas(desiredObj) replica = desiredObj.spec.replicas
|
``` luaScript: > function GetReplicas(desiredObj) replica
|
||||||
requirement = {} requirement.nodeClaim = {} requirement.nodeClaim.nodeSelector
|
= desiredObj.spec.replicas requirement = {} requirement.nodeClaim
|
||||||
= desiredObj.spec.template.spec.nodeSelector requirement.nodeClaim.tolerations
|
= {} requirement.nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector
|
||||||
= desiredObj.spec.template.spec.tolerations requirement.resourceRequest
|
requirement.nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations
|
||||||
= desiredObj.spec.template.spec.containers[1].resources.limits
|
requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits
|
||||||
return replica, requirement end \n The content of the LuaScript
|
return replica, requirement end ``` \n The content of the
|
||||||
needs to be a whole function including both declaration
|
LuaScript needs to be a whole function including both declaration
|
||||||
and implementation. \n The parameters will be supplied by
|
and implementation. \n The parameters will be supplied by
|
||||||
the system: - desiredObj: the object represents the configuration
|
the system: - desiredObj: the object represents the configuration
|
||||||
to be applied to the member cluster. \n The function expects
|
to be applied to the member cluster. \n The function expects
|
||||||
|
@ -130,12 +130,12 @@ spec:
|
||||||
luaScript:
|
luaScript:
|
||||||
description: "LuaScript holds the Lua script that is used
|
description: "LuaScript holds the Lua script that is used
|
||||||
to revise replicas in the desired specification. The script
|
to revise replicas in the desired specification. The script
|
||||||
should implement a function as follows: luaScript: > function
|
should implement a function as follows: \n ``` luaScript:
|
||||||
ReviseReplica(desiredObj, desiredReplica) desiredObj.spec.replicas
|
> function ReviseReplica(desiredObj, desiredReplica) desiredObj.spec.replicas
|
||||||
= desiredReplica return desiredObj end \n The content of
|
= desiredReplica return desiredObj end ``` \n The content
|
||||||
the LuaScript needs to be a whole function including both
|
of the LuaScript needs to be a whole function including
|
||||||
declaration and implementation. \n The parameters will be
|
both declaration and implementation. \n The parameters will
|
||||||
supplied by the system: - desiredObj: the object represents
|
be supplied by the system: - desiredObj: the object represents
|
||||||
the configuration to be applied to the member cluster. -
|
the configuration to be applied to the member cluster. -
|
||||||
desiredReplica: the replica number should be applied with.
|
desiredReplica: the replica number should be applied with.
|
||||||
\n The returned object should be a revised configuration
|
\n The returned object should be a revised configuration
|
||||||
|
@ -157,17 +157,17 @@ spec:
|
||||||
luaScript:
|
luaScript:
|
||||||
description: "LuaScript holds the Lua script that is used
|
description: "LuaScript holds the Lua script that is used
|
||||||
to retain runtime values to the desired specification. \n
|
to retain runtime values to the desired specification. \n
|
||||||
The script should implement a function as follows: luaScript:
|
The script should implement a function as follows: \n ```
|
||||||
> function Retain(desiredObj, observedObj) desiredObj.spec.fieldFoo
|
luaScript: > function Retain(desiredObj, observedObj) desiredObj.spec.fieldFoo
|
||||||
= observedObj.spec.fieldFoo return desiredObj end \n The
|
= observedObj.spec.fieldFoo return desiredObj end ``` \n
|
||||||
content of the LuaScript needs to be a whole function including
|
The content of the LuaScript needs to be a whole function
|
||||||
both declaration and implementation. \n The parameters will
|
including both declaration and implementation. \n The parameters
|
||||||
be supplied by the system: - desiredObj: the object represents
|
will be supplied by the system: - desiredObj: the object
|
||||||
the configuration to be applied to the member cluster. -
|
represents the configuration to be applied to the member
|
||||||
observedObj: the object represents the configuration that
|
cluster. - observedObj: the object represents the configuration
|
||||||
is observed from a specific member cluster. \n The returned
|
that is observed from a specific member cluster. \n The
|
||||||
object should be a retained configuration which will be
|
returned object should be a retained configuration which
|
||||||
applied to member cluster eventually."
|
will be applied to member cluster eventually."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
@ -182,11 +182,11 @@ spec:
|
||||||
luaScript:
|
luaScript:
|
||||||
description: "LuaScript holds the Lua script that is used
|
description: "LuaScript holds the Lua script that is used
|
||||||
to aggregate decentralized statuses to the desired specification.
|
to aggregate decentralized statuses to the desired specification.
|
||||||
The script should implement a function as follows: luaScript:
|
The script should implement a function as follows: \n ```
|
||||||
> function AggregateStatus(desiredObj, statusItems) for
|
luaScript: > function AggregateStatus(desiredObj, statusItems)
|
||||||
i = 1, #statusItems do desiredObj.status.readyReplicas =
|
for i = 1, #statusItems do desiredObj.status.readyReplicas
|
||||||
desiredObj.status.readyReplicas + items[i].readyReplicas
|
= desiredObj.status.readyReplicas + items[i].readyReplicas
|
||||||
end return desiredObj end \n The content of the LuaScript
|
end return desiredObj end ``` \n The content of the LuaScript
|
||||||
needs to be a whole function including both declaration
|
needs to be a whole function including both declaration
|
||||||
and implementation. \n The parameters will be supplied by
|
and implementation. \n The parameters will be supplied by
|
||||||
the system: - desiredObj: the object represents a resource
|
the system: - desiredObj: the object represents a resource
|
||||||
|
@ -206,15 +206,16 @@ spec:
|
||||||
luaScript:
|
luaScript:
|
||||||
description: "LuaScript holds the Lua script that is used
|
description: "LuaScript holds the Lua script that is used
|
||||||
to get the status from the observed specification. The script
|
to get the status from the observed specification. The script
|
||||||
should implement a function as follows: luaScript: > function
|
should implement a function as follows: \n ``` luaScript:
|
||||||
ReflectStatus(observedObj) status = {} status.readyReplicas
|
> function ReflectStatus(observedObj) status = {} status.readyReplicas
|
||||||
= observedObj.status.observedObj return status end \n The
|
= observedObj.status.observedObj return status end ``` \n
|
||||||
content of the LuaScript needs to be a whole function including
|
The content of the LuaScript needs to be a whole function
|
||||||
both declaration and implementation. \n The parameters will
|
including both declaration and implementation. \n The parameters
|
||||||
be supplied by the system: - observedObj: the object represents
|
will be supplied by the system: - observedObj: the object
|
||||||
the configuration that is observed from a specific member
|
represents the configuration that is observed from a specific
|
||||||
cluster. \n The returned status could be the whole status
|
member cluster. \n The returned status could be the whole
|
||||||
or part of it and will be set into both Work and ResourceBinding(ClusterResourceBinding)."
|
status or part of it and will be set into both Work and
|
||||||
|
ResourceBinding(ClusterResourceBinding)."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
|
|
@ -139,11 +139,14 @@ type LocalValueRetention struct {
|
||||||
// to the desired specification.
|
// to the desired specification.
|
||||||
//
|
//
|
||||||
// The script should implement a function as follows:
|
// The script should implement a function as follows:
|
||||||
|
//
|
||||||
|
// ```
|
||||||
// luaScript: >
|
// luaScript: >
|
||||||
// function Retain(desiredObj, observedObj)
|
// function Retain(desiredObj, observedObj)
|
||||||
// desiredObj.spec.fieldFoo = observedObj.spec.fieldFoo
|
// desiredObj.spec.fieldFoo = observedObj.spec.fieldFoo
|
||||||
// return desiredObj
|
// return desiredObj
|
||||||
// end
|
// end
|
||||||
|
// ```
|
||||||
//
|
//
|
||||||
// The content of the LuaScript needs to be a whole function including both
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// declaration and implementation.
|
// declaration and implementation.
|
||||||
|
@ -167,6 +170,8 @@ type ReplicaResourceRequirement struct {
|
||||||
// replica as well as resource requirements
|
// replica as well as resource requirements
|
||||||
//
|
//
|
||||||
// The script should implement a function as follows:
|
// The script should implement a function as follows:
|
||||||
|
//
|
||||||
|
// ```
|
||||||
// luaScript: >
|
// luaScript: >
|
||||||
// function GetReplicas(desiredObj)
|
// function GetReplicas(desiredObj)
|
||||||
// replica = desiredObj.spec.replicas
|
// replica = desiredObj.spec.replicas
|
||||||
|
@ -177,6 +182,7 @@ type ReplicaResourceRequirement struct {
|
||||||
// requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits
|
// requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits
|
||||||
// return replica, requirement
|
// return replica, requirement
|
||||||
// end
|
// end
|
||||||
|
// ```
|
||||||
//
|
//
|
||||||
// The content of the LuaScript needs to be a whole function including both
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// declaration and implementation.
|
// declaration and implementation.
|
||||||
|
@ -198,11 +204,14 @@ type ReplicaResourceRequirement struct {
|
||||||
type ReplicaRevision struct {
|
type ReplicaRevision struct {
|
||||||
// LuaScript holds the Lua script that is used to revise replicas in the desired specification.
|
// LuaScript holds the Lua script that is used to revise replicas in the desired specification.
|
||||||
// The script should implement a function as follows:
|
// The script should implement a function as follows:
|
||||||
|
//
|
||||||
|
// ```
|
||||||
// luaScript: >
|
// luaScript: >
|
||||||
// function ReviseReplica(desiredObj, desiredReplica)
|
// function ReviseReplica(desiredObj, desiredReplica)
|
||||||
// desiredObj.spec.replicas = desiredReplica
|
// desiredObj.spec.replicas = desiredReplica
|
||||||
// return desiredObj
|
// return desiredObj
|
||||||
// end
|
// end
|
||||||
|
// ```
|
||||||
//
|
//
|
||||||
// The content of the LuaScript needs to be a whole function including both
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// declaration and implementation.
|
// declaration and implementation.
|
||||||
|
@ -222,12 +231,15 @@ type ReplicaRevision struct {
|
||||||
type StatusReflection struct {
|
type StatusReflection struct {
|
||||||
// LuaScript holds the Lua script that is used to get the status from the observed specification.
|
// LuaScript holds the Lua script that is used to get the status from the observed specification.
|
||||||
// The script should implement a function as follows:
|
// The script should implement a function as follows:
|
||||||
|
//
|
||||||
|
// ```
|
||||||
// luaScript: >
|
// luaScript: >
|
||||||
// function ReflectStatus(observedObj)
|
// function ReflectStatus(observedObj)
|
||||||
// status = {}
|
// status = {}
|
||||||
// status.readyReplicas = observedObj.status.observedObj
|
// status.readyReplicas = observedObj.status.observedObj
|
||||||
// return status
|
// return status
|
||||||
// end
|
// end
|
||||||
|
// ```
|
||||||
//
|
//
|
||||||
// The content of the LuaScript needs to be a whole function including both
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// declaration and implementation.
|
// declaration and implementation.
|
||||||
|
@ -247,6 +259,8 @@ type StatusAggregation struct {
|
||||||
// LuaScript holds the Lua script that is used to aggregate decentralized statuses
|
// LuaScript holds the Lua script that is used to aggregate decentralized statuses
|
||||||
// to the desired specification.
|
// to the desired specification.
|
||||||
// The script should implement a function as follows:
|
// The script should implement a function as follows:
|
||||||
|
//
|
||||||
|
// ```
|
||||||
// luaScript: >
|
// luaScript: >
|
||||||
// function AggregateStatus(desiredObj, statusItems)
|
// function AggregateStatus(desiredObj, statusItems)
|
||||||
// for i = 1, #statusItems do
|
// for i = 1, #statusItems do
|
||||||
|
@ -254,6 +268,7 @@ type StatusAggregation struct {
|
||||||
// end
|
// end
|
||||||
// return desiredObj
|
// return desiredObj
|
||||||
// end
|
// end
|
||||||
|
// ```
|
||||||
//
|
//
|
||||||
// The content of the LuaScript needs to be a whole function including both
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// declaration and implementation.
|
// declaration and implementation.
|
||||||
|
@ -273,12 +288,15 @@ type HealthInterpretation struct {
|
||||||
// LuaScript holds the Lua script that is used to assess the health state of
|
// LuaScript holds the Lua script that is used to assess the health state of
|
||||||
// a specific resource.
|
// a specific resource.
|
||||||
// The script should implement a function as follows:
|
// The script should implement a function as follows:
|
||||||
|
//
|
||||||
|
// ```
|
||||||
// luaScript: >
|
// luaScript: >
|
||||||
// function InterpretHealth(observedObj)
|
// function InterpretHealth(observedObj)
|
||||||
// if observedObj.status.readyReplicas == observedObj.spec.replicas then
|
// if observedObj.status.readyReplicas == observedObj.spec.replicas then
|
||||||
// return true
|
// return true
|
||||||
// end
|
// end
|
||||||
// end
|
// end
|
||||||
|
// ```
|
||||||
//
|
//
|
||||||
// The content of the LuaScript needs to be a whole function including both
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// declaration and implementation.
|
// declaration and implementation.
|
||||||
|
@ -299,6 +317,8 @@ type DependencyInterpretation struct {
|
||||||
// LuaScript holds the Lua script that is used to interpret the dependencies of
|
// LuaScript holds the Lua script that is used to interpret the dependencies of
|
||||||
// a specific resource.
|
// a specific resource.
|
||||||
// The script should implement a function as follows:
|
// The script should implement a function as follows:
|
||||||
|
//
|
||||||
|
// ```
|
||||||
// luaScript: >
|
// luaScript: >
|
||||||
// function GetDependencies(desiredObj)
|
// function GetDependencies(desiredObj)
|
||||||
// dependencies = {}
|
// dependencies = {}
|
||||||
|
@ -313,6 +333,7 @@ type DependencyInterpretation struct {
|
||||||
// end
|
// end
|
||||||
// return dependencies
|
// return dependencies
|
||||||
// end
|
// end
|
||||||
|
// ```
|
||||||
//
|
//
|
||||||
// The content of the LuaScript needs to be a whole function including both
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// declaration and implementation.
|
// declaration and implementation.
|
||||||
|
|
|
@ -1805,7 +1805,7 @@ func schema_pkg_apis_config_v1alpha1_DependencyInterpretation(ref common.Referen
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "LuaScript holds the Lua script that is used to interpret the dependencies of a specific resource. The script should implement a function as follows:\n luaScript: >\n function GetDependencies(desiredObj)\n dependencies = {}\n if desiredObj.spec.serviceAccountName ~= nil and desiredObj.spec.serviceAccountName ~= \"default\" then\n dependency = {}\n dependency.apiVersion = \"v1\"\n dependency.kind = \"ServiceAccount\"\n dependency.name = desiredObj.spec.serviceAccountName\n dependency.namespace = desiredObj.namespace\n dependencies[1] = {}\n dependencies[1] = dependency\n end\n return dependencies\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe returned value should be expressed by a slice of DependentObjectReference.",
|
Description: "LuaScript holds the Lua script that is used to interpret the dependencies of a specific resource. The script should implement a function as follows:\n\n```\n luaScript: >\n function GetDependencies(desiredObj)\n dependencies = {}\n if desiredObj.spec.serviceAccountName ~= nil and desiredObj.spec.serviceAccountName ~= \"default\" then\n dependency = {}\n dependency.apiVersion = \"v1\"\n dependency.kind = \"ServiceAccount\"\n dependency.name = desiredObj.spec.serviceAccountName\n dependency.namespace = desiredObj.namespace\n dependencies[1] = {}\n dependencies[1] = dependency\n end\n return dependencies\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe returned value should be expressed by a slice of DependentObjectReference.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1879,7 +1879,7 @@ func schema_pkg_apis_config_v1alpha1_HealthInterpretation(ref common.ReferenceCa
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "LuaScript holds the Lua script that is used to assess the health state of a specific resource. The script should implement a function as follows:\n luaScript: >\n function InterpretHealth(observedObj)\n if observedObj.status.readyReplicas == observedObj.spec.replicas then\n return true\n end\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned boolean value indicates the health status.",
|
Description: "LuaScript holds the Lua script that is used to assess the health state of a specific resource. The script should implement a function as follows:\n\n```\n luaScript: >\n function InterpretHealth(observedObj)\n if observedObj.status.readyReplicas == observedObj.spec.replicas then\n return true\n end\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned boolean value indicates the health status.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1901,7 +1901,7 @@ func schema_pkg_apis_config_v1alpha1_LocalValueRetention(ref common.ReferenceCal
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "LuaScript holds the Lua script that is used to retain runtime values to the desired specification.\n\nThe script should implement a function as follows:\n luaScript: >\n function Retain(desiredObj, observedObj)\n desiredObj.spec.fieldFoo = observedObj.spec.fieldFoo\n return desiredObj\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned object should be a retained configuration which will be applied to member cluster eventually.",
|
Description: "LuaScript holds the Lua script that is used to retain runtime values to the desired specification.\n\nThe script should implement a function as follows:\n\n```\n luaScript: >\n function Retain(desiredObj, observedObj)\n desiredObj.spec.fieldFoo = observedObj.spec.fieldFoo\n return desiredObj\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned object should be a retained configuration which will be applied to member cluster eventually.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1923,7 +1923,7 @@ func schema_pkg_apis_config_v1alpha1_ReplicaResourceRequirement(ref common.Refer
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "LuaScript holds the Lua script that is used to discover the resource's replica as well as resource requirements\n\nThe script should implement a function as follows:\n luaScript: >\n function GetReplicas(desiredObj)\n replica = desiredObj.spec.replicas\n requirement = {}\n requirement.nodeClaim = {}\n requirement.nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector\n requirement.nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations\n requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits\n return replica, requirement\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe function expects two return values:\n - replica: the declared replica number\n - requirement: the resource required by each replica expressed with a\n ResourceBindingSpec.ReplicaRequirements.\nThe returned values will be set into a ResourceBinding or ClusterResourceBinding.",
|
Description: "LuaScript holds the Lua script that is used to discover the resource's replica as well as resource requirements\n\nThe script should implement a function as follows:\n\n```\n luaScript: >\n function GetReplicas(desiredObj)\n replica = desiredObj.spec.replicas\n requirement = {}\n requirement.nodeClaim = {}\n requirement.nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector\n requirement.nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations\n requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits\n return replica, requirement\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n\nThe function expects two return values:\n - replica: the declared replica number\n - requirement: the resource required by each replica expressed with a\n ResourceBindingSpec.ReplicaRequirements.\nThe returned values will be set into a ResourceBinding or ClusterResourceBinding.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1945,7 +1945,7 @@ func schema_pkg_apis_config_v1alpha1_ReplicaRevision(ref common.ReferenceCallbac
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "LuaScript holds the Lua script that is used to revise replicas in the desired specification. The script should implement a function as follows:\n luaScript: >\n function ReviseReplica(desiredObj, desiredReplica)\n desiredObj.spec.replicas = desiredReplica\n return desiredObj\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - desiredReplica: the replica number should be applied with.\n\nThe returned object should be a revised configuration which will be applied to member cluster eventually.",
|
Description: "LuaScript holds the Lua script that is used to revise replicas in the desired specification. The script should implement a function as follows:\n\n```\n luaScript: >\n function ReviseReplica(desiredObj, desiredReplica)\n desiredObj.spec.replicas = desiredReplica\n return desiredObj\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents the configuration to be applied\n to the member cluster.\n - desiredReplica: the replica number should be applied with.\n\nThe returned object should be a revised configuration which will be applied to member cluster eventually.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -2637,7 +2637,7 @@ func schema_pkg_apis_config_v1alpha1_StatusAggregation(ref common.ReferenceCallb
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "LuaScript holds the Lua script that is used to aggregate decentralized statuses to the desired specification. The script should implement a function as follows:\n luaScript: >\n function AggregateStatus(desiredObj, statusItems)\n for i = 1, #statusItems do\n desiredObj.status.readyReplicas = desiredObj.status.readyReplicas + items[i].readyReplicas\n end\n return desiredObj\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents a resource template.\n - statusItems: the slice of status expressed with AggregatedStatusItem.\n\nThe returned object should be a whole object with status aggregated.",
|
Description: "LuaScript holds the Lua script that is used to aggregate decentralized statuses to the desired specification. The script should implement a function as follows:\n\n```\n luaScript: >\n function AggregateStatus(desiredObj, statusItems)\n for i = 1, #statusItems do\n desiredObj.status.readyReplicas = desiredObj.status.readyReplicas + items[i].readyReplicas\n end\n return desiredObj\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - desiredObj: the object represents a resource template.\n - statusItems: the slice of status expressed with AggregatedStatusItem.\n\nThe returned object should be a whole object with status aggregated.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -2659,7 +2659,7 @@ func schema_pkg_apis_config_v1alpha1_StatusReflection(ref common.ReferenceCallba
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"luaScript": {
|
"luaScript": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "LuaScript holds the Lua script that is used to get the status from the observed specification. The script should implement a function as follows:\n luaScript: >\n function ReflectStatus(observedObj)\n status = {}\n status.readyReplicas = observedObj.status.observedObj\n return status\n end\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned status could be the whole status or part of it and will be set into both Work and ResourceBinding(ClusterResourceBinding).",
|
Description: "LuaScript holds the Lua script that is used to get the status from the observed specification. The script should implement a function as follows:\n\n```\n luaScript: >\n function ReflectStatus(observedObj)\n status = {}\n status.readyReplicas = observedObj.status.observedObj\n return status\n end\n```\n\nThe content of the LuaScript needs to be a whole function including both declaration and implementation.\n\nThe parameters will be supplied by the system:\n - observedObj: the object represents the configuration that is observed\n from a specific member cluster.\n\nThe returned status could be the whole status or part of it and will be set into both Work and ResourceBinding(ClusterResourceBinding).",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
|
Loading…
Reference in New Issue