mirror of https://github.com/knative/caching.git
Auto-update dependencies (#130)
Produced via: `dep ensure -update knative.dev/test-infra knative.dev/pkg` /assign n3wscott
This commit is contained in:
parent
0fc39123e1
commit
4276980149
|
@ -933,7 +933,7 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:0b3cb53ae4d837bb424680941581ec7a2828c9d530db0b11e0cf365ead4e6403"
|
||||
digest = "1:ff0b6b2483ef9341cc0c524f1e5bdbba37b56dde366791986e098a01de81dcac"
|
||||
name = "knative.dev/pkg"
|
||||
packages = [
|
||||
"apis",
|
||||
|
@ -952,7 +952,7 @@
|
|||
"metrics/metricskey",
|
||||
]
|
||||
pruneopts = "T"
|
||||
revision = "4deb5d83d26170faeef8e54e9ae4cd9b04ed81f8"
|
||||
revision = "d3841ea2c3cb7246076d771abd5cef8b94ef9031"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
|
|
@ -1260,14 +1260,14 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:5299d75a2b08a91c54ffb8b76afe21eb5f1ecf7bc4d67b859fc081f9415452bc"
|
||||
digest = "1:e4a2fd481bd2d6dcac5ae03c55d6104a0953d0a78cb45fdd4d20a116ed2a5218"
|
||||
name = "knative.dev/test-infra"
|
||||
packages = [
|
||||
"scripts",
|
||||
"tools/dep-collector",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "6c8da588aaa3d2bff76a9c37fd6ac5c9a6c02c09"
|
||||
revision = "e381f11dc722330fe082158e2f22cd39f8fe8375"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
|
||||
|
|
|
@ -164,12 +164,22 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto
|
|||
profilingHandler := profiling.NewHandler(logger, false)
|
||||
|
||||
// Watch the logging config map and dynamically update logging levels.
|
||||
cmw.Watch(logging.ConfigMapName(), logging.UpdateLevelFromConfigMap(logger, atomicLevel, component))
|
||||
if _, err := kubeclient.Get(ctx).CoreV1().ConfigMaps(system.Namespace()).Get(logging.ConfigMapName(),
|
||||
metav1.GetOptions{}); err == nil {
|
||||
cmw.Watch(logging.ConfigMapName(), logging.UpdateLevelFromConfigMap(logger, atomicLevel, component))
|
||||
} else if !apierrors.IsNotFound(err) {
|
||||
logger.Fatalw("Error reading ConfigMap: " + logging.ConfigMapName(), zap.Error(err))
|
||||
}
|
||||
|
||||
// Watch the observability config map
|
||||
cmw.Watch(metrics.ConfigMapName(),
|
||||
metrics.UpdateExporterFromConfigMap(component, logger),
|
||||
profilingHandler.UpdateFromConfigMap)
|
||||
if _, err := kubeclient.Get(ctx).CoreV1().ConfigMaps(system.Namespace()).Get(metrics.ConfigMapName(),
|
||||
metav1.GetOptions{}); err == nil {
|
||||
cmw.Watch(metrics.ConfigMapName(),
|
||||
metrics.UpdateExporterFromConfigMap(component, logger),
|
||||
profilingHandler.UpdateFromConfigMap)
|
||||
} else if !apierrors.IsNotFound(err) {
|
||||
logger.Fatalw("Error reading ConfigMap: " + metrics.ConfigMapName(), zap.Error(err))
|
||||
}
|
||||
|
||||
if err := cmw.Start(ctx.Done()); err != nil {
|
||||
logger.Fatalw("failed to start configuration manager", zap.Error(err))
|
||||
|
|
|
@ -105,7 +105,7 @@ func newLoggerFromConfig(configJSON string, levelOverride string, opts []zap.Opt
|
|||
return nil, zap.AtomicLevel{}, err
|
||||
}
|
||||
|
||||
logger.Info("Successfully created the logger.", zap.String(logkey.JSONConfig, configJSON))
|
||||
logger.Info("Successfully created the logger.")
|
||||
logger.Sugar().Infof("Logging level set to %v", loggingCfg.Level)
|
||||
return logger, loggingCfg.Level, nil
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.opencensus.io/stats"
|
||||
"go.uber.org/zap"
|
||||
"knative.dev/pkg/metrics/metricskey"
|
||||
)
|
||||
|
||||
|
@ -213,7 +213,7 @@ func createMetricsConfig(ops ExporterOptions, logger *zap.SugaredLogger) (*metri
|
|||
if !allowCustomMetrics {
|
||||
servingOrEventing := metricskey.KnativeRevisionMetrics.Union(
|
||||
metricskey.KnativeTriggerMetrics)
|
||||
mc.recorder = func(ctx context.Context, ms stats.Measurement, ros... stats.Options) error {
|
||||
mc.recorder = func(ctx context.Context, ms stats.Measurement, ros ...stats.Options) error {
|
||||
metricType := path.Join(mc.stackdriverMetricTypePrefix, ms.Measure().Name())
|
||||
|
||||
if servingOrEventing.Has(metricType) {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
## Knative Webhooks
|
||||
|
||||
Knative provides infrastructure for authoring webhooks under
|
||||
`knative.dev/pkg/webhook` and has a few built-in helpers for certain
|
||||
common admission control scenarios. The built-in admission controllers
|
||||
are:
|
||||
1. Resource validation and defaulting (builds around `apis.Validatable`
|
||||
and `apis.Defaultable` under `knative.dev/pkg/apis`).
|
||||
2. ConfigMap validation, which builds around similar patterns from
|
||||
`knative.dev/pkg/configmap` (in particular the `store` concept)
|
||||
`knative.dev/pkg/webhook` and has a few built-in helpers for certain common
|
||||
admission control scenarios. The built-in admission controllers are:
|
||||
|
||||
To illustrate standing up the webhook, let's start with one of these
|
||||
built-in admission controllers and then talk about how you can write
|
||||
your own admission controller.
|
||||
1. Resource validation and defaulting (builds around `apis.Validatable` and
|
||||
`apis.Defaultable` under `knative.dev/pkg/apis`).
|
||||
2. ConfigMap validation, which builds around similar patterns from
|
||||
`knative.dev/pkg/configmap` (in particular the `store` concept)
|
||||
|
||||
To illustrate standing up the webhook, let's start with one of these built-in
|
||||
admission controllers and then talk about how you can write your own admission
|
||||
controller.
|
||||
|
||||
## Standing up a Webhook from an Admission Controller
|
||||
|
||||
|
@ -81,9 +81,10 @@ There is also a config map validation admission controller built in under
|
|||
## Writing new Admission Controllers
|
||||
|
||||
To implement your own admission controller akin to the resource defaulting and
|
||||
validation controller above, you implement a `knative.dev/pkg/controller.Reconciler` as with
|
||||
any you would with any other type of controller, but the `Reconciler` that gets
|
||||
embedded in the `*controller.Impl` should *also* implement:
|
||||
validation controller above, you implement a
|
||||
`knative.dev/pkg/controller.Reconciler` as with any you would with any other
|
||||
type of controller, but the `Reconciler` that gets embedded in the
|
||||
`*controller.Impl` should _also_ implement:
|
||||
|
||||
```go
|
||||
// AdmissionController provides the interface for different admission controllers
|
||||
|
@ -96,6 +97,6 @@ type AdmissionController interface {
|
|||
}
|
||||
```
|
||||
|
||||
The `Reconciler` part is responsible for the mutating or validating webhook configuration.
|
||||
The `AdmissionController` part is responsible for guiding request dispatch (`Path()`) and
|
||||
handling admission requests (`Admit()`).
|
||||
The `Reconciler` part is responsible for the mutating or validating webhook
|
||||
configuration. The `AdmissionController` part is responsible for guiding request
|
||||
dispatch (`Path()`) and handling admission requests (`Admit()`).
|
||||
|
|
Loading…
Reference in New Issue