diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 949523346..9e3cfbb1e 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -576,11 +576,11 @@ }, { "ImportPath": "k8s.io/cli-runtime", - "Rev": "f26b0857ea34" + "Rev": "058578b5f081" }, { "ImportPath": "k8s.io/client-go", - "Rev": "7b31ec144ad8" + "Rev": "b173caf5988c" }, { "ImportPath": "k8s.io/code-generator", diff --git a/go.mod b/go.mod index 9904f42e6..c3bbf72b5 100644 --- a/go.mod +++ b/go.mod @@ -39,8 +39,8 @@ require ( gotest.tools v2.2.0+incompatible // indirect k8s.io/api v0.0.0-20200306151724-0a52b7486422 k8s.io/apimachinery v0.0.0-20200306202157-ac276fc34867 - k8s.io/cli-runtime v0.0.0-20200304164305-f26b0857ea34 - k8s.io/client-go v0.0.0-20200307002525-7b31ec144ad8 + k8s.io/cli-runtime v0.0.0-20200307004336-058578b5f081 + k8s.io/client-go v0.0.0-20200307002526-b173caf5988c k8s.io/component-base v0.0.0-20200305122702-2cff9454e9d1 k8s.io/klog v1.0.0 k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c @@ -56,8 +56,8 @@ replace ( golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13 k8s.io/api => k8s.io/api v0.0.0-20200306151724-0a52b7486422 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200306202157-ac276fc34867 - k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200304164305-f26b0857ea34 - k8s.io/client-go => k8s.io/client-go v0.0.0-20200307002525-7b31ec144ad8 + k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200307004336-058578b5f081 + k8s.io/client-go => k8s.io/client-go v0.0.0-20200307002526-b173caf5988c k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200306081859-6a048a382944 k8s.io/component-base => k8s.io/component-base v0.0.0-20200305122702-2cff9454e9d1 k8s.io/metrics => k8s.io/metrics v0.0.0-20200304084343-4cf3f455bf52 diff --git a/go.sum b/go.sum index b19489376..d1c5bf8af 100644 --- a/go.sum +++ b/go.sum @@ -308,8 +308,8 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.0.0-20200306151724-0a52b7486422/go.mod h1:4bHpvwcObcdIFmIlnwDdJznMrytQbQCBpJvQgh+FnrA= k8s.io/apimachinery v0.0.0-20200306202157-ac276fc34867/go.mod h1:5X8oEhnd931nEg6/Nkumo00nT6ZsCLp2h7Xwd7Ym6P4= -k8s.io/cli-runtime v0.0.0-20200304164305-f26b0857ea34/go.mod h1:1K5QYF8MW308AOVMg+33nPuGTXZadAOYUrG0HCZQoHM= -k8s.io/client-go v0.0.0-20200307002525-7b31ec144ad8/go.mod h1:9W6NBDAP22mJEhrKYXmPsL6dTQqczIp6+4GZcpWDlKs= +k8s.io/cli-runtime v0.0.0-20200307004336-058578b5f081/go.mod h1:IGv1kvgynL+0m4h0lIHl0H4+x9mvhAl0W9rGCuKu2ic= +k8s.io/client-go v0.0.0-20200307002526-b173caf5988c/go.mod h1:9W6NBDAP22mJEhrKYXmPsL6dTQqczIp6+4GZcpWDlKs= k8s.io/code-generator v0.0.0-20200306081859-6a048a382944/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/component-base v0.0.0-20200305122702-2cff9454e9d1/go.mod h1:3RwNWXDYjUOPPeNNQE+7cPPoWAnnL/938q4q+jnBTNk= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= diff --git a/pkg/cmd/apply/prune.go b/pkg/cmd/apply/prune.go index 86598818a..487837056 100644 --- a/pkg/cmd/apply/prune.go +++ b/pkg/cmd/apply/prune.go @@ -17,6 +17,7 @@ limitations under the License. package apply import ( + "context" "fmt" "io" "strings" @@ -97,7 +98,7 @@ func (p *pruner) pruneAll(o *ApplyOptions) error { func (p *pruner) prune(namespace string, mapping *meta.RESTMapping) error { objList, err := p.dynamicClient.Resource(mapping.Resource). Namespace(namespace). - List(metav1.ListOptions{ + List(context.TODO(), metav1.ListOptions{ LabelSelector: p.labelSelector, FieldSelector: p.fieldSelector, }) @@ -145,9 +146,9 @@ func (p *pruner) delete(namespace, name string, mapping *meta.RESTMapping) error } func runDelete(namespace, name string, mapping *meta.RESTMapping, c dynamic.Interface, cascade bool, gracePeriod int, serverDryRun bool) error { - options := &metav1.DeleteOptions{} + options := metav1.DeleteOptions{} if gracePeriod >= 0 { - options = metav1.NewDeleteOptions(int64(gracePeriod)) + options = *metav1.NewDeleteOptions(int64(gracePeriod)) } if serverDryRun { options.DryRun = []string{metav1.DryRunAll} @@ -157,7 +158,7 @@ func runDelete(namespace, name string, mapping *meta.RESTMapping, c dynamic.Inte policy = metav1.DeletePropagationOrphan } options.PropagationPolicy = &policy - return c.Resource(mapping.Resource).Namespace(namespace).Delete(name, options) + return c.Resource(mapping.Resource).Namespace(namespace).Delete(context.TODO(), name, options) } type pruneResource struct { diff --git a/pkg/cmd/create/create.go b/pkg/cmd/create/create.go index 2ed639cda..71a0dc401 100644 --- a/pkg/cmd/create/create.go +++ b/pkg/cmd/create/create.go @@ -17,6 +17,7 @@ limitations under the License. package create import ( + "context" "fmt" "io" "net/url" @@ -451,7 +452,7 @@ func (o *CreateSubcommandOptions) Run() error { } createOptions.DryRun = []string{metav1.DryRunAll} } - actualObject, err := o.DynamicClient.Resource(mapping.Resource).Namespace(o.Namespace).Create(asUnstructured, createOptions) + actualObject, err := o.DynamicClient.Resource(mapping.Resource).Namespace(o.Namespace).Create(context.TODO(), asUnstructured, createOptions) if err != nil { return err } diff --git a/pkg/cmd/rollout/rollout_status.go b/pkg/cmd/rollout/rollout_status.go index a44aea40b..23f07253a 100644 --- a/pkg/cmd/rollout/rollout_status.go +++ b/pkg/cmd/rollout/rollout_status.go @@ -192,11 +192,11 @@ func (o *RolloutStatusOptions) Run() error { lw := &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector - return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(options) + return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { options.FieldSelector = fieldSelector - return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(options) + return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(context.TODO(), options) }, } diff --git a/pkg/cmd/wait/wait.go b/pkg/cmd/wait/wait.go index 3a0840155..2bb0db352 100644 --- a/pkg/cmd/wait/wait.go +++ b/pkg/cmd/wait/wait.go @@ -263,7 +263,7 @@ func IsDeleted(info *resource.Info, o *WaitOptions) (runtime.Object, bool, error nameSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String() // List with a name field selector to get the current resourceVersion to watch from (not the object's resourceVersion) - gottenObjList, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(metav1.ListOptions{FieldSelector: nameSelector}) + gottenObjList, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: nameSelector}) if apierrors.IsNotFound(err) { return info.Object, true, nil } @@ -289,7 +289,7 @@ func IsDeleted(info *resource.Info, o *WaitOptions) (runtime.Object, bool, error watchOptions := metav1.ListOptions{} watchOptions.FieldSelector = nameSelector watchOptions.ResourceVersion = gottenObjList.GetResourceVersion() - objWatch, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(watchOptions) + objWatch, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(context.TODO(), watchOptions) if err != nil { return gottenObj, false, err } @@ -361,7 +361,7 @@ func (w ConditionalWait) IsConditionMet(info *resource.Info, o *WaitOptions) (ru var gottenObj *unstructured.Unstructured // List with a name field selector to get the current resourceVersion to watch from (not the object's resourceVersion) - gottenObjList, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(metav1.ListOptions{FieldSelector: nameSelector}) + gottenObjList, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: nameSelector}) resourceVersion := "" switch { @@ -384,7 +384,7 @@ func (w ConditionalWait) IsConditionMet(info *resource.Info, o *WaitOptions) (ru watchOptions := metav1.ListOptions{} watchOptions.FieldSelector = nameSelector watchOptions.ResourceVersion = resourceVersion - objWatch, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(watchOptions) + objWatch, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(context.TODO(), watchOptions) if err != nil { return gottenObj, false, err } diff --git a/pkg/describe/describe.go b/pkg/describe/describe.go index 9667259b3..f72b1bb65 100644 --- a/pkg/describe/describe.go +++ b/pkg/describe/describe.go @@ -247,7 +247,7 @@ type genericDescriber struct { } func (g *genericDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (output string, err error) { - obj, err := g.dynamic.Resource(g.mapping.Resource).Namespace(namespace).Get(name, metav1.GetOptions{}) + obj, err := g.dynamic.Resource(g.mapping.Resource).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{}) if err != nil { return "", err }