Skip to content

Commit 931ae93

Browse files
Use multiline string literal for cluster configuration (#85)
1 parent bf7833f commit 931ae93

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pkg/kind/kind.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,17 @@ func checkForExistingCluster() error {
134134
func createNewCluster() error {
135135

136136
fmt.Println("☸ Creating Kind cluster...")
137-
config := "kind: Cluster\n" +
138-
"apiVersion: kind.x-k8s.io/v1alpha4\n" +
139-
"name: " + clusterName + "\n" +
140-
"nodes:\n" +
141-
"- role: control-plane\n" +
142-
" image: kindest/node:" + kubernetesVersion + "\n" +
143-
" extraPortMappings:\n" +
144-
" - containerPort: 31080\n" +
145-
" listenAddress: 127.0.0.1\n" +
146-
" hostPort: 80"
137+
config := fmt.Sprintf(`
138+
kind: Cluster
139+
apiVersion: kind.x-k8s.io/v1alpha4
140+
name: %s
141+
nodes:
142+
- role: control-plane
143+
image: kindest/node:%s
144+
extraPortMappings:
145+
- containerPort: 31080
146+
listenAddress: 127.0.0.1
147+
hostPort: 80`, clusterName, kubernetesVersion)
147148

148149
createCluster := exec.Command("kind", "create", "cluster", "--wait=120s", "--config=-")
149150
createCluster.Stdin = strings.NewReader(config)

0 commit comments

Comments
 (0)