From 52153fc65de198d64d06d8a918119d7ac805d448 Mon Sep 17 00:00:00 2001 From: Ian Howell Date: Wed, 19 Aug 2020 15:52:38 -0500 Subject: [PATCH] Uplift cli-utils to 1.18.1 Change-Id: Ib1f066f897735387c99a9ee99004ea2284c1a55a --- go.mod | 3 ++- go.sum | 6 ++---- pkg/events/processor.go | 4 +++- pkg/k8s/applier/applier.go | 2 +- pkg/k8s/applier/applier_test.go | 7 ++++--- pkg/k8s/applier/apply_options.go | 10 ++++++---- pkg/phase/apply/apply.go | 12 +++++++++--- 7 files changed, 27 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index c239cf044..879723864 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( k8s.io/kubectl v0.17.4 opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a - sigs.k8s.io/cli-utils v0.15.0 + sigs.k8s.io/cli-utils v0.18.1 sigs.k8s.io/cluster-api v0.3.5 sigs.k8s.io/controller-runtime v0.5.2 sigs.k8s.io/kustomize/api v0.5.1 @@ -41,4 +41,5 @@ replace ( github.com/russross/blackfriday => github.com/russross/blackfriday v1.5.2 k8s.io/client-go => k8s.io/client-go v0.0.0-20191114101535-6c5935290e33 k8s.io/kubectl => k8s.io/kubectl v0.0.0-20191219154910-1528d4eea6dd + sigs.k8s.io/kustomize/kyaml => sigs.k8s.io/kustomize/kyaml v0.4.1 ) diff --git a/go.sum b/go.sum index ffe85f148..51d836ed9 100644 --- a/go.sum +++ b/go.sum @@ -1527,8 +1527,8 @@ opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a h1:S1dm opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a/go.mod h1:s0hwuUpBsRXOrhN0NR+fNVivXGyWgHKpqtyq7qYjpew= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/letsencrypt v0.0.3/go.mod h1:buyQKZ6IXrRnB7TdkHP0RyEybLx18HHyOSoTyoOLqNY= -sigs.k8s.io/cli-utils v0.15.0 h1:QiGX8wfBaegKQhejZg2EsqCPYGtyavIpEjNTMdpzUlY= -sigs.k8s.io/cli-utils v0.15.0/go.mod h1:H35YA5iJIM7EVNgqDTjX2dgt4wE23zmnXOTSTlyD+PE= +sigs.k8s.io/cli-utils v0.18.1 h1:K4usJmMlI98mL+z+TdAnKfzng64/m8bRXZKPwy3ZCWw= +sigs.k8s.io/cli-utils v0.18.1/go.mod h1:B7KdqkSkHNIUn3cFbaR4aKUZMKtr+Benboi1w/HW/Fg= sigs.k8s.io/cluster-api v0.3.5 h1:XPCuwrGL73x82a6spCHwkHHeGiQF+L4zntaoDg2qMzo= sigs.k8s.io/cluster-api v0.3.5/go.mod h1:IoP66q4g92I/2f/9hltbE/FWG3RakIwRdYpY+6mqvtE= sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns= @@ -1541,8 +1541,6 @@ sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbL sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= sigs.k8s.io/kustomize/api v0.5.1 h1:iHGTs5LcnJGqHstUSxWD/kX6XZgmd82x79LLlZwDU0I= sigs.k8s.io/kustomize/api v0.5.1/go.mod h1:LGqJ9ZWOnWDqlECqrFgNUyEqSJc6ooA9ZiWZ4KFZv+I= -sigs.k8s.io/kustomize/kyaml v0.1.4 h1:cDG2u7v6CTAZmWKzCjk0hKG7AIN+2mCHx2ifwPbvKrs= -sigs.k8s.io/kustomize/kyaml v0.1.4/go.mod h1:461i94nj0h0ylJ6w83jLkR4SqqVhn1iY6fjD0JSTQeE= sigs.k8s.io/kustomize/kyaml v0.4.1 h1:NEqA/35upoAjb+I5vh1ODUqxoX4DOrezeQa9BhhG5Co= sigs.k8s.io/kustomize/kyaml v0.4.1/go.mod h1:XJL84E6sOFeNrQ7CADiemc1B0EjIxHo3OhW4o1aJYNw= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= diff --git a/pkg/events/processor.go b/pkg/events/processor.go index 7d7a0a631..9f4eecc40 100644 --- a/pkg/events/processor.go +++ b/pkg/events/processor.go @@ -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, diff --git a/pkg/k8s/applier/applier.go b/pkg/k8s/applier/applier.go index 03d76d347..3813145ee 100644 --- a/pkg/k8s/applier/applier.go +++ b/pkg/k8s/applier/applier.go @@ -171,7 +171,7 @@ func cliApplyOptions(ao ApplyOptions) cliapply.Options { EmitStatusEvents: emitStatusEvents, ReconcileTimeout: ao.WaitTimeout, NoPrune: !ao.Prune, - DryRun: ao.DryRun, + DryRunStrategy: ao.DryRunStrategy, } } diff --git a/pkg/k8s/applier/applier_test.go b/pkg/k8s/applier/applier_test.go index f36df75d3..8a0e0b7b2 100644 --- a/pkg/k8s/applier/applier_test.go +++ b/pkg/k8s/applier/applier_test.go @@ -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 diff --git a/pkg/k8s/applier/apply_options.go b/pkg/k8s/applier/apply_options.go index 74fbe685b..bf6827970 100644 --- a/pkg/k8s/applier/apply_options.go +++ b/pkg/k8s/applier/apply_options.go @@ -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 } diff --git a/pkg/phase/apply/apply.go b/pkg/phase/apply/apply.go index a06578d82..f210161d1 100644 --- a/pkg/phase/apply/apply.go +++ b/pkg/phase/apply/apply.go @@ -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 {