@@ -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
@@ -215,17 +216,18 @@ func TestRegistry_DisableHashiRaft(t *testing.T) {
215216 })
216217
217218 // data and k0s directories are required for the admin console addon
218- ecDataDirMount := kind.Mount {
219- HostPath : util .TempDirForHostMount (t , "data-dir-*" ),
220- ContainerPath : "/var/lib/embedded-cluster" ,
221- }
222- k0sDirMount := kind.Mount {
223- HostPath : util .TempDirForHostMount (t , "k0s-dir-*" ),
224- ContainerPath : "/var/lib/embedded-cluster/k0s" ,
219+ // Each node needs its own separate data directory to avoid conflicts with local persistent volumes
220+ for i := range kindConfig .Nodes {
221+ ecDataDirMount := kind.Mount {
222+ HostPath : util .TempDirForHostMount (t , "data-dir-*" ),
223+ ContainerPath : "/var/lib/embedded-cluster" ,
224+ }
225+ k0sDirMount := kind.Mount {
226+ HostPath : util .TempDirForHostMount (t , "k0s-dir-*" ),
227+ ContainerPath : "/var/lib/embedded-cluster/k0s" ,
228+ }
229+ kindConfig .Nodes [i ].ExtraMounts = append (kindConfig .Nodes [i ].ExtraMounts , ecDataDirMount , k0sDirMount )
225230 }
226- kindConfig .Nodes [0 ].ExtraMounts = append (kindConfig .Nodes [0 ].ExtraMounts , ecDataDirMount , k0sDirMount )
227- kindConfig .Nodes [1 ].ExtraMounts = append (kindConfig .Nodes [1 ].ExtraMounts , ecDataDirMount , k0sDirMount )
228- kindConfig .Nodes [2 ].ExtraMounts = append (kindConfig .Nodes [2 ].ExtraMounts , ecDataDirMount , k0sDirMount )
229231
230232 kubeconfig := util .SetupKindClusterFromConfig (t , kindConfig )
231233
0 commit comments