Skip to content

Commit

Permalink
refactor: generic resources
Browse files Browse the repository at this point in the history
  • Loading branch information
VanillaSpoon committed Nov 7, 2023
1 parent 280e750 commit 9615f65
Show file tree
Hide file tree
Showing 4 changed files with 329 additions and 379 deletions.
10 changes: 3 additions & 7 deletions pkg/controller/queuejob/queuejob_controller_ex.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -583,13 +582,10 @@ func (qjm *XController) getAppWrapperCompletionStatus(caw *arbv1.AppWrapper) arb
for i, genericItem := range caw.Spec.AggrResources.GenericItems {
if len(genericItem.CompletionStatus) > 0 {
objectName := genericItem.GenericTemplate
var unstruct unstructured.Unstructured
unstruct.Object = make(map[string]interface{})
var blob interface{}
if err := jsons.Unmarshal(objectName.Raw, &blob); err != nil {
klog.Errorf("[getAppWrapperCompletionStatus] Error unmarshalling, err=%#v", err)
unstruct, err := genericresource.UnmarshalToUnstructured(objectName.Raw)
if err != nil {
klog.Errorf("[getAppWrapperCompletionStatus] Error: %v", err)
}
unstruct.Object = blob.(map[string]interface{}) // set object to the content of the blob after Unmarshalling
name := ""
if md, ok := unstruct.Object["metadata"]; ok {
metadata := md.(map[string]interface{})
Expand Down
Loading

0 comments on commit 9615f65

Please sign in to comment.