@@ -342,7 +342,7 @@ func recreateCluster(registry bool, extraMountHostPath string, extraMountContain
342
342
if err := deleteContainerRegistry (dcli ); err != nil {
343
343
return fmt .Errorf ("delete container registry: %w" , err )
344
344
}
345
- if err := createNewCluster (extraMountHostPath , extraMountContainerPath ); err != nil {
345
+ if err := createNewCluster (registry , extraMountHostPath , extraMountContainerPath ); err != nil {
346
346
return fmt .Errorf ("new cluster: %w" , err )
347
347
}
348
348
if registry {
@@ -357,7 +357,18 @@ func recreateCluster(registry bool, extraMountHostPath string, extraMountContain
357
357
}
358
358
359
359
// createNewCluster creates a new Kind cluster
360
- func createNewCluster (extraMountHostPath string , extraMountContainerPath string ) error {
360
+ func createNewCluster (registry bool , extraMountHostPath string , extraMountContainerPath string ) error {
361
+ insecureRegistry := ""
362
+ if registry {
363
+ insecureRegistry = `
364
+ [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
365
+ [plugins."io.containerd.grpc.v1.cri".registry.mirrors."kind-registry:5000"]
366
+ endpoint = ["http://kind-registry:5000"]
367
+ [plugins."io.containerd.grpc.v1.cri".registry.configs]
368
+ [plugins."io.containerd.grpc.v1.cri".registry.configs."kind-registry:5000".tls]
369
+ insecure_skip_verify = true`
370
+ }
371
+
361
372
extraMount := ""
362
373
if extraMountHostPath != "" && extraMountContainerPath != "" {
363
374
extraMount = fmt .Sprintf (`
@@ -379,14 +390,14 @@ name: %s
379
390
containerdConfigPatches:
380
391
- |-
381
392
[plugins."io.containerd.grpc.v1.cri".registry]
382
- config_path = "/etc/containerd/certs.d/"
393
+ config_path = "/etc/containerd/certs.d/" %s
383
394
nodes:
384
395
- role: control-plane
385
396
image: %s %s
386
397
extraPortMappings:
387
398
- containerPort: 31080
388
399
listenAddress: 0.0.0.0
389
- hostPort: 80` , clusterName , kubernetesVersion , extraMount )
400
+ hostPort: 80` , clusterName , insecureRegistry , kubernetesVersion , extraMount )
390
401
391
402
createCluster := exec .Command ("kind" , "create" , "cluster" , "--wait=120s" , "--config=-" )
392
403
createCluster .Stdin = strings .NewReader (config )
0 commit comments