(ctx context.Context, kubeContext string)
| 159 | } |
| 160 | |
| 161 | func 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 | |
| 184 | func (c *client) DockerAPIClient() dockerclient.APIClient { |
| 185 | return c.APIClient |
no test coverage detected