Uplift cli-utils to 1.18.1

Change-Id: Ib1f066f897735387c99a9ee99004ea2284c1a55a
This commit is contained in:
Ian Howell
2020-08-19 15:52:38 -05:00
parent 17bf4c77e8
commit 52153fc65d
7 changed files with 27 additions and 17 deletions

View File

@@ -17,6 +17,8 @@ package events
import (
"k8s.io/cli-runtime/pkg/genericclioptions"
"sigs.k8s.io/cli-utils/cmd/printers"
"sigs.k8s.io/cli-utils/pkg/common"
applyevent "sigs.k8s.io/cli-utils/pkg/apply/event"
"opendev.org/airship/airshipctl/pkg/log"
@@ -36,7 +38,7 @@ type DefaultProcessor struct {
// NewDefaultProcessor returns instance of DefaultProcessor as interface Implementation
func NewDefaultProcessor(streams genericclioptions.IOStreams) EventProcessor {
applyCh := make(chan applyevent.Event)
go printers.GetPrinter(printers.EventsPrinter, streams).Print(applyCh, false)
go printers.GetPrinter(printers.EventsPrinter, streams).Print(applyCh, common.DryRunNone)
return &DefaultProcessor{
errors: []error{},
applierChan: applyCh,

View File

@@ -171,7 +171,7 @@ func cliApplyOptions(ao ApplyOptions) cliapply.Options {
EmitStatusEvents: emitStatusEvents,
ReconcileTimeout: ao.WaitTimeout,
NoPrune: !ao.Prune,
DryRun: ao.DryRun,
DryRunStrategy: ao.DryRunStrategy,
}
}

View File

@@ -26,6 +26,7 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
"sigs.k8s.io/cli-utils/pkg/apply/event"
"sigs.k8s.io/cli-utils/pkg/apply/poller"
"sigs.k8s.io/cli-utils/pkg/common"
"opendev.org/airship/airshipctl/pkg/document"
"opendev.org/airship/airshipctl/pkg/events"
@@ -121,9 +122,9 @@ func TestApplierRun(t *testing.T) {
// create default applier
a := applier.NewApplier(f, s)
opts := applier.ApplyOptions{
WaitTimeout: time.Second * 5,
BundleName: "test-bundle",
DryRun: true,
WaitTimeout: time.Second * 5,
BundleName: "test-bundle",
DryRunStrategy: common.DryRunClient,
}
if tt.driver != nil {
a.Driver = tt.driver

View File

@@ -15,13 +15,15 @@
package applier
import (
"sigs.k8s.io/cli-utils/pkg/common"
"time"
)
// ApplyOptions struct that hold options for apply operation
type ApplyOptions struct {
WaitTimeout time.Duration
DryRun bool
Prune bool
BundleName string
WaitTimeout time.Duration
DryRunStrategy common.DryRunStrategy
Prune bool
BundleName string
}

View File

@@ -18,6 +18,8 @@ import (
"fmt"
"time"
"sigs.k8s.io/cli-utils/pkg/common"
"opendev.org/airship/airshipctl/pkg/document"
"opendev.org/airship/airshipctl/pkg/environment"
"opendev.org/airship/airshipctl/pkg/events"
@@ -49,10 +51,14 @@ func (o *Options) Initialize() {
// Run apply subcommand logic
func (o *Options) Run() error {
ao := applier.ApplyOptions{
DryRun: o.DryRun,
Prune: o.Prune,
WaitTimeout: o.WaitTimeout,
DryRunStrategy: common.DryRunNone,
Prune: o.Prune,
WaitTimeout: o.WaitTimeout,
}
if o.DryRun {
ao.DryRunStrategy = common.DryRunClient
}
globalConf := o.RootSettings.Config
if err := globalConf.EnsureComplete(); err != nil {