@@ -20,7 +20,7 @@ import (
20
20
21
21
var (
22
22
k3sImage = "rancher/k3s"
23
- k3sVersion = "v1.18.20 -k3s1"
23
+ k3sVersion = "v1.21.14 -k3s1"
24
24
)
25
25
26
26
// DockerImage holds the configuration of a Docker image.
@@ -41,19 +41,19 @@ type ClusterOptionFunc func(opts *ClusterOptions)
41
41
// WithoutTraefik tells k3d to not start a k3s cluster with Traefik already installed in.
42
42
func WithoutTraefik () func (opts * ClusterOptions ) {
43
43
return func (opts * ClusterOptions ) {
44
- opts .Cmd = append (opts .Cmd , "--k3s-server- arg" , "--no-deploy =traefik" )
44
+ opts .Cmd = append (opts .Cmd , "--k3s-arg" , "--disable =traefik@server:0 " )
45
45
}
46
46
}
47
47
48
48
// WithoutCoreDNS tells k3d to not start a k3s cluster with CoreDNS already installed in.
49
49
func WithoutCoreDNS () func (opts * ClusterOptions ) {
50
50
return func (opts * ClusterOptions ) {
51
- opts .Cmd = append (opts .Cmd , "--k3s-server- arg" , "--no-deploy =coredns" )
51
+ opts .Cmd = append (opts .Cmd , "--k3s-arg" , "--disable =coredns@server:0 " )
52
52
}
53
53
}
54
54
55
- // WithImages tells k3d to import the given image. Images which are tagged a local won't be pull locally before being
56
- // imported.
55
+ // WithImages tells k3d to import the given image.
56
+ // Images which are tagged a local won't be pull locally before being imported.
57
57
func WithImages (images ... DockerImage ) func (opts * ClusterOptions ) {
58
58
return func (opts * ClusterOptions ) {
59
59
opts .Images = append (opts .Images , images ... )
@@ -70,11 +70,7 @@ type Cluster struct {
70
70
71
71
// NewCluster creates a new k3s cluster using the given configuration.
72
72
func NewCluster (logger logrus.FieldLogger , masterURL string , name string , opts ... ClusterOptionFunc ) (* Cluster , error ) {
73
- clusterOpts := ClusterOptions {
74
- Images : []DockerImage {
75
- {Name : "rancher/coredns-coredns:1.6.3" },
76
- },
77
- }
73
+ var clusterOpts ClusterOptions
78
74
79
75
for _ , opt := range opts {
80
76
opt (& clusterOpts )
@@ -330,10 +326,12 @@ func pullDockerImages(logger logrus.FieldLogger, images []DockerImage) error {
330
326
}
331
327
332
328
func importDockerImages (logger logrus.FieldLogger , clusterName string , images []DockerImage ) error {
333
- args := [] string {
334
- "image" , "import" , "--cluster" , clusterName ,
329
+ if len ( images ) == 0 {
330
+ return nil
335
331
}
336
332
333
+ args := []string {"image" , "import" , "--cluster" , clusterName }
334
+
337
335
for _ , image := range images {
338
336
args = append (args , image .Name )
339
337
}
0 commit comments