@@ -12,7 +12,7 @@ _delopts(; kwargs...) = Typedefs.MetaV1.DeleteOptions(; preconditions=Typedefs.M
12
12
_kubectx (ctx:: KuberContext ) = ctx
13
13
_kubectx (ctx:: KuberWatchContext ) = ctx. ctx
14
14
15
- function _get_apictx (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol , apiversion:: Union{String,Nothing} ; max_tries:: Int = 1 )
15
+ function _get_apictx (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol , apiversion:: Union{String,Nothing} ; max_tries:: Int = retries (ctx) )
16
16
kubectx = _kubectx (ctx)
17
17
kubectx. initialized || set_api_versions! (kubectx; max_tries= max_tries)
18
18
50
50
function list (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol , name:: String ;
51
51
apiversion:: Union{String,Nothing} = nothing ,
52
52
namespace:: Union{String,Nothing} = _kubectx (ctx). namespace,
53
- max_tries:: Int = 1 ,
53
+ max_tries:: Int = retries (ctx) ,
54
54
watch= isa (ctx, KuberWatchContext),
55
55
resourceVersion= nothing ,
56
56
kwargs... )
@@ -71,7 +71,9 @@ function list(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol, name::Strin
71
71
end
72
72
73
73
if ! watch || resourceVersion === nothing
74
- result = @retry_on_error apicall (apictx, args... ; kwargs... )
74
+ result = k8s_retry (; max_tries= max_tries) do
75
+ apicall (apictx, args... ; kwargs... )
76
+ end
75
77
end
76
78
77
79
# if not watching, retuen the first result
@@ -83,13 +85,15 @@ function list(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol, name::Strin
83
85
end
84
86
85
87
# start watch and return the HTTP response object on completion
86
- return @retry_on_error apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, kwargs... )
88
+ return k8s_retry (; max_tries= max_tries) do
89
+ apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, kwargs... )
90
+ end
87
91
end
88
92
89
93
function list (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol ;
90
94
apiversion:: Union{String,Nothing} = nothing ,
91
95
namespace:: Union{String,Nothing} = _kubectx (ctx). namespace,
92
- max_tries:: Int = 1 ,
96
+ max_tries:: Int = retries (ctx) ,
93
97
watch= isa (ctx, KuberWatchContext),
94
98
resourceVersion= nothing ,
95
99
kwargs... )
@@ -111,7 +115,9 @@ function list(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol;
111
115
end
112
116
113
117
if ! watch || resourceVersion === nothing
114
- result = @retry_on_error apicall (apictx, args... ; kwargs... )
118
+ result = k8s_retry (; max_tries= max_tries) do
119
+ apicall (apictx, args... ; kwargs... )
120
+ end
115
121
end
116
122
117
123
# if not watching, retuen the first result
@@ -123,12 +129,14 @@ function list(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol;
123
129
end
124
130
125
131
# start watch and return the HTTP response object on completion
126
- return @retry_on_error apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, kwargs... )
132
+ return k8s_retry (; max_tries= max_tries) do
133
+ apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, kwargs... )
134
+ end
127
135
end
128
136
129
137
function get (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol , name:: String ;
130
138
apiversion:: Union{String,Nothing} = nothing ,
131
- max_tries:: Integer = 1 ,
139
+ max_tries:: Integer = retries (ctx) ,
132
140
watch= isa (ctx, KuberWatchContext),
133
141
resourceVersion= nothing ,
134
142
kwargs... )
@@ -146,7 +154,9 @@ function get(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol, name::String
146
154
end
147
155
148
156
if ! watch || resourceVersion === nothing
149
- result = @retry_on_error apicall (apictx, args... ; kwargs... )
157
+ result = k8s_retry (; max_tries= max_tries) do
158
+ apicall (apictx, args... ; kwargs... )
159
+ end
150
160
end
151
161
152
162
# if not watching, retuen the first result
@@ -158,14 +168,16 @@ function get(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol, name::String
158
168
end
159
169
160
170
# start watch and return the HTTP response object on completion
161
- return @retry_on_error apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, kwargs... )
171
+ return k8s_retry (; max_tries= max_tries) do
172
+ apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, kwargs... )
173
+ end
162
174
end
163
175
164
176
function get (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol ;
165
177
apiversion:: Union{String,Nothing} = nothing ,
166
178
label_selector= nothing ,
167
179
namespace:: Union{String,Nothing} = _kubectx (ctx). namespace,
168
- max_tries:: Integer = 1 ,
180
+ max_tries:: Integer = retries (ctx) ,
169
181
watch= isa (ctx, KuberWatchContext),
170
182
resourceVersion= nothing ,
171
183
kwargs... )
@@ -185,7 +197,9 @@ function get(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol;
185
197
end
186
198
187
199
if ! watch || resourceVersion === nothing
188
- result = @retry_on_error apicall (apictx, args... ; labelSelector= label_selector, kwargs... )
200
+ result = k8s_retry (; max_tries= max_tries) do
201
+ apicall (apictx, args... ; labelSelector= label_selector, kwargs... )
202
+ end
189
203
end
190
204
191
205
# if not watching, retuen the first result
@@ -197,50 +211,62 @@ function get(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol;
197
211
end
198
212
199
213
# start watch and return the HTTP response object on completion
200
- return @retry_on_error apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, labelSelector= label_selector, kwargs... )
214
+ return k8s_retry (; max_tries= max_tries) do
215
+ apicall (apictx, eventstream, args... ; watch= watch, resourceVersion= resourceVersion, labelSelector= label_selector, kwargs... )
216
+ end
201
217
end
202
218
203
219
function watch (ctx:: KuberContext , O:: Symbol , outstream:: Channel , name:: String ;
204
220
apiversion:: Union{String,Nothing} = nothing ,
205
221
namespace:: Union{String,Nothing} = ctx. namespace,
206
- max_tries:: Int = 1 ,
207
- resourceVersion= nothing ,
222
+ max_tries:: Int = retries (ctx),
208
223
kwargs... )
209
224
apictx = _get_apictx (ctx, O, apiversion; max_tries= max_tries)
210
225
namespaced = (namespace != = nothing ) && ! isempty (namespace)
211
226
allnamespaces = namespaced && (namespace == " *" )
212
227
213
228
if allnamespaces
214
229
apicall = eval (Symbol (" watch$(O) ForAllNamespaces" ))
215
- return @retry_on_error apicall (apictx, outstream, name; kwargs... )
230
+ return k8s_retry (; max_tries= max_tries) do
231
+ apicall (apictx, outstream, name; kwargs... )
232
+ end
216
233
elseif namespaced
217
234
apicall = eval (Symbol (" watchNamespaced$O " ))
218
- return @retry_on_error apicall (apictx, outstream, name, namespace; kwargs... )
235
+ return k8s_retry (; max_tries= max_tries) do
236
+ apicall (apictx, outstream, name, namespace; kwargs... )
237
+ end
219
238
else
220
239
apicall = eval (Symbol (" watch$O " ))
221
- return @retry_on_error apicall (apictx, outstream, name; kwargs... )
240
+ return k8s_retry (; max_tries= max_tries) do
241
+ apicall (apictx, outstream, name; kwargs... )
242
+ end
222
243
end
223
244
end
224
245
225
246
function watch (ctx:: KuberContext , O:: Symbol , outstream:: Channel ;
226
247
apiversion:: Union{String,Nothing} = nothing ,
227
248
namespace:: Union{String,Nothing} = ctx. namespace,
228
- max_tries:: Int = 1 ,
229
- resourceVersion= nothing ,
249
+ max_tries:: Int = retries (ctx),
230
250
kwargs... )
231
251
apictx = _get_apictx (ctx, O, apiversion; max_tries= max_tries)
232
252
namespaced = (namespace != = nothing ) && ! isempty (namespace)
233
253
allnamespaces = namespaced && (namespace == " *" )
234
254
235
255
if allnamespaces
236
256
apicall = eval (Symbol (" watch$(O) ForAllNamespaces" ))
237
- return @retry_on_error apicall (apictx, outstream; kwargs... )
257
+ return k8s_retry (; max_tries= max_tries) do
258
+ apicall (apictx, outstream; kwargs... )
259
+ end
238
260
elseif namespaced
239
261
apicall = eval (Symbol (" watchNamespaced$O " ))
240
- return @retry_on_error apicall (apictx, outstream, namespace; kwargs... )
262
+ return k8s_retry (; max_tries= max_tries) do
263
+ apicall (apictx, outstream, namespace; kwargs... )
264
+ end
241
265
else
242
266
apicall = eval (Symbol (" watch$O " ))
243
- return @retry_on_error apicall (apictx, outstream; kwargs... )
267
+ return k8s_retry (; max_tries= max_tries) do
268
+ apicall (apictx, outstream; kwargs... )
269
+ end
244
270
end
245
271
end
246
272
0 commit comments