Merge pull request #3098 from ikaven1024/fix-proxy

support pod subresource (attach, exec, port-forward) through global proxy
This commit is contained in:
karmada-bot 2023-02-02 10:37:22 +08:00 committed by GitHub
commit 1d32ab6e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -63,7 +63,10 @@ func (c *Cluster) SupportRequest(request framework.ProxyRequest) bool {
func (c *Cluster) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) { func (c *Cluster) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) {
requestInfo := request.RequestInfo requestInfo := request.RequestInfo
if requestInfo.Verb == "create" { // For creating request, cluster proxy doesn't know which cluster to create, so responses MethodNotSupported error.
// While for subresource request, having resource name request (like pods attach, exec and port-forward),
// proxy it to the cluster the resource located.
if requestInfo.Verb == "create" && requestInfo.Name == "" {
return nil, apierrors.NewMethodNotSupported(request.GroupVersionResource.GroupResource(), requestInfo.Verb) return nil, apierrors.NewMethodNotSupported(request.GroupVersionResource.GroupResource(), requestInfo.Verb)
} }