Compare commits

..

1 Commits

Author SHA1 Message Date
Kubernetes Publisher
78295b709e Fix Godeps.json to point to kubernetes-1.12.6 tags 2019-02-26 17:41:27 +00:00
2 changed files with 58 additions and 33 deletions

64
Godeps/Godeps.json generated
View File

@@ -272,131 +272,131 @@
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/apps/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/authentication/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/authorization/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/autoscaling/v2beta2",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/batch/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/coordination/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/core/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/networking/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/rbac/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/scheduling/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/storage/v1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "d89493788bfe2f881a1d1a93e7897617e8e76125"
"Rev": "145d52631d00cbfe68490d19ae4f0f501fd31a95"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",

View File

@@ -24,8 +24,10 @@ import (
"net"
"net/url"
"reflect"
"strconv"
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
@@ -93,10 +95,17 @@ func NewReflector(lw ListerWatcher, expectedType interface{}, store Store, resyn
return NewNamedReflector(naming.GetNameFromCallsite(internalPackages...), lw, expectedType, store, resyncPeriod)
}
// reflectorDisambiguator is used to disambiguate started reflectors.
// initialized to an unstable value to ensure meaning isn't attributed to the suffix.
var reflectorDisambiguator = int64(time.Now().UnixNano() % 12345)
// NewNamedReflector same as NewReflector, but with a specified name for logging
func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{}, store Store, resyncPeriod time.Duration) *Reflector {
reflectorSuffix := atomic.AddInt64(&reflectorDisambiguator, 1)
r := &Reflector{
name: name,
name: name,
// we need this to be unique per process (some names are still the same) but obvious who it belongs to
metrics: newReflectorMetrics(makeValidPrometheusMetricLabel(fmt.Sprintf("reflector_"+name+"_%d", reflectorSuffix))),
listerWatcher: lw,
store: store,
expectedType: reflect.TypeOf(expectedType),
@@ -164,10 +173,13 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
// to be served from cache and potentially be delayed relative to
// etcd contents. Reflector framework will catch up via Watch() eventually.
options := metav1.ListOptions{ResourceVersion: "0"}
r.metrics.numberOfLists.Inc()
start := r.clock.Now()
list, err := r.listerWatcher.List(options)
if err != nil {
return fmt.Errorf("%s: Failed to list %v: %v", r.name, r.expectedType, err)
}
r.metrics.listDuration.Observe(time.Since(start).Seconds())
listMetaInterface, err := meta.ListAccessor(list)
if err != nil {
return fmt.Errorf("%s: Unable to understand list result %#v: %v", r.name, list, err)
@@ -177,6 +189,7 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
if err != nil {
return fmt.Errorf("%s: Unable to understand list result %#v (%v)", r.name, list, err)
}
r.metrics.numberOfItemsInList.Observe(float64(len(items)))
if err := r.syncWith(items, resourceVersion); err != nil {
return fmt.Errorf("%s: Unable to sync list result: %v", r.name, err)
}
@@ -226,6 +239,7 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
TimeoutSeconds: &timeoutSeconds,
}
r.metrics.numberOfWatches.Inc()
w, err := r.listerWatcher.Watch(options)
if err != nil {
switch err {
@@ -277,6 +291,11 @@ func (r *Reflector) watchHandler(w watch.Interface, resourceVersion *string, err
// Stopping the watcher should be idempotent and if we return from this function there's no way
// we're coming back in with the same watch interface.
defer w.Stop()
// update metrics
defer func() {
r.metrics.numberOfItemsInWatch.Observe(float64(eventCount))
r.metrics.watchDuration.Observe(time.Since(start).Seconds())
}()
loop:
for {
@@ -332,6 +351,7 @@ loop:
watchDuration := r.clock.Now().Sub(start)
if watchDuration < 1*time.Second && eventCount == 0 {
r.metrics.numberOfShortWatches.Inc()
return fmt.Errorf("very short watch: %s: Unexpected watch close - watch lasted less than a second and no items received", r.name)
}
glog.V(4).Infof("%s: Watch close - %v total %v items received", r.name, r.expectedType, eventCount)
@@ -350,4 +370,9 @@ func (r *Reflector) setLastSyncResourceVersion(v string) {
r.lastSyncResourceVersionMutex.Lock()
defer r.lastSyncResourceVersionMutex.Unlock()
r.lastSyncResourceVersion = v
rv, err := strconv.Atoi(v)
if err == nil {
r.metrics.lastResourceVersion.Set(float64(rv))
}
}