diff --git a/pkg/scheduler/cloudScheduler.go b/pkg/scheduler/cloudScheduler.go index 915a66df..e2e17fc3 100644 --- a/pkg/scheduler/cloudScheduler.go +++ b/pkg/scheduler/cloudScheduler.go @@ -49,7 +49,6 @@ func (cs *cloudScheduler) pickOptimalStrategy(task *algo.Task, providers ...*alg func (cs *cloudScheduler) getNewStructForDb(task *response.TaskInfo, resource string, participantId int64) (interface{}, error) { cloud := cs.UnMarshalK8sStruct(resource, task.TaskId, task.NsID) cloud.Id = utils.GenSnowflakeID() - cloud.YamlString = resource cloud.NsID = task.NsID cloud.ParticipantId = participantId @@ -93,6 +92,9 @@ func (cs *cloudScheduler) UnMarshalK8sStruct(yamlString string, taskId int64, ns if len(unstructureObj.GetNamespace()) == 0 { cloud.Namespace = "default" } + //unstructureObj转成string + unString, _ := unstructureObj.MarshalJSON() + cloud.YamlString = string(unString) } return cloud }