Skip to content

Commit

Permalink
[feat] support passing extra args to kind (#362)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Brown <[email protected]>
  • Loading branch information
DerekTBrown authored Dec 3, 2024
1 parent 5282f72 commit e5f6a67
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/kind_extra_args.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Creates a kind cluster with a registry.
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: kind
registry: ctlptl-registry
kindExtraCreateArguments:
# Example 1: Pass --wait to `kind create cluster` to wait for the control plane to be ready.
- "--wait=2m"
# Example 2: Pass --retain to `kind create cluster` to keep the containers around.
# This is super useful for debugging cluster creation issues.
- "--retain"
# Example 3: Pass --verbosity=3 to `kind create cluster` to get more verbose output.
- # This is also super useful for debugging cluster creation issues
- "--verbosity=3"
3 changes: 3 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ type Cluster struct {
// wins over one specified in the Kind config.
KindV1Alpha4Cluster *v1alpha4.Cluster `json:"kindV1Alpha4Cluster,omitempty" yaml:"kindV1Alpha4Cluster,omitempty"`

// Extra command line arguments passed to Kind create CLI. Only applicable to clusters with the product: kind.
KindExtraCreateArguments []string `json:"kindExtraCreateArguments,omitempty" yaml:"kindExtraCreateArguments,omitempty"`

// The Minikube cluster config. Only applicable for clusters with product: minikube.
Minikube *MinikubeCluster `json:"minikube,omitempty" yaml:"minikube,omitempty"`

Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/admin_kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (a *kindAdmin) Create(ctx context.Context, desired *api.Cluster, registry *
return errors.Wrap(err, "creating kind cluster")
}

args = append(args, desired.KindExtraCreateArguments...)
args = append(args, "--config", "-")

iostreams := a.iostreams
Expand Down

0 comments on commit e5f6a67

Please sign in to comment.