Skip to content

Commit 0e6aa32

Browse files
committed
add: adjustments from feeback
1 parent 2bee4cd commit 0e6aa32

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

pkg/controller/queuejob/queuejob_controller_ex.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ func (qjm *XController) getAppWrapperCompletionStatus(caw *arbv1.AppWrapper) arb
583583
objectName := genericItem.GenericTemplate
584584
unstruct, err := genericresource.UnmarshalToUnstructured(objectName.Raw)
585585
if err != nil {
586-
klog.Errorf("[getAppWrapperCompletionStatus] Error: %v", err)
586+
klog.Errorf("[getAppWrapperCompletionStatus] Error unmarshalling appwrapper: %v", caw.Name)
587587
}
588588
name := ""
589589
if md, ok := unstruct.Object["metadata"]; ok {

pkg/controller/queuejobresources/genericresource/genericresource.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ func (gr *GenericResources) Cleanup(aw *arbv1.AppWrapper, awr *arbv1.AppWrapperG
6969
}
7070
// Default generic resource name
7171
name := ""
72-
7372
namespaced := true
74-
// todo:DELETEME dd := common.KubeClient.Discovery()
75-
dd := gr.clients.Discovery()
7673

74+
dd := gr.clients.Discovery()
7775
ext := awr.GenericTemplate
7876
gvk, mapping, err := getResourceMapping(dd, ext.Raw, default_gvk)
7977
if err != nil {
@@ -157,7 +155,7 @@ func (gr *GenericResources) SyncQueueJob(aw *arbv1.AppWrapper, awr *arbv1.AppWra
157155

158156
namespaced := true
159157
name := ""
160-
// todo:DELETEME dd := common.KubeClient.Discovery()
158+
161159
dd := gr.clients.Discovery()
162160
ext := awr.GenericTemplate
163161
_, mapping, err := getResourceMapping(dd, ext.Raw, nil)

pkg/controller/queuejobresources/genericresource/helper.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func getResourceMapping(dd discovery.DiscoveryInterface, raw []byte, defaultGVK
123123
}
124124

125125

126-
// checks if object has replicas and containers field
126+
// hasFields checks if obj has replicas and containers field
127127
func hasFields(obj runtime.RawExtension) (hasFields bool, replica float64, containers []v1.Container) {
128128
unstruct, err := UnmarshalToUnstructured(obj.Raw)
129129
if err != nil {
@@ -166,7 +166,7 @@ func hasFields(obj runtime.RawExtension) (hasFields bool, replica float64, conta
166166
return isFound, replicas, objContainers
167167
}
168168

169-
// checks if object has pod template spec and add new labels
169+
// addLabelsToPodTemplateField checks if unstruct has pod template spec and add new labels
170170
func addLabelsToPodTemplateField(unstruct *unstructured.Unstructured, labels map[string]string) (hasFields bool) {
171171
spec, isFound, _ := unstructured.NestedMap(unstruct.UnstructuredContent(), "spec")
172172
if !isFound {

pkg/controller/queuejobresources/genericresource/utils.go

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package genericresource
22

33
import (
44
"encoding/json"
5-
"k8s.io/klog/v2"
65

76
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
87
)
@@ -12,7 +11,6 @@ func UnmarshalToUnstructured(raw []byte) (unstruct unstructured.Unstructured, er
1211
var blob interface{}
1312
err = json.Unmarshal(raw, &blob)
1413
if err != nil {
15-
klog.Errorf("Error unmarshalling, err=%#v", err)
1614
return unstruct, err
1715
}
1816
unstruct.Object = blob.(map[string]interface{})

0 commit comments

Comments
 (0)