mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-03-29 02:12:44 +08:00
./hack/update-codegen.sh
Kubernetes-commit: 325a54f73dcdc5fc7a7d47bd78791abcba93456a
This commit is contained in:
parent
66fc52bd52
commit
6e82beaa11
@ -19,6 +19,7 @@ limitations under the License.
|
|||||||
package fake
|
package fake
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
@ -49,9 +50,13 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
|||||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||||
|
var opts metav1.ListOptions
|
||||||
|
if watchActcion, ok := action.(testing.WatchActionImpl); ok {
|
||||||
|
opts = watchActcion.ListOptions
|
||||||
|
}
|
||||||
gvr := action.GetResource()
|
gvr := action.GetResource()
|
||||||
ns := action.GetNamespace()
|
ns := action.GetNamespace()
|
||||||
watch, err := o.Watch(gvr, ns)
|
watch, err := o.Watch(gvr, ns, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user