File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,19 @@ class NodeWorkloadLock(LockBase):
213213 kind = "NodeWorkloadLock"
214214 kopf_on_args = * version .split ("/" ), endpoint
215215
216+ @classmethod
217+ def get_normalized_node (cls , node_obj ):
218+ node = {
219+ "apiVersion" : node_obj ["apiVersion" ],
220+ "kind" : node_obj ["kind" ],
221+ "spec" : node_obj ["spec" ],
222+ "metadata" : {
223+ "name" : node_obj ["metadata" ]["name" ],
224+ "labels" : node_obj ["metadata" ].get ("labels" , []),
225+ },
226+ }
227+ return node
228+
216229 @classmethod
217230 def dummy (cls , name ):
218231 node_name = "-" .join (name .split ("-" )[1 :])
@@ -221,10 +234,13 @@ def dummy(cls, name):
221234 dummy ["spec" ]["nodeDeletionRequestSupported" ] = True
222235 node = kube .safe_get_node (node_name )
223236 if node .exists ():
224- node = node .obj
225- node .pop ("status" , None )
237+ normalized_node = cls .get_normalized_node (node .obj )
226238 dummy ["metadata" ]["annotations" ].update (
227- {"openstack.lcm.mirantis.com/original-node" : json .dumps (node )}
239+ {
240+ "openstack.lcm.mirantis.com/original-node" : json .dumps (
241+ normalized_node
242+ )
243+ }
228244 )
229245 return dummy
230246
You can’t perform that action at this time.
0 commit comments