mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 17:57:51 +00:00
Update custom-metrics-apiserver and metrics-server
This commit is contained in:
parent
4c673534f2
commit
b480e45a67
915 changed files with 63694 additions and 106514 deletions
5
vendor/github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/cmd/builder.go
generated
vendored
5
vendor/github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/cmd/builder.go
generated
vendored
|
|
@ -29,6 +29,7 @@ import (
|
|||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
openapicommon "k8s.io/kube-openapi/pkg/common"
|
||||
|
||||
"github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/apiserver"
|
||||
"github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/cmd/server"
|
||||
|
|
@ -66,6 +67,9 @@ type AdapterBase struct {
|
|||
// if not explicitly set.
|
||||
FlagSet *pflag.FlagSet
|
||||
|
||||
// OpenAPIConfig
|
||||
OpenAPIConfig *openapicommon.Config
|
||||
|
||||
// flagOnce controls initialization of the flags.
|
||||
flagOnce sync.Once
|
||||
|
||||
|
|
@ -88,6 +92,7 @@ func (b *AdapterBase) InstallFlags() {
|
|||
b.flagOnce.Do(func() {
|
||||
if b.CustomMetricsAdapterServerOptions == nil {
|
||||
b.CustomMetricsAdapterServerOptions = server.NewCustomMetricsAdapterServerOptions()
|
||||
b.CustomMetricsAdapterServerOptions.OpenAPIConfig = b.OpenAPIConfig
|
||||
}
|
||||
|
||||
b.SecureServing.AddFlags(b.FlagSet)
|
||||
|
|
|
|||
15
vendor/github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/cmd/server/start.go
generated
vendored
15
vendor/github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/cmd/server/start.go
generated
vendored
|
|
@ -20,9 +20,11 @@ import (
|
|||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/apiserver"
|
||||
genericapiserver "k8s.io/apiserver/pkg/server"
|
||||
genericoptions "k8s.io/apiserver/pkg/server/options"
|
||||
openapicommon "k8s.io/kube-openapi/pkg/common"
|
||||
|
||||
"github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/apiserver"
|
||||
)
|
||||
|
||||
type CustomMetricsAdapterServerOptions struct {
|
||||
|
|
@ -31,6 +33,9 @@ type CustomMetricsAdapterServerOptions struct {
|
|||
Authentication *genericoptions.DelegatingAuthenticationOptions
|
||||
Authorization *genericoptions.DelegatingAuthorizationOptions
|
||||
Features *genericoptions.FeatureOptions
|
||||
|
||||
// OpenAPIConfig
|
||||
OpenAPIConfig *openapicommon.Config
|
||||
}
|
||||
|
||||
func NewCustomMetricsAdapterServerOptions() *CustomMetricsAdapterServerOptions {
|
||||
|
|
@ -63,15 +68,17 @@ func (o CustomMetricsAdapterServerOptions) Config() (*apiserver.Config, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if err := o.Authentication.ApplyTo(&serverConfig.Authentication, serverConfig.SecureServing, serverConfig.OpenAPIConfig); err != nil {
|
||||
if err := o.Authentication.ApplyTo(&serverConfig.Authentication, serverConfig.SecureServing, nil); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := o.Authorization.ApplyTo(&serverConfig.Authorization); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: we can't currently serve swagger because we don't have a good way to dynamically update it
|
||||
// serverConfig.SwaggerConfig = genericapiserver.DefaultSwaggerConfig()
|
||||
// enable OpenAPI schemas
|
||||
if o.OpenAPIConfig != nil {
|
||||
serverConfig.OpenAPIConfig = o.OpenAPIConfig
|
||||
}
|
||||
|
||||
config := &apiserver.Config{
|
||||
GenericConfig: serverConfig,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue