/ Framework / KubernetesWorkflow / K8sTimeSet.cs
K8sTimeSet.cs
 1  namespace Core
 2  {
 3      public interface IK8sTimeSet
 4      {
 5          /// <summary>
 6          /// After a failed K8s operation, wait this long before trying again.
 7          /// </summary>
 8          TimeSpan K8sOperationRetryDelay();
 9  
10          /// <summary>
11          /// Maximum total time to attempt to perform a successful k8s operation.
12          /// If k8s operations fail during this timespan, retries will be made.
13          /// </summary>
14          TimeSpan K8sOperationTimeout();
15      }
16  
17      public class DefaultK8sTimeSet : IK8sTimeSet
18      {
19          public TimeSpan K8sOperationRetryDelay()
20          {
21              return TimeSpan.FromSeconds(10);
22          }
23  
24          public TimeSpan K8sOperationTimeout()
25          {
26              return TimeSpan.FromMinutes(30);
27          }
28      }
29  
30      public class LongK8sTimeSet : IK8sTimeSet
31      {
32          public TimeSpan K8sOperationRetryDelay()
33          {
34              return TimeSpan.FromSeconds(30);
35          }
36  
37          public TimeSpan K8sOperationTimeout()
38          {
39              return TimeSpan.FromHours(1);
40          }
41      }
42  }