Decouple vkubelet/* packages from providers (#626)
This makes the concept of a `Provider` wholely implemented in the cli implementation in cmd/virtual-kubelet. It allows us to slim down the interfaces used in vkubelet (and vkubelet/api) to what is actually used there rather than a huge interface that is only there to serve the CLI's needs.
This commit is contained in:
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/log"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/providers"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/vkubelet"
|
||||
"github.com/virtual-kubelet/virtual-kubelet/vkubelet/api"
|
||||
)
|
||||
|
||||
// AcceptedCiphers is the list of accepted TLS ciphers, with known weak ciphers elided
|
||||
@@ -86,7 +86,13 @@ func setupHTTPServer(ctx context.Context, p providers.Provider, cfg *apiServerCo
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
vkubelet.AttachPodRoutes(p, mux, true)
|
||||
|
||||
podRoutes := api.PodHandlerConfig{
|
||||
RunInContainer: p.RunInContainer,
|
||||
GetContainerLogs: p.GetContainerLogs,
|
||||
GetPods: p.GetPods,
|
||||
}
|
||||
api.AttachPodRoutes(podRoutes, mux, true)
|
||||
|
||||
s := &http.Server{
|
||||
Handler: mux,
|
||||
@@ -105,7 +111,15 @@ func setupHTTPServer(ctx context.Context, p providers.Provider, cfg *apiServerCo
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
vkubelet.AttachMetricsRoutes(p, mux)
|
||||
|
||||
var summaryHandlerFunc api.PodStatsSummaryHandlerFunc
|
||||
if mp, ok := p.(providers.PodMetricsProvider); ok {
|
||||
summaryHandlerFunc = mp.GetStatsSummary
|
||||
}
|
||||
podMetricsRoutes := api.PodMetricsConfig{
|
||||
GetStatsSummary: summaryHandlerFunc,
|
||||
}
|
||||
api.AttachPodMetricsRoutes(podMetricsRoutes, mux)
|
||||
s := &http.Server{
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user