@@ -56,6 +56,8 @@ func (p *ConfigurableInterpreter) HookEnabled(kind schema.GroupVersionKind, oper
56
56
script = customAccessor .GetHealthInterpretationLuaScript ()
57
57
case configv1alpha1 .InterpreterOperationInterpretReplica :
58
58
script = customAccessor .GetReplicaResourceLuaScript ()
59
+ case configv1alpha1 .InterpreterOperationInterpretComponent :
60
+ script = customAccessor .GetComponentResourceLuaScript ()
59
61
case configv1alpha1 .InterpreterOperationInterpretStatus :
60
62
script = customAccessor .GetStatusReflectionLuaScript ()
61
63
case configv1alpha1 .InterpreterOperationRetain :
@@ -85,6 +87,25 @@ func (p *ConfigurableInterpreter) GetReplicas(object *unstructured.Unstructured)
85
87
return
86
88
}
87
89
90
+ // GetComponents returns the desired components of the object.
91
+ func (p * ConfigurableInterpreter ) GetComponents (object * unstructured.Unstructured ) (components []workv1alpha2.ComponentRequirements , enabled bool , err error ) {
92
+ klog .V (4 ).Infof ("Get components for object: %v %s/%s with thirdparty configurable interpreter." , object .GroupVersionKind (), object .GetNamespace (), object .GetName ())
93
+
94
+ customAccessor , enabled := p .getCustomAccessor (object .GroupVersionKind ())
95
+ if ! enabled {
96
+ return
97
+ }
98
+
99
+ script := customAccessor .GetComponentResourceLuaScript ()
100
+ if len (script ) == 0 {
101
+ enabled = false
102
+ return
103
+ }
104
+
105
+ components , err = p .luaVM .GetComponents (object , script )
106
+ return
107
+ }
108
+
88
109
// ReviseReplica revises the replica of the given object.
89
110
func (p * ConfigurableInterpreter ) ReviseReplica (object * unstructured.Unstructured , replica int64 ) (revised * unstructured.Unstructured , enabled bool , err error ) {
90
111
klog .V (4 ).Infof ("Revise replicas for object: %v %s/%s with thirdparty configurable interpreter." , object .GroupVersionKind (), object .GetNamespace (), object .GetName ())
0 commit comments