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

Function GetMinikubeEnvironment

pkg/devspace/docker/client.go:161–182  ·  view source on GitHub ↗
(ctx context.Context, kubeContext string)

Source from the content-addressed store, hash-verified

159}
160
161func GetMinikubeEnvironment(ctx context.Context, kubeContext string) (map[string]string, error) {
162 out, err := command.Output(ctx, "", expand.ListEnviron(os.Environ()...), "minikube", "docker-env", "--shell", "none", "--profile", kubeContext)
163 if err != nil {
164 if ee, ok := err.(*exec.ExitError); ok {
165 out = ee.Stderr
166 }
167 return nil, errors.Errorf("error executing 'minikube docker-env --shell none'\nerror: %v\noutput: %s", err, string(out))
168 }
169
170 env := map[string]string{}
171 for _, line := range strings.Split(string(out), "\n") {
172 envKeyValue := strings.Split(line, "=")
173
174 if len(envKeyValue) != 2 {
175 continue
176 }
177
178 env[envKeyValue[0]] = envKeyValue[1]
179 }
180
181 return env, nil
182}
183
184func (c *client) DockerAPIClient() dockerclient.APIClient {
185 return c.APIClient

Callers 1

Calls 2

EnvironMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected