Merge pull request #3080 from weaveworks/stop-polling-k8s

Remove flag -probe.kubernetes.interval and stop re-syncing Kubernetes data
This commit is contained in:
Bryan Boreham
2018-02-26 10:43:43 +00:00
committed by GitHub
2 changed files with 3 additions and 7 deletions

View File

@@ -48,7 +48,6 @@ type Client interface {
type client struct {
quit chan struct{}
resyncPeriod time.Duration
client *kubernetes.Clientset
podStore cache.Store
serviceStore cache.Store
@@ -66,7 +65,6 @@ type client struct {
// ClientConfig establishes the configuration for the kubernetes client
type ClientConfig struct {
Interval time.Duration
CertificateAuthority string
ClientCertificate string
ClientKey string
@@ -129,9 +127,8 @@ func NewClient(config ClientConfig) (Client, error) {
}
result := &client{
quit: make(chan struct{}),
resyncPeriod: config.Interval,
client: c,
quit: make(chan struct{}),
client: c,
}
result.podStore = NewEventStore(result.triggerPodWatches, cache.MetaNamespaceKeyFunc)
@@ -225,7 +222,7 @@ func (c *client) runReflectorUntil(resource string, store cache.Store) {
return true, nil
}
lw := cache.NewListWatchFromClient(kclient, resource, metav1.NamespaceAll, fields.Everything())
r = cache.NewReflector(lw, itemType, store, c.resyncPeriod)
r = cache.NewReflector(lw, itemType, store, 0)
}
select {

View File

@@ -303,7 +303,6 @@ func setupFlags(flags *flags) {
// K8s
flag.BoolVar(&flags.probe.kubernetesEnabled, "probe.kubernetes", false, "collect kubernetes-related attributes for containers")
flag.DurationVar(&flags.probe.kubernetesClientConfig.Interval, "probe.kubernetes.interval", 10*time.Second, "how often to do a full resync of the kubernetes data")
flag.StringVar(&flags.probe.kubernetesClientConfig.Server, "probe.kubernetes.api", "", "The address and port of the Kubernetes API server (deprecated in favor of equivalent probe.kubernetes.server)")
flag.StringVar(&flags.probe.kubernetesClientConfig.CertificateAuthority, "probe.kubernetes.certificate-authority", "", "Path to a cert. file for the certificate authority")
flag.StringVar(&flags.probe.kubernetesClientConfig.ClientCertificate, "probe.kubernetes.client-certificate", "", "Path to a client certificate file for TLS")