@@ -58,11 +58,6 @@ func (ip *informerCache) Get(ctx context.Context, key client.ObjectKey, out runt
58
58
return err
59
59
}
60
60
61
- ctx , cancelFunc := addTimeout (ctx )
62
- if cancelFunc != nil {
63
- defer cancelFunc ()
64
- }
65
- cache , err := ip .InformersMap .Get (ctx , gvk , out )
66
61
started , cache , err := ip .InformersMap .Get (ctx , gvk , out )
67
62
if err != nil {
68
63
return err
@@ -107,10 +102,6 @@ func (ip *informerCache) List(ctx context.Context, out runtime.Object, opts ...c
107
102
}
108
103
}
109
104
110
- ctx , cancelFunc := addTimeout (ctx )
111
- if cancelFunc != nil {
112
- defer cancelFunc ()
113
- }
114
105
started , cache , err := ip .InformersMap .Get (ctx , gvk , cacheTypeObj )
115
106
if err != nil {
116
107
return err
@@ -123,47 +114,29 @@ func (ip *informerCache) List(ctx context.Context, out runtime.Object, opts ...c
123
114
return cache .Reader .List (ctx , out , opts ... )
124
115
}
125
116
126
- // addTimeout adds a default 30 second timeout to a child contxt
127
- // if one does not exist.
128
- func addTimeout (ctx context.Context ) (context.Context , context.CancelFunc ) {
129
- var cancelFunc context.CancelFunc
130
- if _ , ok := ctx .Deadline (); ! ok {
131
- ctx , cancelFunc = context .WithTimeout (ctx , 30 * time .Second )
132
- }
133
- return ctx , cancelFunc
134
- }
135
-
136
117
// GetInformerForKind returns the informer for the GroupVersionKind
137
- // Will timeout after 30 seconds if the informer is new and can not be
138
- // synced.
139
118
func (ip * informerCache ) GetInformerForKind (gvk schema.GroupVersionKind ) (Informer , error ) {
140
119
// Map the gvk to an object
141
120
obj , err := ip .Scheme .New (gvk )
142
121
if err != nil {
143
122
return nil , err
144
123
}
145
- ctx , cancelFunc := addTimeout (context .TODO ())
146
- // There will never be a nil cancelFunc
147
- defer cancelFunc ()
148
- _ , i , err := ip .InformersMap .Get (ctx , gvk , obj )
124
+
125
+ _ , i , err := ip .InformersMap .Get (context .TODO (), gvk , obj )
149
126
if err != nil {
150
127
return nil , err
151
128
}
152
129
return i .Informer , err
153
130
}
154
131
155
132
// GetInformer returns the informer for the obj
156
- // Will timeout after 30 seconds if the informer is new and can not be
157
- // synced.
158
133
func (ip * informerCache ) GetInformer (obj runtime.Object ) (Informer , error ) {
159
134
gvk , err := apiutil .GVKForObject (obj , ip .Scheme )
160
135
if err != nil {
161
136
return nil , err
162
137
}
163
- ctx , cancelFunc := addTimeout (context .TODO ())
164
- // There will never be a nil cancelFunc
165
- defer cancelFunc ()
166
- _ , i , err := ip .InformersMap .Get (ctx , gvk , obj )
138
+
139
+ _ , i , err := ip .InformersMap .Get (context .TODO (), gvk , obj )
167
140
if err != nil {
168
141
return nil , err
169
142
}
0 commit comments