@@ -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 = retries (ctx))
15
+ function _get_apictx (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol , apiversion:: Union{String,Nothing} ; max_tries:: Int = retries (ctx, false ))
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 = retries (ctx),
53
+ max_tries:: Int = retries (ctx, false ),
54
54
watch= isa (ctx, KuberWatchContext),
55
55
resourceVersion= nothing ,
56
56
kwargs... )
@@ -76,7 +76,7 @@ function list(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol, name::Strin
76
76
end
77
77
end
78
78
79
- # if not watching, retuen the first result
79
+ # if not watching, return the first result
80
80
watch || (return result)
81
81
if result != = nothing
82
82
resourceVersion = result. metadata. resourceVersion
93
93
function list (ctx:: Union{KuberContext,KuberWatchContext} , O:: Symbol ;
94
94
apiversion:: Union{String,Nothing} = nothing ,
95
95
namespace:: Union{String,Nothing} = _kubectx (ctx). namespace,
96
- max_tries:: Int = retries (ctx),
96
+ max_tries:: Int = retries (ctx, false ),
97
97
watch= isa (ctx, KuberWatchContext),
98
98
resourceVersion= nothing ,
99
99
kwargs... )
@@ -177,7 +177,7 @@ function get(ctx::Union{KuberContext,KuberWatchContext}, O::Symbol;
177
177
apiversion:: Union{String,Nothing} = nothing ,
178
178
label_selector= nothing ,
179
179
namespace:: Union{String,Nothing} = _kubectx (ctx). namespace,
180
- max_tries:: Integer = retries (ctx),
180
+ max_tries:: Integer = retries (ctx, false ),
181
181
watch= isa (ctx, KuberWatchContext),
182
182
resourceVersion= nothing ,
183
183
kwargs... )
219
219
function watch (ctx:: KuberContext , O:: Symbol , outstream:: Channel , name:: String ;
220
220
apiversion:: Union{String,Nothing} = nothing ,
221
221
namespace:: Union{String,Nothing} = ctx. namespace,
222
- max_tries:: Int = retries (ctx),
222
+ max_tries:: Int = retries (ctx, false ),
223
223
kwargs... )
224
224
apictx = _get_apictx (ctx, O, apiversion; max_tries= max_tries)
225
225
namespaced = (namespace != = nothing ) && ! isempty (namespace)
246
246
function watch (ctx:: KuberContext , O:: Symbol , outstream:: Channel ;
247
247
apiversion:: Union{String,Nothing} = nothing ,
248
248
namespace:: Union{String,Nothing} = ctx. namespace,
249
- max_tries:: Int = retries (ctx),
249
+ max_tries:: Int = retries (ctx, false ),
250
250
kwargs... )
251
251
apictx = _get_apictx (ctx, O, apiversion; max_tries= max_tries)
252
252
namespaced = (namespace != = nothing ) && ! isempty (namespace)
@@ -270,58 +270,70 @@ function watch(ctx::KuberContext, O::Symbol, outstream::Channel;
270
270
end
271
271
end
272
272
273
- function put! (ctx:: KuberContext , v:: T ) where {T<: SwaggerModel }
273
+ function put! (ctx:: KuberContext , v:: T ; max_tries :: Int = retries (ctx, true ) ) where {T<: SwaggerModel }
274
274
vjson = convert (Dict{String,Any}, v)
275
- put! (ctx, Symbol (vjson[" kind" ]), vjson)
275
+ put! (ctx, Symbol (vjson[" kind" ]), vjson; max_tries = max_tries )
276
276
end
277
277
278
- function put! (ctx:: KuberContext , O:: Symbol , d:: Dict{String,Any} )
278
+ function put! (ctx:: KuberContext , O:: Symbol , d:: Dict{String,Any} ; max_tries :: Int = retries (ctx, true ) )
279
279
apictx = _get_apictx (ctx, O, get (d, " apiVersion" , nothing ))
280
280
if (apicall = _api_function (" create$O " )) != = nothing
281
- return apicall (apictx, d)
281
+ return k8s_retry (; max_tries= max_tries) do
282
+ apicall (apictx, d)
283
+ end
282
284
elseif (apicall = _api_function (" createNamespaced$O " )) != = nothing
283
- return apicall (apictx, ctx. namespace, d)
285
+ return k8s_retry (; max_tries= max_tries) do
286
+ apicall (apictx, ctx. namespace, d)
287
+ end
284
288
else
285
289
throw (ArgumentError (" No API functions could be located using :$O " ))
286
290
end
287
291
end
288
292
289
- function delete! (ctx:: KuberContext , v:: T ; kwargs... ) where {T<: SwaggerModel }
293
+ function delete! (ctx:: KuberContext , v:: T ; max_tries :: Int = retries (ctx, true ), kwargs... ) where {T<: SwaggerModel }
290
294
vjson = convert (Dict{String,Any}, v)
291
295
kind = vjson[" kind" ]
292
296
name = vjson[" metadata" ][" name" ]
293
- delete! (ctx, Symbol (kind), name; apiversion= get (vjson, " apiVersion" , nothing ), kwargs... )
297
+ delete! (ctx, Symbol (kind), name; apiversion= get (vjson, " apiVersion" , nothing ), max_tries = max_tries, kwargs... )
294
298
end
295
299
296
- function delete! (ctx:: KuberContext , O:: Symbol , name:: String ; apiversion:: Union{String,Nothing} = nothing , kwargs... )
300
+ function delete! (ctx:: KuberContext , O:: Symbol , name:: String ; apiversion:: Union{String,Nothing} = nothing , max_tries :: Int = retries (ctx, true ), kwargs... )
297
301
apictx = _get_apictx (ctx, O, apiversion)
298
302
299
303
params = [apictx, name]
300
304
301
305
if (apicall = _api_function (" delete$O " )) != = nothing
302
- return apicall (params... ; kwargs... )
306
+ return k8s_retry (; max_tries= max_tries) do
307
+ apicall (params... ; kwargs... )
308
+ end
303
309
elseif (apicall = _api_function (" deleteNamespaced$O " )) != = nothing
304
310
push! (params, ctx. namespace)
305
- return apicall (params... ; kwargs... )
311
+ return k8s_retry (; max_tries= max_tries) do
312
+ apicall (params... ; kwargs... )
313
+ end
306
314
else
307
315
throw (ArgumentError (" No API functions could be located using :$O " ))
308
316
end
309
317
end
310
318
311
- function update! (ctx:: KuberContext , v:: T , patch, patch_type) where {T<: SwaggerModel }
319
+ function update! (ctx:: KuberContext , v:: T , patch, patch_type; max_tries :: Int = retries (ctx, true ) ) where {T<: SwaggerModel }
312
320
vjson = convert (Dict{String,Any}, v)
313
321
kind = vjson[" kind" ]
314
322
name = vjson[" metadata" ][" name" ]
315
- update! (ctx, Symbol (kind), name, patch, patch_type; apiversion= get (vjson, " apiVersion" , nothing ))
323
+ update! (ctx, Symbol (kind), name, patch, patch_type; apiversion= get (vjson, " apiVersion" , nothing ), max_tries = max_tries )
316
324
end
317
325
318
- function update! (ctx:: KuberContext , O:: Symbol , name:: String , patch, patch_type; apiversion:: Union{String,Nothing} = nothing )
326
+ function update! (ctx:: KuberContext , O:: Symbol , name:: String , patch, patch_type; apiversion:: Union{String,Nothing} = nothing , max_tries :: Int = retries (ctx, true ) )
319
327
apictx = _get_apictx (ctx, O, apiversion)
320
328
321
329
if (apicall = _api_function (" patch$O " )) != = nothing
322
- return apicall (apictx, name, patch; _mediaType= patch_type)
330
+ return k8s_retry (; max_tries= max_tries) do
331
+ apicall (apictx, name, patch; _mediaType= patch_type)
332
+ end
323
333
elseif (apicall = _api_function (" patchNamespaced$O " )) != = nothing
324
- return apicall (apictx, name, ctx. namespace, patch; _mediaType= patch_type)
334
+ return k8s_retry (; max_tries= max_tries) do
335
+ apicall (apictx, name, ctx. namespace, patch; _mediaType= patch_type)
336
+ end
325
337
else
326
338
throw (ArgumentError (" No API functions could be located using :$O " ))
327
339
end
0 commit comments