Skip to content

Commit

Permalink
pr: move and rename
Browse files Browse the repository at this point in the history
  • Loading branch information
rainest committed Oct 11, 2023
1 parent c4d9d8b commit f3dd1e7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
31 changes: 31 additions & 0 deletions pkg/clusters/addons/metallb/builder.go
Original file line number Diff line number Diff line change
@@ -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,
}
}
30 changes: 0 additions & 30 deletions pkg/clusters/addons/metallb/metallb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

0 comments on commit f3dd1e7

Please sign in to comment.