@@ -54,17 +54,18 @@ func TestRegistry_EnableHAAirgap(t *testing.T) {
5454 })
5555
5656 // data and k0s directories are required for the admin console addon
57- ecDataDirMount := kind.Mount {
58- HostPath : util .TempDirForHostMount (t , "data-dir-*" ),
59- ContainerPath : "/var/lib/embedded-cluster" ,
60- }
61- k0sDirMount := kind.Mount {
62- HostPath : util .TempDirForHostMount (t , "k0s-dir-*" ),
63- ContainerPath : "/var/lib/embedded-cluster/k0s" ,
57+ // Each node needs its own separate data directory to avoid conflicts with local persistent volumes
58+ for i := range kindConfig .Nodes {
59+ ecDataDirMount := kind.Mount {
60+ HostPath : util .TempDirForHostMount (t , "data-dir-*" ),
61+ ContainerPath : "/var/lib/embedded-cluster" ,
62+ }
63+ k0sDirMount := kind.Mount {
64+ HostPath : util .TempDirForHostMount (t , "k0s-dir-*" ),
65+ ContainerPath : "/var/lib/embedded-cluster/k0s" ,
66+ }
67+ kindConfig .Nodes [i ].ExtraMounts = append (kindConfig .Nodes [i ].ExtraMounts , ecDataDirMount , k0sDirMount )
6468 }
65- kindConfig .Nodes [0 ].ExtraMounts = append (kindConfig .Nodes [0 ].ExtraMounts , ecDataDirMount , k0sDirMount )
66- kindConfig .Nodes [1 ].ExtraMounts = append (kindConfig .Nodes [1 ].ExtraMounts , ecDataDirMount , k0sDirMount )
67- kindConfig .Nodes [2 ].ExtraMounts = append (kindConfig .Nodes [2 ].ExtraMounts , ecDataDirMount , k0sDirMount )
6869
6970 kubeconfig := util .SetupKindClusterFromConfig (t , kindConfig )
7071
@@ -211,17 +212,18 @@ func TestRegistry_DisableHashiRaft(t *testing.T) {
211212 })
212213
213214 // data and k0s directories are required for the admin console addon
214- ecDataDirMount := kind.Mount {
215- HostPath : util .TempDirForHostMount (t , "data-dir-*" ),
216- ContainerPath : "/var/lib/embedded-cluster" ,
217- }
218- k0sDirMount := kind.Mount {
219- HostPath : util .TempDirForHostMount (t , "k0s-dir-*" ),
220- ContainerPath : "/var/lib/embedded-cluster/k0s" ,
215+ // Each node needs its own separate data directory to avoid conflicts with local persistent volumes
216+ for i := range kindConfig .Nodes {
217+ ecDataDirMount := kind.Mount {
218+ HostPath : util .TempDirForHostMount (t , "data-dir-*" ),
219+ ContainerPath : "/var/lib/embedded-cluster" ,
220+ }
221+ k0sDirMount := kind.Mount {
222+ HostPath : util .TempDirForHostMount (t , "k0s-dir-*" ),
223+ ContainerPath : "/var/lib/embedded-cluster/k0s" ,
224+ }
225+ kindConfig .Nodes [i ].ExtraMounts = append (kindConfig .Nodes [i ].ExtraMounts , ecDataDirMount , k0sDirMount )
221226 }
222- kindConfig .Nodes [0 ].ExtraMounts = append (kindConfig .Nodes [0 ].ExtraMounts , ecDataDirMount , k0sDirMount )
223- kindConfig .Nodes [1 ].ExtraMounts = append (kindConfig .Nodes [1 ].ExtraMounts , ecDataDirMount , k0sDirMount )
224- kindConfig .Nodes [2 ].ExtraMounts = append (kindConfig .Nodes [2 ].ExtraMounts , ecDataDirMount , k0sDirMount )
225227
226228 kubeconfig := util .SetupKindClusterFromConfig (t , kindConfig )
227229
0 commit comments