MCPcopy Index your code
hub / github.com/devspace-sh/devspace / NewAnalyzeCmd

Function NewAnalyzeCmd

cmd/analyze.go:26–57  ·  view source on GitHub ↗

NewAnalyzeCmd creates a new analyze command

(f factory.Factory, globalFlags *flags.GlobalFlags)

Source from the content-addressed store, hash-verified

24
25// NewAnalyzeCmd creates a new analyze command
26func NewAnalyzeCmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Command {
27 cmd := &AnalyzeCmd{GlobalFlags: globalFlags}
28
29 analyzeCmd := &cobra.Command{
30 Use: "analyze",
31 Short: "Analyzes a kubernetes namespace and checks for potential problems",
32 Long: `
33#######################################################
34################## devspace analyze ###################
35#######################################################
36Analyze checks a namespaces events, replicasets, services
37and pods for potential problems
38
39Example:
40devspace analyze
41devspace analyze --namespace=mynamespace
42#######################################################
43 `,
44 Args: cobra.NoArgs,
45 RunE: func(cobraCmd *cobra.Command, args []string) error {
46 plugin.SetPluginCommand(cobraCmd, args)
47 return cmd.RunAnalyze(f, cobraCmd, args)
48 },
49 }
50
51 analyzeCmd.Flags().BoolVar(&cmd.Wait, "wait", true, "Wait for pods to get ready if they are just starting")
52 analyzeCmd.Flags().IntVar(&cmd.Timeout, "timeout", 120, "Timeout until analyze should stop waiting")
53 analyzeCmd.Flags().BoolVar(&cmd.Patient, "patient", false, "If true, analyze will ignore failing pods and events until every deployment, statefulset, replicaset and pods are ready or the timeout is reached")
54 analyzeCmd.Flags().BoolVar(&cmd.IgnorePodRestarts, "ignore-pod-restarts", false, "If true, analyze will ignore the restart events of running pods")
55
56 return analyzeCmd
57}
58
59// RunAnalyze executes the functionality "devspace analyze"
60func (cmd *AnalyzeCmd) RunAnalyze(f factory.Factory, cobraCmd *cobra.Command, args []string) error {

Callers 1

BuildRootFunction · 0.85

Calls 2

RunAnalyzeMethod · 0.95
SetPluginCommandFunction · 0.92

Tested by

no test coverage detected