From 107d5ccc6e7d929ee6f302374fb76773adc25345 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Wed, 26 Mar 2025 17:38:51 +0100 Subject: [PATCH 1/2] Add context command initialization in restart command Signed-off-by: Javier Lopez --- cmd/restart.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/restart.go b/cmd/restart.go index d93b02f66880..bdfe5b8eb88f 100644 --- a/cmd/restart.go +++ b/cmd/restart.go @@ -57,6 +57,10 @@ func Restart(fs afero.Fs) *cobra.Command { return err } + if err := contextCMD.NewContextCommand().Run(ctx, &contextCMD.Options{Show: true, Namespace: namespace, Context: k8sContext}); err != nil { + return err + } + if !okteto.IsOkteto() { if err := manifest.ValidateForCLIOnly(); err != nil { return err From 3d0e246a4b57696e6b9e1b05074f82fa5e29f5b4 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Thu, 27 Mar 2025 14:17:16 +0100 Subject: [PATCH 2/2] Set default namespace from context if not provided in restart command Signed-off-by: Javier Lopez --- cmd/restart.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/restart.go b/cmd/restart.go index bdfe5b8eb88f..02b545b0b9f1 100644 --- a/cmd/restart.go +++ b/cmd/restart.go @@ -86,6 +86,9 @@ func Restart(fs afero.Fs) *cobra.Command { if len(dev.Services) == 0 { return oktetoErrors.ErrNoServicesinOktetoManifest } + if namespace == "" { + namespace = okteto.GetContext().Namespace + } serviceName := "" if len(args) > 0 {