-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* pause/unpause * get deployment type * add suspend check * add examples * combine pause/unpause * add suspend type * update fake flux * spelling error * added wrong file * rebase * address comments Co-authored-by: Justin Thompson <[email protected]>
- Loading branch information
1 parent
7bdccd8
commit 0d48ef7
Showing
10 changed files
with
335 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package pause | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/spf13/cobra" | ||
"github.com/weaveworks/weave-gitops/cmd/wego/version" | ||
"github.com/weaveworks/weave-gitops/pkg/flux" | ||
"github.com/weaveworks/weave-gitops/pkg/kube" | ||
"github.com/weaveworks/weave-gitops/pkg/logger" | ||
"github.com/weaveworks/weave-gitops/pkg/runner" | ||
"github.com/weaveworks/weave-gitops/pkg/services/app" | ||
) | ||
|
||
var params app.PauseParams | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "pause <app-name>", | ||
Short: "Pause an application", | ||
Args: cobra.MinimumNArgs(1), | ||
Example: "wego app pause podinfo", | ||
RunE: runCmd, | ||
SilenceUsage: true, | ||
SilenceErrors: true, | ||
PostRun: func(cmd *cobra.Command, args []string) { | ||
version.CheckVersion(version.CheckpointParamsWithFlags(version.CheckpointParams(), cmd)) | ||
}, | ||
} | ||
|
||
func runCmd(cmd *cobra.Command, args []string) error { | ||
params.Namespace, _ = cmd.Parent().Flags().GetString("namespace") | ||
params.Name = args[0] | ||
|
||
cliRunner := &runner.CLIRunner{} | ||
fluxClient := flux.New(cliRunner) | ||
logger := logger.New(os.Stdout) | ||
kubeClient, err := kube.NewKubeHTTPClient() | ||
if err != nil { | ||
return fmt.Errorf("error initializing kube client: %w", err) | ||
} | ||
|
||
appService := app.New(logger, nil, fluxClient, kubeClient) | ||
|
||
if err := appService.Pause(params); err != nil { | ||
return errors.Wrapf(err, "failed to pause the app %s", params.Name) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package unpause | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/spf13/cobra" | ||
"github.com/weaveworks/weave-gitops/cmd/wego/version" | ||
"github.com/weaveworks/weave-gitops/pkg/flux" | ||
"github.com/weaveworks/weave-gitops/pkg/kube" | ||
"github.com/weaveworks/weave-gitops/pkg/logger" | ||
"github.com/weaveworks/weave-gitops/pkg/runner" | ||
"github.com/weaveworks/weave-gitops/pkg/services/app" | ||
) | ||
|
||
var params app.UnpauseParams | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "unpause <app-name>", | ||
Short: "Unpause an application", | ||
Args: cobra.MinimumNArgs(1), | ||
Example: "wego app unpause podinfo", | ||
RunE: runCmd, | ||
SilenceUsage: true, | ||
SilenceErrors: true, | ||
PostRun: func(cmd *cobra.Command, args []string) { | ||
version.CheckVersion(version.CheckpointParamsWithFlags(version.CheckpointParams(), cmd)) | ||
}, | ||
} | ||
|
||
func runCmd(cmd *cobra.Command, args []string) error { | ||
params.Namespace, _ = cmd.Parent().Flags().GetString("namespace") | ||
params.Name = args[0] | ||
|
||
cliRunner := &runner.CLIRunner{} | ||
fluxClient := flux.New(cliRunner) | ||
logger := logger.New(os.Stdout) | ||
kubeClient, err := kube.NewKubeHTTPClient() | ||
if err != nil { | ||
return fmt.Errorf("error initializing kube client: %w", err) | ||
} | ||
|
||
appService := app.New(logger, nil, fluxClient, kubeClient) | ||
|
||
if err := appService.Unpause(params); err != nil { | ||
return errors.Wrapf(err, "failed to unpause the app %s", params.Name) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.