vendor dependencies

This commit is contained in:
Sergiusz Urbaniak 2019-04-24 11:06:03 +02:00
parent 604208ef4f
commit 72abf135d6
1156 changed files with 78178 additions and 105799 deletions

View file

@ -127,7 +127,16 @@ func (ch *CMHandlers) registerResourceHandlers(a *MetricsAPIInstaller, ws *restf
},
}
rootScopedHandler := metrics.InstrumentRouteFunc("LIST", "custom-metrics", "", "cluster", restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout))
rootScopedHandler := metrics.InstrumentRouteFunc(
"LIST",
a.group.GroupVersion.Group,
a.group.GroupVersion.Version,
reqScope.Resource.Resource,
reqScope.Subresource,
"cluster",
"custom-metrics",
restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout),
)
// install the root-scoped route
rootScopedRoute := ws.GET(rootScopedPath).To(rootScopedHandler).
@ -151,7 +160,17 @@ func (ch *CMHandlers) registerResourceHandlers(a *MetricsAPIInstaller, ws *restf
SelfLinkPathPrefix: gpath.Join(a.prefix, "namespaces") + "/",
},
}
namespacedHandler := metrics.InstrumentRouteFunc("LIST", "custom-metrics-namespaced", "", "namespace", restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout))
namespacedHandler := metrics.InstrumentRouteFunc(
"LIST",
a.group.GroupVersion.Group,
a.group.GroupVersion.Version,
reqScope.Resource.Resource,
reqScope.Subresource,
"resource",
"custom-metrics",
restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout),
)
namespacedRoute := ws.GET(namespacedPath).To(namespacedHandler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed.")).
@ -173,7 +192,18 @@ func (ch *CMHandlers) registerResourceHandlers(a *MetricsAPIInstaller, ws *restf
SelfLinkPathPrefix: gpath.Join(a.prefix, "namespaces") + "/",
},
}
namespaceSpecificHandler := metrics.InstrumentRouteFunc("LIST", "custom-metrics-for-namespace", "", "cluster", restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout))
namespaceSpecificHandler := metrics.InstrumentRouteFunc(
"LIST",
a.group.GroupVersion.Group,
a.group.GroupVersion.Version,
reqScope.Resource.Resource,
reqScope.Subresource,
"resource",
"custom-metrics",
restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout),
)
namespaceSpecificRoute := ws.GET(namespaceSpecificPath).To(namespaceSpecificHandler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed.")).

View file

@ -106,7 +106,16 @@ func (ch *EMHandlers) registerResourceHandlers(a *MetricsAPIInstaller, ws *restf
},
}
externalMetricHandler := metrics.InstrumentRouteFunc("LIST", "external-metrics", "", "", restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout))
externalMetricHandler := metrics.InstrumentRouteFunc(
"LIST",
a.group.GroupVersion.Group,
a.group.GroupVersion.Version,
reqScope.Resource.Resource,
reqScope.Subresource,
"cluster",
"external-metrics",
restfulListResource(lister, nil, reqScope, false, a.minRequestTimeout),
)
externalMetricRoute := ws.GET(externalMetricPath).To(externalMetricHandler).
Doc(doc).

View file

@ -35,7 +35,7 @@ type CustomMetricsAdapterServerOptions struct {
func NewCustomMetricsAdapterServerOptions() *CustomMetricsAdapterServerOptions {
o := &CustomMetricsAdapterServerOptions{
SecureServing: genericoptions.WithLoopback(genericoptions.NewSecureServingOptions()),
SecureServing: genericoptions.NewSecureServingOptions().WithLoopback(),
Authentication: genericoptions.NewDelegatingAuthenticationOptions(),
Authorization: genericoptions.NewDelegatingAuthorizationOptions(),
Features: genericoptions.NewFeatureOptions(),
@ -59,11 +59,11 @@ func (o CustomMetricsAdapterServerOptions) Config() (*apiserver.Config, error) {
}
serverConfig := genericapiserver.NewConfig(apiserver.Codecs)
if err := o.SecureServing.ApplyTo(serverConfig); err != nil {
if err := o.SecureServing.ApplyTo(&serverConfig.SecureServing, &serverConfig.LoopbackClientConfig); err != nil {
return nil, err
}
if err := o.Authentication.ApplyTo(&serverConfig.Authentication, serverConfig.SecureServing, nil); err != nil {
if err := o.Authentication.ApplyTo(&serverConfig.Authentication, serverConfig.SecureServing, serverConfig.OpenAPIConfig); err != nil {
return nil, err
}
if err := o.Authorization.ApplyTo(&serverConfig.Authorization); err != nil {

View file

@ -19,10 +19,10 @@ package dynamicmapper
import (
"fmt"
"github.com/emicklei/go-restful-swagger12"
"github.com/googleapis/gnostic/OpenAPIv2"
swagger "github.com/emicklei/go-restful-swagger12"
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
@ -61,6 +61,24 @@ func (c *FakeDiscovery) ServerResources() ([]*metav1.APIResourceList, error) {
return c.Resources, nil
}
func (c *FakeDiscovery) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
sgs, err := c.ServerGroups()
if err != nil {
return nil, nil, err
}
resultGroups := []*metav1.APIGroup{}
for i := range sgs.Groups {
resultGroups = append(resultGroups, &sgs.Groups[i])
}
action := testing.ActionImpl{
Verb: "get",
Resource: schema.GroupVersionResource{Resource: "resource"},
}
c.Invokes(action, nil)
return resultGroups, c.Resources, nil
}
func (c *FakeDiscovery) ServerPreferredResources() ([]*metav1.APIResourceList, error) {
return nil, nil
}

View file

@ -5,13 +5,12 @@ import (
"sync"
"time"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/discovery"
"k8s.io/client-go/restmapper"
"k8s.io/klog"
)
// RengeneratingDiscoveryRESTMapper is a RESTMapper which Regenerates its cache of mappings periodically.
@ -44,7 +43,7 @@ func NewRESTMapper(discoveryClient discovery.DiscoveryInterface, refreshInterval
func (m *RegeneratingDiscoveryRESTMapper) RunUntil(stop <-chan struct{}) {
go wait.Until(func() {
if err := m.RegenerateMappings(); err != nil {
glog.Errorf("error regenerating REST mappings from discovery: %v", err)
klog.Errorf("error regenerating REST mappings from discovery: %v", err)
}
}, m.refreshInterval, stop)
}