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
17
vendor/k8s.io/apiserver/plugin/pkg/audit/webhook/webhook.go
generated
vendored
17
vendor/k8s.io/apiserver/plugin/pkg/audit/webhook/webhook.go
generated
vendored
|
|
@ -23,6 +23,7 @@ import (
|
|||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||
auditinternal "k8s.io/apiserver/pkg/apis/audit"
|
||||
"k8s.io/apiserver/pkg/apis/audit/install"
|
||||
"k8s.io/apiserver/pkg/audit"
|
||||
|
|
@ -60,11 +61,15 @@ func retryOnError(err error) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func loadWebhook(configFile string, groupVersion schema.GroupVersion, initialBackoff time.Duration) (*webhook.GenericWebhook, error) {
|
||||
func loadWebhook(configFile string, groupVersion schema.GroupVersion, initialBackoff time.Duration, customDial utilnet.DialFunc) (*webhook.GenericWebhook, error) {
|
||||
w, err := webhook.NewGenericWebhook(audit.Scheme, audit.Codecs, configFile,
|
||||
[]schema.GroupVersion{groupVersion}, initialBackoff)
|
||||
[]schema.GroupVersion{groupVersion}, initialBackoff, customDial)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w.ShouldRetry = retryOnError
|
||||
return w, err
|
||||
return w, nil
|
||||
}
|
||||
|
||||
type backend struct {
|
||||
|
|
@ -86,8 +91,8 @@ func NewDynamicBackend(rc *rest.RESTClient, initialBackoff time.Duration) audit.
|
|||
}
|
||||
|
||||
// NewBackend returns an audit backend that sends events over HTTP to an external service.
|
||||
func NewBackend(kubeConfigFile string, groupVersion schema.GroupVersion, initialBackoff time.Duration) (audit.Backend, error) {
|
||||
w, err := loadWebhook(kubeConfigFile, groupVersion, initialBackoff)
|
||||
func NewBackend(kubeConfigFile string, groupVersion schema.GroupVersion, initialBackoff time.Duration, customDial utilnet.DialFunc) (audit.Backend, error) {
|
||||
w, err := loadWebhook(kubeConfigFile, groupVersion, initialBackoff, customDial)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -124,7 +129,7 @@ func (b *backend) processEvents(ev ...*auditinternal.Event) error {
|
|||
// allow enough time for the serialization/deserialization of audit events, which
|
||||
// contain nested request and response objects plus additional event fields.
|
||||
defer trace.LogIfLong(time.Duration(50+25*len(list.Items)) * time.Millisecond)
|
||||
return b.w.RestClient.Post().Body(&list).Do()
|
||||
return b.w.RestClient.Post().Body(&list).Do(context.TODO())
|
||||
}).Error()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue