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 <raliev@mirantis.com>
This commit is contained in:
Ruslan Aliev 2021-09-10 18:53:45 -05:00
parent fc20c79e47
commit b67242f532
4 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@ metadata:
config:
waitOptions:
timeout: 5000
pollInterval: 30
pruneOptions:
prune: false
---

View File

@ -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

View File

@ -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

View File

@ -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)
}