Auto-update dependencies (#188)

Produced via:
  `dep ensure -update knative.dev/test-infra knative.dev/pkg`
/assign n3wscott
/cc n3wscott
This commit is contained in:
Matt Moore 2020-01-23 08:18:24 -08:00 committed by Knative Prow Robot
parent 853d602284
commit e111e2aca4
3 changed files with 29 additions and 11 deletions

4
Gopkg.lock generated
View File

@ -966,7 +966,7 @@
[[projects]]
branch = "master"
digest = "1:6a467fb3198c259dffa78ca86c8b7acfdaa73db62439d21b135558c6dab76473"
digest = "1:58629d6925d6d46c36a962612e40ed0accf8cd74f8cf6675517d44c6589c8827"
name = "knative.dev/pkg"
packages = [
"apis",
@ -985,7 +985,7 @@
"metrics/metricskey",
]
pruneopts = "T"
revision = "4e81bc3c320ff3e4ed0ab600963a8685b629c09e"
revision = "62801f1d34cf8cf71e45f6c398a9a095a74db637"
[[projects]]
branch = "master"

View File

@ -14,6 +14,7 @@ limitations under the License.
package metrics
import (
"errors"
"fmt"
"sync"
@ -79,6 +80,31 @@ func UpdateExporterFromConfigMap(component string, logger *zap.SugaredLogger) fu
}
}
// UpdateExporterFromConfigMapWithOpts returns a helper func that can be used to update the exporter
// when a config map is updated.
// opts.Component must be present.
// opts.ConfigMap must not be present as the value from the ConfigMap will be used instead.
func UpdateExporterFromConfigMapWithOpts(opts ExporterOptions, logger *zap.SugaredLogger) (func(configMap *corev1.ConfigMap), error) {
if opts.Component == "" {
return nil, errors.New("UpdateExporterFromConfigMapWithDefaults must provide Component")
}
if opts.ConfigMap != nil {
return nil, errors.New("UpdateExporterFromConfigMapWithDefaults doesn't allow defaulting ConfigMap")
}
domain := opts.Domain
if domain == "" {
domain = Domain()
}
return func(configMap *corev1.ConfigMap) {
UpdateExporter(ExporterOptions{
Domain: domain,
Component: opts.Component,
ConfigMap: configMap.Data,
PrometheusPort: opts.PrometheusPort,
}, logger)
}, nil
}
// UpdateExporter updates the exporter based on the given ExporterOptions.
// This is a thread-safe function. The entire series of operations is locked
// to prevent a race condition between reading the current configuration

View File

@ -28,8 +28,6 @@ import (
"github.com/markbates/inflect"
admissionv1beta1 "k8s.io/api/admission/v1beta1"
admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
@ -206,13 +204,7 @@ func (ac *Reconciler) Admit(ctx context.Context, request *admissionv1beta1.Admis
func (ac *Reconciler) reconcileMutatingWebhook(ctx context.Context, caCert []byte) error {
// Build a deduplicated list of all of the GVKs we see.
// We seed the Kubernetes built-ins.
gks := map[schema.GroupKind]sets.String{
appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind(): sets.NewString("v1"),
appsv1.SchemeGroupVersion.WithKind("StatefulSet").GroupKind(): sets.NewString("v1"),
appsv1.SchemeGroupVersion.WithKind("DaemonSet").GroupKind(): sets.NewString("v1"),
batchv1.SchemeGroupVersion.WithKind("Job").GroupKind(): sets.NewString("v1"),
}
gks := map[schema.GroupKind]sets.String{}
// When reconciling the webhook, enumerate all of the bindings, so that
// we can index them to efficiently respond to webhook requests.