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

Method RunDeploymentsStatus

cmd/list/deployments.go:45–151  ·  view source on GitHub ↗

RunDeploymentsStatus executes the devspace status deployments command logic

(f factory.Factory, cobraCmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

43
44// RunDeploymentsStatus executes the devspace status deployments command logic
45func (cmd *deploymentsCmd) RunDeploymentsStatus(f factory.Factory, cobraCmd *cobra.Command, args []string) error {
46 // Set config root
47 logger := f.GetLog()
48 configOptions := cmd.ToConfigOptions()
49 configLoader, err := f.NewConfigLoader(cmd.ConfigPath)
50 if err != nil {
51 return err
52 }
53 configExists, err := configLoader.SetDevSpaceRoot(logger)
54 if err != nil {
55 return err
56 }
57 if !configExists {
58 return errors.New(message.ConfigNotFound)
59 }
60
61 var values [][]string
62 var headerValues = []string{
63 "NAME",
64 "TYPE",
65 "DEPLOY",
66 "STATUS",
67 }
68
69 // Create new kube client
70 client, err := f.NewKubeClientFromContext(cmd.KubeContext, cmd.Namespace)
71 if err != nil {
72 return err
73 }
74
75 // Load generated
76 localCache, err := configLoader.LoadLocalCache()
77 if err != nil {
78 return err
79 }
80
81 // If the current kube context or namespace is different from old,
82 // show warnings and reset kube client if necessary
83 client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, false, logger)
84 if err != nil {
85 return err
86 }
87
88 // Get config with adjusted cluster config
89 configInterface, err := configLoader.LoadWithCache(context.Background(), localCache, client, configOptions, logger)
90 if err != nil {
91 return err
92 }
93
94 // Create conext
95 ctx := devspacecontext.NewContext(context.Background(), configInterface.Variables(), logger).
96 WithConfig(configInterface).
97 WithKubeClient(client)
98
99 // Resolve dependencies
100 dependencies, err := f.NewDependencyManager(ctx, configOptions).ResolveAll(ctx, dependency.ResolveOptions{})
101 if err != nil {
102 return err

Callers 1

newDeploymentsCmdFunction · 0.95

Calls 15

SetDevSpaceRootMethod · 0.95
LoadLocalCacheMethod · 0.95
LoadWithCacheMethod · 0.95
StatusMethod · 0.95
CheckKubeContextFunction · 0.92
NewClientFunction · 0.92
ToConfigOptionsMethod · 0.80
GetLogMethod · 0.65
NewConfigLoaderMethod · 0.65
WithKubeClientMethod · 0.65
WithConfigMethod · 0.65

Tested by

no test coverage detected