cloud表namespace取nsID的值

Signed-off-by: devad <cossjie@foxmail.com>
This commit is contained in:
devad 2023-12-18 11:49:21 +08:00
parent 3b2f0899e9
commit 33a134e92f
1 changed files with 3 additions and 1 deletions

View File

@ -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
}