From f3dd1e77734cf33545bfd05d72c2fed260a6d165 Mon Sep 17 00:00:00 2001 From: Travis Raines <571832+rainest@users.noreply.github.com> Date: Wed, 11 Oct 2023 13:31:39 -0700 Subject: [PATCH] pr: move and rename --- pkg/clusters/addons/metallb/builder.go | 31 ++++++++++++++++++++++++++ pkg/clusters/addons/metallb/metallb.go | 30 ------------------------- 2 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 pkg/clusters/addons/metallb/builder.go diff --git a/pkg/clusters/addons/metallb/builder.go b/pkg/clusters/addons/metallb/builder.go new file mode 100644 index 00000000..109ffd78 --- /dev/null +++ b/pkg/clusters/addons/metallb/builder.go @@ -0,0 +1,31 @@ +package metallb + +// ----------------------------------------------------------------------------- +// Metallb Builder +// ----------------------------------------------------------------------------- + +// Builder is a configuration tool for metallb cluster.Addons. +type Builder struct { + disablePoolCreation bool +} + +// NewBuilder provides a new Builder object with default addon settings. +func NewBuilder() *Builder { + builder := &Builder{ + disablePoolCreation: false, + } + return builder +} + +// WithIPAddressPoolDisabled instructs the builder to create addons with pool creation disabled. +func (b *Builder) WithIPAddressPoolDisabled() *Builder { + b.disablePoolCreation = true + return b +} + +// Build generates an addon with the builder's configuration. +func (b *Builder) Build() *Addon { + return &Addon{ + disablePoolCreation: b.disablePoolCreation, + } +} diff --git a/pkg/clusters/addons/metallb/metallb.go b/pkg/clusters/addons/metallb/metallb.go index 9fbb4ab7..2c8746ce 100644 --- a/pkg/clusters/addons/metallb/metallb.go +++ b/pkg/clusters/addons/metallb/metallb.go @@ -404,33 +404,3 @@ func metallbDeleteHack(ctx context.Context, kubeconfig *os.File) error { WithStdout(io.Discard). Do(ctx) } - -// ----------------------------------------------------------------------------- -// Metallb Builder -// ----------------------------------------------------------------------------- - -// Builder is a configuration tool for metallb cluster.Addons. -type Builder struct { - disablePoolCreation bool -} - -// NewBuilder provides a new Builder object with default addon settings. -func NewBuilder() *Builder { - builder := &Builder{ - disablePoolCreation: false, - } - return builder -} - -// WithPoolDisabled instructs the builder to create addons with pool creation disabled. -func (b *Builder) WithPoolDisabled() *Builder { - b.disablePoolCreation = true - return b -} - -// Build generates an addon with the builder's configuration. -func (b *Builder) Build() *Addon { - return &Addon{ - disablePoolCreation: b.disablePoolCreation, - } -}