Last active
February 4, 2020 06:15
-
-
Save ihcsim/86d530a491408ae1d2e966fb407618ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Exec prepares a streaming endpoint to execute a command in the container, and returns the address. | |
| func (r *RemoteRuntimeService) Exec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) { | |
| ctx, cancel := getContextWithTimeout(r.timeout) | |
| defer cancel() | |
| resp, err := r.runtimeClient.Exec(ctx, req) | |
| if err != nil { | |
| klog.Errorf("Exec %s '%s' from runtime service failed: %v", req.ContainerId, strings.Join(req.Cmd, " "), err) | |
| return nil, err | |
| } | |
| if resp.Url == "" { | |
| errorMessage := "URL is not set" | |
| klog.Errorf("Exec failed: %s", errorMessage) | |
| return nil, errors.New(errorMessage) | |
| } | |
| return resp, nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment