Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func main() {
flag.IntVar(&webhookPort, "webhook-port", 9443, "admission webhook listen address")
flag.IntVar(&controllerArgs.ConcurrentReconciles, "concurrent-reconciles", 4, "concurrent-reconciles is the concurrent reconcile number of the controller. The default value is 4")
flag.BoolVar(&controllerArgs.IgnoreWorkflowWithoutControllerRequirement, "ignore-workflow-without-controller-requirement", false, "If true, workflow controller will not process the workflowrun without 'workflowrun.oam.dev/controller-version-require' annotation")
flag.DurationVar(&controllerArgs.ReconcileTimeout, "reconcile-timeout", controllers.DefaultReconcileTimeout, "The timeout for workflowrun reconcile loop. Increase this value if your workflowrun has a large number of steps. Default is 3m.")
flag.Float64Var(&qps, "kube-api-qps", 50, "the qps for reconcile clients. Low qps may lead to low throughput. High qps may give stress to api-server. Raise this value if concurrent-reconciles is set to be high.")
flag.IntVar(&burst, "kube-api-burst", 100, "the burst for reconcile clients. Recommend setting it qps*2.")
flag.StringVar(&userAgent, "user-agent", "vela-workflow", "the user agent of the client.")
Expand Down
6 changes: 5 additions & 1 deletion controllers/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ const (
// +kubebuilder:rbac:groups=core.oam.dev,resources=workflowruns/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=core.oam.dev,resources=workflowruns/finalizers,verbs=update
func (r *BackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
ctx, cancel := context.WithTimeout(ctx, ReconcileTimeout)
reconcileTimeout := r.Args.ReconcileTimeout
if reconcileTimeout <= 0 {
reconcileTimeout = DefaultReconcileTimeout
}
ctx, cancel := context.WithTimeout(ctx, reconcileTimeout)
defer cancel()

ctx = types.SetNamespaceInCtx(ctx, req.Namespace)
Expand Down
14 changes: 10 additions & 4 deletions controllers/workflowrun_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ type Args struct {
ConcurrentReconciles int
// IgnoreWorkflowWithoutControllerRequirement indicates that workflow controller will not process the workflowrun without 'workflowrun.oam.dev/controller-version-require' annotation.
IgnoreWorkflowWithoutControllerRequirement bool
// ReconcileTimeout is the timeout for the reconcile loop. Default is 3 minutes.
ReconcileTimeout time.Duration
}

// WorkflowRunReconciler reconciles a WorkflowRun object
Expand All @@ -74,17 +76,21 @@ type workflowRunPatcher struct {
run *v1alpha1.WorkflowRun
}

var (
// ReconcileTimeout timeout for controller to reconcile
ReconcileTimeout = time.Minute * 3
const (
// DefaultReconcileTimeout is the default timeout for controller to reconcile
DefaultReconcileTimeout = time.Minute * 3
)

// Reconcile reconciles the WorkflowRun object
// +kubebuilder:rbac:groups=core.oam.dev,resources=workflowruns,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core.oam.dev,resources=workflowruns/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=core.oam.dev,resources=workflowruns/finalizers,verbs=update
func (r *WorkflowRunReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
ctx, cancel := context.WithTimeout(ctx, ReconcileTimeout)
reconcileTimeout := r.Args.ReconcileTimeout
if reconcileTimeout <= 0 {
reconcileTimeout = DefaultReconcileTimeout
}
ctx, cancel := context.WithTimeout(ctx, reconcileTimeout)
defer cancel()

ctx = types.SetNamespaceInCtx(ctx, req.Namespace)
Expand Down
Loading