diff options
author | 2020-03-30 11:10:41 -0700 | |
---|---|---|
committer | 2020-03-30 11:10:41 -0700 | |
commit | ebbfffaf9df7bdf3bab39c587441e9460aa4f9ef (patch) | |
tree | 7cee159d9c690122b02554c2eb8d5038099dacd5 /plugin/kubernetes/watch.go | |
parent | 8bbfa19223e7585084acfee58bf7a611ecb4a3d3 (diff) | |
download | coredns-ebbfffaf9df7bdf3bab39c587441e9460aa4f9ef.tar.gz coredns-ebbfffaf9df7bdf3bab39c587441e9460aa4f9ef.tar.zst coredns-ebbfffaf9df7bdf3bab39c587441e9460aa4f9ef.zip |
Update k8s.io/[api|apimachinery|client-go] to v0.18.0 (#3796)
* Update k8s.io/[api|apimachinery|client-go] to v0.18.0
This PR updates k8s.io/[api|apimachinery|client-go] to v0.18.0
This PR closes 3791
This PR closes 3792
This PR closes 3793
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Fix test failures
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Fix failed tests
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Fix test failure
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to '')
-rw-r--r-- | plugin/kubernetes/watch.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugin/kubernetes/watch.go b/plugin/kubernetes/watch.go index fd6e68c8c..d15ed4cf9 100644 --- a/plugin/kubernetes/watch.go +++ b/plugin/kubernetes/watch.go @@ -1,23 +1,25 @@ package kubernetes import ( + "context" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" ) -func serviceWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { +func serviceWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { return func(options meta.ListOptions) (watch.Interface, error) { if s != nil { options.LabelSelector = s.String() } - w, err := c.CoreV1().Services(ns).Watch(options) + w, err := c.CoreV1().Services(ns).Watch(ctx, options) return w, err } } -func podWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { +func podWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { return func(options meta.ListOptions) (watch.Interface, error) { if s != nil { options.LabelSelector = s.String() @@ -26,27 +28,27 @@ func podWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(opt options.FieldSelector = options.FieldSelector + "," } options.FieldSelector = options.FieldSelector + "status.phase!=Succeeded,status.phase!=Failed,status.phase!=Unknown" - w, err := c.CoreV1().Pods(ns).Watch(options) + w, err := c.CoreV1().Pods(ns).Watch(ctx, options) return w, err } } -func endpointsWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { +func endpointsWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { return func(options meta.ListOptions) (watch.Interface, error) { if s != nil { options.LabelSelector = s.String() } - w, err := c.CoreV1().Endpoints(ns).Watch(options) + w, err := c.CoreV1().Endpoints(ns).Watch(ctx, options) return w, err } } -func namespaceWatchFunc(c kubernetes.Interface, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { +func namespaceWatchFunc(ctx context.Context, c kubernetes.Interface, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) { return func(options meta.ListOptions) (watch.Interface, error) { if s != nil { options.LabelSelector = s.String() } - w, err := c.CoreV1().Namespaces().Watch(options) + w, err := c.CoreV1().Namespaces().Watch(ctx, options) return w, err } } |