mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
Fix: fix up command add debug policy (#3770)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
+13
-4
@@ -175,10 +175,7 @@ func (opt *UpCommandOptions) deployExistingApp(f velacmd.Factory, cmd *cobra.Com
|
||||
}
|
||||
oam.SetPublishVersion(app, opt.PublishVersion)
|
||||
if opt.Debug {
|
||||
app.Spec.Policies = append(app.Spec.Policies, v1beta1.AppPolicy{
|
||||
Name: "debug",
|
||||
Type: "debug",
|
||||
})
|
||||
addDebugPolicy(app)
|
||||
}
|
||||
return cli.Update(ctx, app)
|
||||
}); err != nil {
|
||||
@@ -188,6 +185,18 @@ func (opt *UpCommandOptions) deployExistingApp(f velacmd.Factory, cmd *cobra.Com
|
||||
return nil
|
||||
}
|
||||
|
||||
func addDebugPolicy(app *v1beta1.Application) {
|
||||
for _, policy := range app.Spec.Policies {
|
||||
if policy.Type == "debug" {
|
||||
return
|
||||
}
|
||||
}
|
||||
app.Spec.Policies = append(app.Spec.Policies, v1beta1.AppPolicy{
|
||||
Name: "debug",
|
||||
Type: "debug",
|
||||
})
|
||||
}
|
||||
|
||||
func (opt *UpCommandOptions) deployApplicationFromFile(f velacmd.Factory, cmd *cobra.Command) error {
|
||||
cli := f.Client()
|
||||
body, err := common.ReadRemoteOrLocalPath(opt.File)
|
||||
|
||||
Reference in New Issue
Block a user