cloud表namespace取nsID的值
Signed-off-by: devad <cossjie@foxmail.com>
This commit is contained in:
parent
3b2f0899e9
commit
33a134e92f
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue