-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving status to new structure (#475)
- Loading branch information
1 parent
1a994fa
commit 8bfd658
Showing
24 changed files
with
712 additions
and
674 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,53 @@ | ||
package status | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/weaveworks/weave-gitops/pkg/cmdimpl" | ||
"github.com/weaveworks/weave-gitops/pkg/flux" | ||
"github.com/weaveworks/weave-gitops/pkg/git" | ||
"github.com/weaveworks/weave-gitops/pkg/gitproviders" | ||
"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 Cmd = &cobra.Command{ | ||
Use: "status <app-name>", | ||
Short: "Get status of an app", | ||
Args: cobra.MinimumNArgs(1), | ||
Example: "wego app status podinfo", | ||
Use: "status <app-name>", | ||
Short: "Get status of an app", | ||
Args: cobra.MinimumNArgs(1), | ||
SilenceUsage: true, | ||
SilenceErrors: true, | ||
Example: "wego app status podinfo", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
params.Namespace, _ = cmd.Parent().Parent().Flags().GetString("namespace") | ||
params := app.StatusParams{} | ||
|
||
params.Name = args[0] | ||
return cmdimpl.Status(params) | ||
params.Namespace, _ = cmd.Parent().Parent().Flags().GetString("namespace") | ||
|
||
cliRunner := &runner.CLIRunner{} | ||
fluxClient := flux.New(cliRunner) | ||
kubeClient, err := kube.NewKubeHTTPClient() | ||
if err != nil { | ||
return fmt.Errorf("error initializing kube client: %w", err) | ||
} | ||
|
||
gitClient := git.New(nil) | ||
gitProviders := gitproviders.New() | ||
logger := logger.New(os.Stdout) | ||
|
||
appService := app.New(logger, gitClient, fluxClient, kubeClient, gitProviders) | ||
|
||
fluxOutput, lastSuccessReconciliation, err := appService.Status(params) | ||
if err != nil { | ||
return fmt.Errorf("failed getting application status: %w", err) | ||
} | ||
|
||
logger.Printf("Last successful reconciliation: %s\n\n", lastSuccessReconciliation) | ||
logger.Println(fluxOutput) | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
var params cmdimpl.StatusParams |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.