mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
Feat: apply-component supports namespace (#6228)
* Feat: apply-component supports namespace Signed-off-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com> * Feat: apply-component supports namespace Signed-off-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com> --------- Signed-off-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com>
This commit is contained in:
@@ -252,6 +252,7 @@ func convertStepProperties(step *workflowv1alpha1.WorkflowStep, app *v1beta1.App
|
||||
o := struct {
|
||||
Component string `json:"component"`
|
||||
Cluster string `json:"cluster"`
|
||||
Namespace string `json:"namespace"`
|
||||
}{}
|
||||
js, err := common.RawExtensionPointer{RawExtension: step.Properties}.MarshalJSON()
|
||||
if err != nil {
|
||||
@@ -260,6 +261,9 @@ func convertStepProperties(step *workflowv1alpha1.WorkflowStep, app *v1beta1.App
|
||||
if err := json.Unmarshal(js, &o); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(o.Namespace) == 0 {
|
||||
o.Namespace = app.Namespace
|
||||
}
|
||||
|
||||
var componentNames []string
|
||||
for _, c := range app.Spec.Components {
|
||||
@@ -288,8 +292,9 @@ func convertStepProperties(step *workflowv1alpha1.WorkflowStep, app *v1beta1.App
|
||||
c.Outputs = nil
|
||||
c.DependsOn = nil
|
||||
stepProperties := map[string]interface{}{
|
||||
"value": c,
|
||||
"cluster": o.Cluster,
|
||||
"value": c,
|
||||
"cluster": o.Cluster,
|
||||
"namespace": o.Namespace,
|
||||
}
|
||||
step.Properties = util.Object2RawExtension(stepProperties)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user