add portforwarding support to node/api (#1102)

Co-authored-by: Pablo Borrelli <pablo.borrelli0@gmail.com>
Co-authored-by: windyear <1280027646@qq.com>
This commit is contained in:
Salvatore Cirone
2023-06-16 03:45:10 +02:00
committed by GitHub
parent 8205ee2889
commit 59fd7fddb6
10 changed files with 1097 additions and 1 deletions

View File

@@ -37,6 +37,9 @@ type Provider interface {
// GetMetricsResource gets the metrics for the node, including running pods
GetMetricsResource(context.Context) ([]*dto.MetricFamily, error)
// PortForward forwards a local port to a port on the pod
PortForward(ctx context.Context, namespace, pod string, port int32, stream io.ReadWriteCloser) error
}
// ProviderConfig holds objects created by NewNodeFromClient that a provider may need to bootstrap itself.
@@ -73,6 +76,7 @@ func AttachProviderRoutes(mux api.ServeMux) NodeOpt {
GetMetricsResource: p.GetMetricsResource,
StreamIdleTimeout: cfg.StreamIdleTimeout,
StreamCreationTimeout: cfg.StreamCreationTimeout,
PortForward: p.PortForward,
}, true))
}
return nil