mirror of
https://github.com/hanzo-ml/kuberay.git
synced 2026-10-30 19:48:47 +00:00
* feat: add apiserver exec client for CreateComputeTemplate directly execute command in the pod instead of through http -e Signed-off-by: machichima <[email protected]> * build: install curl in apiserver container -e Signed-off-by: machichima <[email protected]> * feat: exec Delete Compute Template without http -e Signed-off-by: machichima <[email protected]> * feat: add exec.go for sending commands without http in e2e test with a kubectl exec like behaviour -e Signed-off-by: machichima <[email protected]> * feat: run curl container in pod alongside apiserver -e Signed-off-by: machichima <[email protected]> * feat: extract http status from curl output -e Signed-off-by: machichima <[email protected]> * style: remove unused comment -e Signed-off-by: machichima <[email protected]> * fix: wrong image name -e Signed-off-by: machichima <[email protected]> * style: remove redundant comment -e Signed-off-by: machichima <[email protected]> * build: NodePort to ClusterIP in deploy base insecure -e Signed-off-by: machichima <[email protected]> * build: update buildkit test-e2e to setup apiserver e2e -e Signed-off-by: machichima <[email protected]> * fix: alter executeRequest only -e Signed-off-by: machichima <[email protected]> * feat: remove extraPort and NodePort for apiserver e2e test Signed-off-by: machichima <[email protected]> * docs: add comment on e2e kustomization.yaml Signed-off-by: machichima <[email protected]> * fix: remove unused Docker & Make command Signed-off-by: machichima <[email protected]> * fix: more comment description + function to private Signed-off-by: machichima <[email protected]> * refactor: more intuitive make command Signed-off-by: machichima <[email protected]> * docs: make comment more concise Signed-off-by: machichima <[email protected]> * fix: use config.GetConfig() Signed-off-by: machichima <[email protected]> * fix: update make command Signed-off-by: machichima <[email protected]> * fix: update buildkite apiserver make cmd Signed-off-by: machichima <[email protected]> * feat: enable kubectl execute for apiserversdk e2e test Signed-off-by: machichima <[email protected]> * fix: apiserversdk e2e use k8s service proxy Signed-off-by: machichima <[email protected]> * docs: add docstring Signed-off-by: machichima <[email protected]> * refactor: remove adding suffix / Signed-off-by: machichima <[email protected]> * nit: wrap some words for 3rd party errors Signed-off-by: machichima <[email protected]> * nit: TODO for migrate SPDY to websocket Signed-off-by: machichima <[email protected]> --------- Signed-off-by: machichima <[email protected]> Signed-off-by: Nary Yeh <[email protected]>
37 lines
786 B
Go
37 lines
786 B
Go
package apiserversdk
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"path"
|
|
|
|
"k8s.io/client-go/rest"
|
|
)
|
|
|
|
type ProxyRoundTripper struct {
|
|
Transport http.RoundTripper
|
|
}
|
|
|
|
func newProxyRoundTripper(cfg *rest.Config) (*ProxyRoundTripper, error) {
|
|
transport, err := rest.TransportFor(cfg)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("failed to create http RoundTripper: %w", err)
|
|
}
|
|
|
|
return &ProxyRoundTripper{
|
|
Transport: transport,
|
|
}, nil
|
|
}
|
|
|
|
// RoundTrp send the request through the Kubernetes service proxy subresource
|
|
func (rt *ProxyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
newReq := req.Clone(req.Context())
|
|
|
|
newReq.URL.Path = path.Join(
|
|
"/api/v1/namespaces/ray-system/services/kuberay-apiserver:8888/proxy",
|
|
req.URL.Path,
|
|
)
|
|
|
|
return rt.Transport.RoundTrip(newReq)
|
|
}
|