From b67242f532775b1c06071d059e1f18cca42d1249 Mon Sep 17 00:00:00 2001 From: Ruslan Aliev Date: Fri, 10 Sep 2021 18:53:45 -0500 Subject: [PATCH] Add possibility to specify poll interval Currently, there is no way to specify poll interval for kubernetes-apply phases, however such possibility exists in cli-utils API and could be helpful for tuning apply process. Change-Id: I605767d589920d0f1e10343afd9672c8d615a46a Signed-off-by: Ruslan Aliev --- manifests/phases/executors.yaml | 1 + pkg/api/v1alpha1/kubernetes_apply_types.go | 2 ++ pkg/k8s/applier/apply_options.go | 1 + pkg/phase/executors/k8s_applier.go | 2 ++ 4 files changed, 6 insertions(+) diff --git a/manifests/phases/executors.yaml b/manifests/phases/executors.yaml index 04df91765..d8e08540e 100644 --- a/manifests/phases/executors.yaml +++ b/manifests/phases/executors.yaml @@ -20,6 +20,7 @@ metadata: config: waitOptions: timeout: 5000 + pollInterval: 30 pruneOptions: prune: false --- diff --git a/pkg/api/v1alpha1/kubernetes_apply_types.go b/pkg/api/v1alpha1/kubernetes_apply_types.go index c40053e5a..0fa08e4c2 100644 --- a/pkg/api/v1alpha1/kubernetes_apply_types.go +++ b/pkg/api/v1alpha1/kubernetes_apply_types.go @@ -38,6 +38,8 @@ type ApplyConfig struct { type ApplyWaitOptions struct { // Timeout in seconds Timeout int `json:"timeout,omitempty"` + // PollInterval in seconds + PollInterval int `json:"pollInterval,omitempty"` } // ApplyPruneOptions provides instructions how to prune for kubernetes resources diff --git a/pkg/k8s/applier/apply_options.go b/pkg/k8s/applier/apply_options.go index bf6827970..ba69bed76 100644 --- a/pkg/k8s/applier/apply_options.go +++ b/pkg/k8s/applier/apply_options.go @@ -23,6 +23,7 @@ import ( // ApplyOptions struct that hold options for apply operation type ApplyOptions struct { WaitTimeout time.Duration + PollInterval time.Duration DryRunStrategy common.DryRunStrategy Prune bool BundleName string diff --git a/pkg/phase/executors/k8s_applier.go b/pkg/phase/executors/k8s_applier.go index e0fc1b9de..47a06b1ca 100644 --- a/pkg/phase/executors/k8s_applier.go +++ b/pkg/phase/executors/k8s_applier.go @@ -95,6 +95,7 @@ func (e *KubeApplierExecutor) Run(ch chan events.Event, runOpts ifc.RunOptions) if runOpts.Timeout != nil { timeout = *runOpts.Timeout } + pollInterval := time.Second * time.Duration(e.apiObject.Config.WaitOptions.PollInterval) log.Debugf("WaitTimeout: %v", timeout) applyOptions := k8sapplier.ApplyOptions{ @@ -102,6 +103,7 @@ func (e *KubeApplierExecutor) Run(ch chan events.Event, runOpts ifc.RunOptions) Prune: e.apiObject.Config.PruneOptions.Prune, BundleName: e.BundleName, WaitTimeout: timeout, + PollInterval: pollInterval, } applier.ApplyBundle(filteredBundle, applyOptions) }