當前位置: 首頁>>代碼示例>>Golang>>正文


Golang ExecRequest.GetContainerId方法代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/pkg/kubelet/api/v1alpha1/runtime.ExecRequest.GetContainerId方法的典型用法代碼示例。如果您正苦於以下問題:Golang ExecRequest.GetContainerId方法的具體用法?Golang ExecRequest.GetContainerId怎麽用?Golang ExecRequest.GetContainerId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在k8s/io/kubernetes/pkg/kubelet/api/v1alpha1/runtime.ExecRequest的用法示例。


在下文中一共展示了ExecRequest.GetContainerId方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Exec

// Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
func (ds *dockerService) Exec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
	if ds.streamingServer == nil {
		return nil, streaming.ErrorStreamingDisabled("exec")
	}
	_, err := checkContainerStatus(ds.client, req.GetContainerId())
	if err != nil {
		return nil, err
	}
	return ds.streamingServer.GetExec(req)
}
開發者ID:oszi,項目名稱:kubernetes,代碼行數:11,代碼來源:docker_streaming.go

示例2: GetExec

func (s *server) GetExec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
	url := s.buildURL("exec", req.GetContainerId(), streamOpts{
		stdin:   req.GetStdin(),
		stdout:  true,
		stderr:  !req.GetTty(), // For TTY connections, both stderr is combined with stdout.
		tty:     req.GetTty(),
		command: req.GetCmd(),
	})
	return &runtimeapi.ExecResponse{
		Url: &url,
	}, nil
}
開發者ID:alex-mohr,項目名稱:kubernetes,代碼行數:12,代碼來源:server.go

示例3: Exec

// 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 {
		glog.Errorf("Exec %s '%s' from runtime service failed: %v", req.GetContainerId(), strings.Join(req.GetCmd(), " "), err)
		return nil, err
	}

	return resp, nil
}
開發者ID:eljefedelrodeodeljefe,項目名稱:kubernetes,代碼行數:13,代碼來源:remote_runtime.go

示例4: GetExec

func (s *server) GetExec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
	if req.GetContainerId() == "" {
		return nil, grpc.Errorf(codes.InvalidArgument, "missing required container_id")
	}
	token, err := s.cache.Insert(req)
	if err != nil {
		return nil, err
	}
	return &runtimeapi.ExecResponse{
		Url: s.buildURL("exec", token),
	}, nil
}
開發者ID:kubernetes,項目名稱:kubernetes,代碼行數:12,代碼來源:server.go

示例5: Exec

func (r *FakeRuntime) Exec(req *runtimeApi.ExecRequest) (*runtimeApi.ExecResponse, error) {
	url := "http://" + FakeStreamingHost + ":" + FakeStreamingPort + "/exec/" + req.GetContainerId()
	return &runtimeApi.ExecResponse{
		Url: &url,
	}, nil
}
開發者ID:eljefedelrodeodeljefe,項目名稱:kubernetes,代碼行數:6,代碼來源:fake-app-interface.go


注:本文中的k8s/io/kubernetes/pkg/kubelet/api/v1alpha1/runtime.ExecRequest.GetContainerId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。