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

Method RunOpen

cmd/open.go:94–248  ·  view source on GitHub ↗

RunOpen executes the functionality "devspace open"

(f factory.Factory)

Source from the content-addressed store, hash-verified

92
93// RunOpen executes the functionality "devspace open"
94func (cmd *OpenCmd) RunOpen(f factory.Factory) error {
95 // Set config root
96 cmd.log = f.GetLog()
97 configLoader, err := f.NewConfigLoader(cmd.ConfigPath)
98 if err != nil {
99 return err
100 }
101 configExists, err := configLoader.SetDevSpaceRoot(cmd.log)
102 if err != nil {
103 return err
104 }
105
106 var (
107 domain string
108 tls bool
109 ingressControllerWarning string
110 )
111
112 // Get kubernetes client
113 client, err := f.NewKubeClientFromContext(cmd.KubeContext, cmd.Namespace)
114 if err != nil {
115 return err
116 }
117
118 // Load generated config if possible
119 var localCache localcache.Cache
120 if configExists {
121 log.StartFileLogging()
122
123 localCache, err = configLoader.LoadLocalCache()
124 if err != nil {
125 return err
126 }
127 }
128
129 // If the current kube context or namespace is different from old,
130 // show warnings and reset kube client if necessary
131 client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, false, cmd.log)
132 if err != nil {
133 return err
134 }
135
136 // create devspace context
137 ctx := devspacecontext.NewContext(context.Background(), nil, cmd.log).
138 WithKubeClient(client)
139
140 // Execute plugin hook
141 err = hook.ExecuteHooks(ctx, nil, "open")
142 if err != nil {
143 return err
144 }
145
146 namespace := client.Namespace()
147 ingressControllerWarning = ansi.Color(" ! an ingress controller must be installed in your cluster", "red+b")
148
149 openingMode, err := cmd.log.Question(&survey.QuestionOptions{
150 Question: "How do you want to open your application?",
151 DefaultValue: openLocalHostOption,

Callers 1

NewOpenCmdFunction · 0.95

Calls 15

SetDevSpaceRootMethod · 0.95
LoadLocalCacheMethod · 0.95
openLocalMethod · 0.95
findDomainMethod · 0.95
getServiceMethod · 0.95
StartFileLoggingFunction · 0.92
CheckKubeContextFunction · 0.92
ExecuteHooksFunction · 0.92
StringFunction · 0.92
openURLFunction · 0.85
GetLogMethod · 0.65
NewConfigLoaderMethod · 0.65

Tested by

no test coverage detected