Merge pull request #2869 from RainbowMango/pr_update_interpreter_api
Update ResourceInterpreterCustomization comments according to implementation
This commit is contained in:
commit
1545f16454
|
@ -56,11 +56,13 @@ spec:
|
||||||
~= \"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[0] = {} dependencies[0]
|
= desiredObj.namespace dependencies[1] = {} dependencies[1]
|
||||||
= dependency end return dependencies end \n LuaScript only
|
= dependency end return dependencies end \n The content
|
||||||
holds the function body part, take the `desiredObj` as the
|
of the LuaScript needs to be a whole function including
|
||||||
function parameters or global variables, and finally returns
|
both declaration and implementation. \n The parameters will
|
||||||
the dependent resources."
|
be supplied by the system: - desiredObj: the object represents
|
||||||
|
the configuration to be applied to the member cluster. \n
|
||||||
|
The returned value should be expressed by a slice of DependentObjectReference."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
@ -76,9 +78,12 @@ spec:
|
||||||
should implement a function as follows: luaScript: > function
|
should implement a function as follows: luaScript: > function
|
||||||
InterpretHealth(observedObj) if observedObj.status.readyReplicas
|
InterpretHealth(observedObj) if observedObj.status.readyReplicas
|
||||||
== observedObj.spec.replicas then return true end end \n
|
== observedObj.spec.replicas then return true end end \n
|
||||||
LuaScript only holds the function body part, take the `observedObj`
|
The content of the LuaScript needs to be a whole function
|
||||||
as the function parameters or global variables, and finally
|
including both declaration and implementation. \n The parameters
|
||||||
returns the boolean health state."
|
will be supplied by the system: - observedObj: the object
|
||||||
|
represents the configuration that is observed from a specific
|
||||||
|
member cluster. \n The returned boolean value indicates
|
||||||
|
the health status."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
@ -95,16 +100,21 @@ 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
|
||||||
The script should implement a function as follows: luaScript:
|
\n The script should implement a function as follows: luaScript:
|
||||||
> function GetReplicas(desiredObj) nodeClaim = {} resourceRequest
|
> function GetReplicas(desiredObj) replica = desiredObj.spec.replicas
|
||||||
= {} result = {} \n result.replica = desiredObj.spec.replicas
|
requirement = {} requirement.nodeClaim = {} requirement.nodeClaim.nodeSelector
|
||||||
result.resourceRequest = desiredObj.spec.template.spec.containers[0].resources.limits
|
= desiredObj.spec.template.spec.nodeSelector requirement.nodeClaim.tolerations
|
||||||
\n nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector
|
= desiredObj.spec.template.spec.tolerations requirement.resourceRequest
|
||||||
nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations
|
= desiredObj.spec.template.spec.containers[1].resources.limits
|
||||||
result.nodeClaim = nodeClaim \n return result end \n LuaScript
|
return replica, requirement end \n The content of the LuaScript
|
||||||
only holds the function body part, take the `desiredObj`
|
needs to be a whole function including both declaration
|
||||||
as the function parameters or global variable, and finally
|
and implementation. \n The parameters will be supplied by
|
||||||
returns the replica number and required resources."
|
the system: - desiredObj: the object represents the configuration
|
||||||
|
to be applied to the member cluster. \n The function expects
|
||||||
|
two return values: - replica: the declared replica number
|
||||||
|
- requirement: the resource required by each replica expressed
|
||||||
|
with a ResourceBindingSpec.ReplicaRequirements. The returned
|
||||||
|
values will be set into a ResourceBinding or ClusterResourceBinding."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
@ -122,10 +132,14 @@ spec:
|
||||||
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: luaScript: > function
|
||||||
ReviseReplica(desiredObj, desiredReplica) desiredObj.spec.replicas
|
ReviseReplica(desiredObj, desiredReplica) desiredObj.spec.replicas
|
||||||
= desiredReplica return desiredObj end \n LuaScript only
|
= desiredReplica return desiredObj end \n The content of
|
||||||
holds the function body part, take the `desiredObj` and
|
the LuaScript needs to be a whole function including both
|
||||||
`desiredReplica` as the function parameters or global variables,
|
declaration and implementation. \n The parameters will be
|
||||||
and finally returns a revised specification."
|
supplied by the system: - desiredObj: the object represents
|
||||||
|
the configuration to be applied to the member cluster. -
|
||||||
|
desiredReplica: the replica number should be applied with.
|
||||||
|
\n The returned object should be a revised configuration
|
||||||
|
which will be applied to member cluster eventually."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
@ -142,13 +156,18 @@ spec:
|
||||||
properties:
|
properties:
|
||||||
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. The
|
to retain runtime values to the desired specification. \n
|
||||||
script should implement a function as follows: luaScript:
|
The script should implement a function as follows: luaScript:
|
||||||
> function Retain(desiredObj, observedObj) desiredObj.spec.fieldFoo
|
> function Retain(desiredObj, observedObj) desiredObj.spec.fieldFoo
|
||||||
= observedObj.spec.fieldFoo return desiredObj end \n LuaScript
|
= observedObj.spec.fieldFoo return desiredObj end \n The
|
||||||
only holds the function body part, take the `desiredObj`
|
content of the LuaScript needs to be a whole function including
|
||||||
and `observedObj` as the function parameters or global variables,
|
both declaration and implementation. \n The parameters will
|
||||||
and finally returns a retained specification."
|
be supplied by the system: - desiredObj: the object represents
|
||||||
|
the configuration to be applied to the member cluster. -
|
||||||
|
observedObj: the object represents the configuration that
|
||||||
|
is observed from a specific member cluster. \n The returned
|
||||||
|
object should be a retained configuration which will be
|
||||||
|
applied to member cluster eventually."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
@ -165,11 +184,15 @@ spec:
|
||||||
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: luaScript:
|
||||||
> function AggregateStatus(desiredObj, statusItems) for
|
> function AggregateStatus(desiredObj, statusItems) for
|
||||||
i = 1, #items do desiredObj.status.readyReplicas = desiredObj.status.readyReplicas
|
i = 1, #statusItems do desiredObj.status.readyReplicas =
|
||||||
+ items[i].readyReplicas end return desiredObj end \n LuaScript
|
desiredObj.status.readyReplicas + items[i].readyReplicas
|
||||||
only holds the function body part, take the `desiredObj`
|
end return desiredObj end \n The content of the LuaScript
|
||||||
and `statusItems` as the function parameters or global variables,
|
needs to be a whole function including both declaration
|
||||||
and finally returns the desiredObj."
|
and implementation. \n The parameters will be supplied by
|
||||||
|
the system: - desiredObj: the object represents a resource
|
||||||
|
template. - statusItems: the slice of status expressed with
|
||||||
|
AggregatedStatusItem. \n The returned object should be a
|
||||||
|
whole object with status aggregated."
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
@ -185,10 +208,13 @@ spec:
|
||||||
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: luaScript: > function
|
||||||
ReflectStatus(observedObj) status = {} status.readyReplicas
|
ReflectStatus(observedObj) status = {} status.readyReplicas
|
||||||
= observedObj.status.observedObj return status end \n LuaScript
|
= observedObj.status.observedObj return status end \n The
|
||||||
only holds the function body part, take the `observedObj`
|
content of the LuaScript needs to be a whole function including
|
||||||
as the function parameters or global variables, and finally
|
both declaration and implementation. \n The parameters will
|
||||||
returns the status."
|
be supplied by the system: - observedObj: the object represents
|
||||||
|
the configuration that is observed from a specific member
|
||||||
|
cluster. \n The 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
|
||||||
required:
|
required:
|
||||||
- luaScript
|
- luaScript
|
||||||
|
|
|
@ -108,7 +108,9 @@ type CustomizationRules struct {
|
||||||
// LocalValueRetention holds the scripts for retention.
|
// LocalValueRetention holds the scripts for retention.
|
||||||
// Now only supports Lua.
|
// Now only supports Lua.
|
||||||
type LocalValueRetention struct {
|
type LocalValueRetention struct {
|
||||||
// LuaScript holds the Lua script that is used to retain runtime values to the desired specification.
|
// LuaScript holds the Lua script that is used to retain runtime values
|
||||||
|
// 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)
|
||||||
|
@ -116,8 +118,17 @@ type LocalValueRetention struct {
|
||||||
// return desiredObj
|
// return desiredObj
|
||||||
// end
|
// end
|
||||||
//
|
//
|
||||||
// LuaScript only holds the function body part, take the `desiredObj` and `observedObj` as the function
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// parameters or global variables, and finally returns a retained specification.
|
// declaration and implementation.
|
||||||
|
//
|
||||||
|
// The parameters will be supplied by the system:
|
||||||
|
// - desiredObj: the object represents the configuration to be applied
|
||||||
|
// to the member cluster.
|
||||||
|
// - observedObj: the object represents the configuration that is observed
|
||||||
|
// from a specific member cluster.
|
||||||
|
//
|
||||||
|
// The returned object should be a retained configuration which will be
|
||||||
|
// applied to member cluster eventually.
|
||||||
// +required
|
// +required
|
||||||
LuaScript string `json:"luaScript"`
|
LuaScript string `json:"luaScript"`
|
||||||
}
|
}
|
||||||
|
@ -127,25 +138,31 @@ type LocalValueRetention struct {
|
||||||
type ReplicaResourceRequirement struct {
|
type ReplicaResourceRequirement struct {
|
||||||
// LuaScript holds the Lua script that is used to discover the resource's
|
// LuaScript holds the Lua script that is used to discover the resource's
|
||||||
// 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)
|
||||||
// nodeClaim = {}
|
// replica = desiredObj.spec.replicas
|
||||||
// resourceRequest = {}
|
// requirement = {}
|
||||||
// result = {}
|
// requirement.nodeClaim = {}
|
||||||
//
|
// requirement.nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector
|
||||||
// result.replica = desiredObj.spec.replicas
|
// requirement.nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations
|
||||||
// result.resourceRequest = desiredObj.spec.template.spec.containers[0].resources.limits
|
// requirement.resourceRequest = desiredObj.spec.template.spec.containers[1].resources.limits
|
||||||
//
|
// return replica, requirement
|
||||||
// nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector
|
|
||||||
// nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations
|
|
||||||
// result.nodeClaim = nodeClaim
|
|
||||||
//
|
|
||||||
// return result
|
|
||||||
// end
|
// end
|
||||||
//
|
//
|
||||||
// LuaScript only holds the function body part, take the `desiredObj` as the function
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// parameters or global variable, and finally returns the replica number and required resources.
|
// declaration and implementation.
|
||||||
|
//
|
||||||
|
// The parameters will be supplied by the system:
|
||||||
|
// - desiredObj: the object represents the configuration to be applied
|
||||||
|
// to the member cluster.
|
||||||
|
//
|
||||||
|
// The function expects two return values:
|
||||||
|
// - replica: the declared replica number
|
||||||
|
// - requirement: the resource required by each replica expressed with a
|
||||||
|
// ResourceBindingSpec.ReplicaRequirements.
|
||||||
|
// The returned values will be set into a ResourceBinding or ClusterResourceBinding.
|
||||||
// +required
|
// +required
|
||||||
LuaScript string `json:"luaScript"`
|
LuaScript string `json:"luaScript"`
|
||||||
}
|
}
|
||||||
|
@ -160,8 +177,16 @@ type ReplicaRevision struct {
|
||||||
// return desiredObj
|
// return desiredObj
|
||||||
// end
|
// end
|
||||||
//
|
//
|
||||||
// LuaScript only holds the function body part, take the `desiredObj` and `desiredReplica` as the function
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// parameters or global variables, and finally returns a revised specification.
|
// declaration and implementation.
|
||||||
|
//
|
||||||
|
// The parameters will be supplied by the system:
|
||||||
|
// - desiredObj: the object represents the configuration to be applied
|
||||||
|
// to the member cluster.
|
||||||
|
// - desiredReplica: the replica number should be applied with.
|
||||||
|
//
|
||||||
|
// The returned object should be a revised configuration which will be
|
||||||
|
// applied to member cluster eventually.
|
||||||
// +required
|
// +required
|
||||||
LuaScript string `json:"luaScript"`
|
LuaScript string `json:"luaScript"`
|
||||||
}
|
}
|
||||||
|
@ -177,8 +202,15 @@ type StatusReflection struct {
|
||||||
// return status
|
// return status
|
||||||
// end
|
// end
|
||||||
//
|
//
|
||||||
// LuaScript only holds the function body part, take the `observedObj` as the function
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// parameters or global variables, and finally returns the status.
|
// declaration and implementation.
|
||||||
|
//
|
||||||
|
// The parameters will be supplied by the system:
|
||||||
|
// - observedObj: the object represents the configuration that is observed
|
||||||
|
// from a specific member cluster.
|
||||||
|
//
|
||||||
|
// The returned status could be the whole status or part of it and will
|
||||||
|
// be set into both Work and ResourceBinding(ClusterResourceBinding).
|
||||||
// +required
|
// +required
|
||||||
LuaScript string `json:"luaScript"`
|
LuaScript string `json:"luaScript"`
|
||||||
}
|
}
|
||||||
|
@ -190,14 +222,21 @@ type StatusAggregation struct {
|
||||||
// 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, #items do
|
// for i = 1, #statusItems do
|
||||||
// desiredObj.status.readyReplicas = desiredObj.status.readyReplicas + items[i].readyReplicas
|
// desiredObj.status.readyReplicas = desiredObj.status.readyReplicas + items[i].readyReplicas
|
||||||
// end
|
// end
|
||||||
// return desiredObj
|
// return desiredObj
|
||||||
// end
|
// end
|
||||||
//
|
//
|
||||||
// LuaScript only holds the function body part, take the `desiredObj` and `statusItems` as the function
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// parameters or global variables, and finally returns the desiredObj.
|
// declaration and implementation.
|
||||||
|
//
|
||||||
|
// The parameters will be supplied by the system:
|
||||||
|
// - desiredObj: the object represents a resource template.
|
||||||
|
// - statusItems: the slice of status expressed with AggregatedStatusItem.
|
||||||
|
//
|
||||||
|
// The returned object should be a whole object with status aggregated.
|
||||||
|
//
|
||||||
// +required
|
// +required
|
||||||
LuaScript string `json:"luaScript"`
|
LuaScript string `json:"luaScript"`
|
||||||
}
|
}
|
||||||
|
@ -214,8 +253,15 @@ type HealthInterpretation struct {
|
||||||
// end
|
// end
|
||||||
// end
|
// end
|
||||||
//
|
//
|
||||||
// LuaScript only holds the function body part, take the `observedObj` as the function
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// parameters or global variables, and finally returns the boolean health state.
|
// declaration and implementation.
|
||||||
|
//
|
||||||
|
// The parameters will be supplied by the system:
|
||||||
|
// - observedObj: the object represents the configuration that is observed
|
||||||
|
// from a specific member cluster.
|
||||||
|
//
|
||||||
|
// The returned boolean value indicates the health status.
|
||||||
|
//
|
||||||
// +required
|
// +required
|
||||||
LuaScript string `json:"luaScript"`
|
LuaScript string `json:"luaScript"`
|
||||||
}
|
}
|
||||||
|
@ -235,14 +281,20 @@ type DependencyInterpretation struct {
|
||||||
// dependency.kind = "ServiceAccount"
|
// dependency.kind = "ServiceAccount"
|
||||||
// dependency.name = desiredObj.spec.serviceAccountName
|
// dependency.name = desiredObj.spec.serviceAccountName
|
||||||
// dependency.namespace = desiredObj.namespace
|
// dependency.namespace = desiredObj.namespace
|
||||||
// dependencies[0] = {}
|
// dependencies[1] = {}
|
||||||
// dependencies[0] = dependency
|
// dependencies[1] = dependency
|
||||||
// end
|
// end
|
||||||
// return dependencies
|
// return dependencies
|
||||||
// end
|
// end
|
||||||
//
|
//
|
||||||
// LuaScript only holds the function body part, take the `desiredObj` as the function
|
// The content of the LuaScript needs to be a whole function including both
|
||||||
// parameters or global variables, and finally returns the dependent resources.
|
// declaration and implementation.
|
||||||
|
//
|
||||||
|
// The parameters will be supplied by the system:
|
||||||
|
// - desiredObj: the object represents the configuration to be applied
|
||||||
|
// to the member cluster.
|
||||||
|
//
|
||||||
|
// The returned value should be expressed by a slice of DependentObjectReference.
|
||||||
// +required
|
// +required
|
||||||
LuaScript string `json:"luaScript"`
|
LuaScript string `json:"luaScript"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1177,7 +1177,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 ~= \"\" 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[0] = {}\n dependencies[0] = dependency\n end\n return dependencies\n end\n\nLuaScript only holds the function body part, take the `desiredObj` as the function parameters or global variables, and finally returns the dependent resources.",
|
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 ~= \"\" 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.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1244,7 +1244,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\nLuaScript only holds the function body part, take the `observedObj` as the function parameters or global variables, and finally returns the boolean health state.",
|
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.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1266,7 +1266,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. The 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\nLuaScript only holds the function body part, take the `desiredObj` and `observedObj` as the function parameters or global variables, and finally returns a retained specification.",
|
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.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1288,7 +1288,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 The script should implement a function as follows:\n luaScript: >\n function GetReplicas(desiredObj)\n nodeClaim = {}\n resourceRequest = {}\n result = {}\n\n result.replica = desiredObj.spec.replicas\n result.resourceRequest = desiredObj.spec.template.spec.containers[0].resources.limits\n\n nodeClaim.nodeSelector = desiredObj.spec.template.spec.nodeSelector\n nodeClaim.tolerations = desiredObj.spec.template.spec.tolerations\n result.nodeClaim = nodeClaim\n\n return result\n end\n\nLuaScript only holds the function body part, take the `desiredObj` as the function parameters or global variable, and finally returns the replica number and required resources.",
|
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.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -1310,7 +1310,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\nLuaScript only holds the function body part, take the `desiredObj` and `desiredReplica` as the function parameters or global variables, and finally returns a revised specification.",
|
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.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -2002,7 +2002,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, #items do\n desiredObj.status.readyReplicas = desiredObj.status.readyReplicas + items[i].readyReplicas\n end\n return desiredObj\n end\n\nLuaScript only holds the function body part, take the `desiredObj` and `statusItems` as the function parameters or global variables, and finally returns the desiredObj.",
|
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.",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
@ -2024,7 +2024,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\nLuaScript only holds the function body part, take the `observedObj` as the function parameters or global variables, and finally returns the status.",
|
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).",
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
Format: "",
|
Format: "",
|
||||||
|
|
Loading…
Reference in New Issue