Skip to content

Commit 24ba04a

Browse files
committed
[feat] support passing extra args to kind
1 parent 6b3b290 commit 24ba04a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

examples/kind_extra_args.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Creates a kind cluster with a registry.
2+
apiVersion: ctlptl.dev/v1alpha1
3+
kind: Cluster
4+
product: kind
5+
registry: ctlptl-registry
6+
kindExtraArguments:
7+
# Example 1: Pass --wait to `kind create cluster` to wait for the control plane to be ready.
8+
- "--wait=2m"
9+
# Example 2: Pass --retain to `kind create cluster` to keep the containers around.
10+
# This is super useful for debugging cluster creation issues.
11+
- "--retain"
12+
# Example 3: Pass --verbosity=3 to `kind create cluster` to get more verbose output.
13+
- # This is also super useful for debugging cluster creation issues
14+
- "--verbosity=3"

pkg/api/types.go

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ type Cluster struct {
6262
// wins over one specified in the Kind config.
6363
KindV1Alpha4Cluster *v1alpha4.Cluster `json:"kindV1Alpha4Cluster,omitempty" yaml:"kindV1Alpha4Cluster,omitempty"`
6464

65+
// Extra command line arguments passed to Kind CLI. Only applicable to clusters with the product: kind.
66+
KindExtraArguments []string `json:"kindExtraArguments,omitempty" yaml:"kindExtraArguments,omitempty"`
67+
6568
// The Minikube cluster config. Only applicable for clusters with product: minikube.
6669
Minikube *MinikubeCluster `json:"minikube,omitempty" yaml:"minikube,omitempty"`
6770

pkg/cluster/admin_kind.go

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ func (a *kindAdmin) Create(ctx context.Context, desired *api.Cluster, registry *
147147
return errors.Wrap(err, "creating kind cluster")
148148
}
149149

150+
args = append(args, desired.KindExtraArguments...)
150151
args = append(args, "--config", "-")
151152

152153
iostreams := a.iostreams

0 commit comments

Comments
 (0)