diff --git a/pkg/clusters/types/kind/builder.go b/pkg/clusters/types/kind/builder.go index 50417187..98bc9d27 100644 --- a/pkg/clusters/types/kind/builder.go +++ b/pkg/clusters/types/kind/builder.go @@ -19,6 +19,7 @@ type Builder struct { addons clusters.Addons clusterVersion *semver.Version + configPath *string } // NewBuilder provides a new *Builder object. @@ -42,6 +43,13 @@ func (b *Builder) WithClusterVersion(version semver.Version) *Builder { return b } +// WithConfig sets a filename containing a KIND config +// See: https://kind.sigs.k8s.io/docs/user/configuration/ +func (b *Builder) WithConfig(filename string) *Builder { + b.configPath = &filename + return b +} + // Build creates and configures clients for a Kind-based Kubernetes clusters.Cluster. func (b *Builder) Build(ctx context.Context) (*Cluster, error) { deployArgs := make([]string, 0) @@ -49,6 +57,10 @@ func (b *Builder) Build(ctx context.Context) (*Cluster, error) { deployArgs = append(deployArgs, "--image", "kindest/node:v"+b.clusterVersion.String()) } + if b.configPath != nil { + deployArgs = append(deployArgs, "--config", *b.configPath) + } + if err := createCluster(ctx, b.Name, deployArgs...); err != nil { return nil, fmt.Errorf("failed to create cluster %s: %w", b.Name, err) }