mirror of https://github.com/knative/caching.git
Auto-update dependencies (#49)
Produced via: `dep ensure -update github.com/knative/test-infra knative.dev/pkg` /assign @mattmoor
This commit is contained in:
parent
77d253c889
commit
c74fd463d8
|
@ -261,7 +261,7 @@
|
||||||
"tools/dep-collector",
|
"tools/dep-collector",
|
||||||
]
|
]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "f7f13f8e3a8af17943e1a44102607f1d3fc4751d"
|
revision = "d976261d75101cab99291409641dc999c7baec68"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:5985ef4caf91ece5d54817c11ea25f182697534f8ae6521eadcd628c142ac4b6"
|
digest = "1:5985ef4caf91ece5d54817c11ea25f182697534f8ae6521eadcd628c142ac4b6"
|
||||||
|
@ -930,7 +930,7 @@
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:ed15fad369d1d253ebcae3defd279859d26e54d83e1e601fb3cf40d192377404"
|
digest = "1:4563adec376c56f3441da3767facc1d6c733d93a39f593495c009fed54dbb76c"
|
||||||
name = "knative.dev/pkg"
|
name = "knative.dev/pkg"
|
||||||
packages = [
|
packages = [
|
||||||
"apis",
|
"apis",
|
||||||
|
@ -949,7 +949,7 @@
|
||||||
"metrics/metricskey",
|
"metrics/metricskey",
|
||||||
]
|
]
|
||||||
pruneopts = "T"
|
pruneopts = "T"
|
||||||
revision = "84d3910c565e397fa044f246398f94712da53303"
|
revision = "e2418a08c195ff0acda037c11c21882ca5453d96"
|
||||||
|
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
|
|
|
@ -31,7 +31,7 @@ const (
|
||||||
|
|
||||||
// UpdaterAnnotationSuffix is the suffix of the annotation key to describe
|
// UpdaterAnnotationSuffix is the suffix of the annotation key to describe
|
||||||
// the user who last modified the resource.
|
// the user who last modified the resource.
|
||||||
UpdaterAnnotationSuffix = "/updater"
|
UpdaterAnnotationSuffix = "/lastModifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetUserInfoAnnotations sets creator and updater annotations on a resource.
|
// SetUserInfoAnnotations sets creator and updater annotations on a resource.
|
||||||
|
@ -45,7 +45,7 @@ func SetUserInfoAnnotations(resource apis.HasSpec, ctx context.Context, groupNam
|
||||||
annotations := objectMetaAccessor.GetObjectMeta().GetAnnotations()
|
annotations := objectMetaAccessor.GetObjectMeta().GetAnnotations()
|
||||||
if annotations == nil {
|
if annotations == nil {
|
||||||
annotations = map[string]string{}
|
annotations = map[string]string{}
|
||||||
defer objectMetaAccessor.GetObjectMeta().SetAnnotations(annotations)
|
objectMetaAccessor.GetObjectMeta().SetAnnotations(annotations)
|
||||||
}
|
}
|
||||||
|
|
||||||
if apis.IsInUpdate(ctx) {
|
if apis.IsInUpdate(ctx) {
|
||||||
|
|
|
@ -99,6 +99,10 @@ type ControllerOptions struct {
|
||||||
// TLS Client Authentication.
|
// TLS Client Authentication.
|
||||||
// The default value is tls.NoClientCert.
|
// The default value is tls.NoClientCert.
|
||||||
ClientAuth tls.ClientAuthType
|
ClientAuth tls.ClientAuthType
|
||||||
|
|
||||||
|
// StatsReporter reports metrics about the webhook.
|
||||||
|
// This will be automatically initialized by the constructor if left uninitialized.
|
||||||
|
StatsReporter StatsReporter
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceCallback defines a signature for resource specific (Route, Configuration, etc.)
|
// ResourceCallback defines a signature for resource specific (Route, Configuration, etc.)
|
||||||
|
@ -118,7 +122,6 @@ type AdmissionController struct {
|
||||||
Options ControllerOptions
|
Options ControllerOptions
|
||||||
Handlers map[schema.GroupVersionKind]GenericCRD
|
Handlers map[schema.GroupVersionKind]GenericCRD
|
||||||
Logger *zap.SugaredLogger
|
Logger *zap.SugaredLogger
|
||||||
StatsReporter StatsReporter
|
|
||||||
|
|
||||||
WithContext func(context.Context) context.Context
|
WithContext func(context.Context) context.Context
|
||||||
DisallowUnknownFields bool
|
DisallowUnknownFields bool
|
||||||
|
@ -136,6 +139,33 @@ type GenericCRD interface {
|
||||||
runtime.Object
|
runtime.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewAdmissionController constructs an AdmissionController
|
||||||
|
func NewAdmissionController(
|
||||||
|
client kubernetes.Interface,
|
||||||
|
opts ControllerOptions,
|
||||||
|
handlers map[schema.GroupVersionKind]GenericCRD,
|
||||||
|
logger *zap.SugaredLogger,
|
||||||
|
ctx func(context.Context) context.Context,
|
||||||
|
disallowUnknownFields bool) (*AdmissionController, error) {
|
||||||
|
|
||||||
|
if opts.StatsReporter == nil {
|
||||||
|
reporter, err := NewStatsReporter()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
opts.StatsReporter = reporter
|
||||||
|
}
|
||||||
|
|
||||||
|
return &AdmissionController{
|
||||||
|
Client: client,
|
||||||
|
Options: opts,
|
||||||
|
Handlers: handlers,
|
||||||
|
Logger: logger,
|
||||||
|
WithContext: ctx,
|
||||||
|
DisallowUnknownFields: disallowUnknownFields,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetAPIServerExtensionCACert gets the Kubernetes aggregate apiserver
|
// GetAPIServerExtensionCACert gets the Kubernetes aggregate apiserver
|
||||||
// client CA cert used by validator.
|
// client CA cert used by validator.
|
||||||
//
|
//
|
||||||
|
@ -455,8 +485,10 @@ func (ac *AdmissionController) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ac.Options.StatsReporter != nil {
|
||||||
// Only report valid requests
|
// Only report valid requests
|
||||||
ac.StatsReporter.ReportRequest(review.Request, response.Response, time.Since(ttStart))
|
ac.Options.StatsReporter.ReportRequest(review.Request, response.Response, time.Since(ttStart))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeErrorStatus(reason string, args ...interface{}) *admissionv1beta1.AdmissionResponse {
|
func makeErrorStatus(reason string, args ...interface{}) *admissionv1beta1.AdmissionResponse {
|
||||||
|
|
Loading…
Reference in New Issue