Skip to content

Commit

Permalink
Merge pull request #65 from openebs/pool-on-mnt
Browse files Browse the repository at this point in the history
fix: create file over mounted path for github action kind cluster
  • Loading branch information
rohan2794 authored Sep 19, 2024
2 parents f3b81f7 + 560dcf6 commit 95938b1
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 11 deletions.
23 changes: 19 additions & 4 deletions common/lvm/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lvm

import (
"fmt"
"strings"

"github.com/openebs/openebs-e2e/common"
"github.com/openebs/openebs-e2e/common/e2e_agent"
Expand Down Expand Up @@ -132,14 +133,28 @@ func (lvmNodesDevicePvVgConfig *LvmNodesDevicePvVgConfig) ConfigureLvmNodesWithD

func SetupLvmNodes(vgName string, size int64) (LvmNodesDevicePvVgConfig, error) {
var lvmNodeConfig LvmNodesDevicePvVgConfig
loopDevice := e2e_agent.LoopDevice{
Size: size,
ImgDir: "/tmp",
}
workerNodes, err := ListLvmNode(common.NSOpenEBS())
if err != nil {
return lvmNodeConfig, fmt.Errorf("failed to list lvm worker nodes, error: %v", err)
}
if len(workerNodes) == 0 {
return lvmNodeConfig, fmt.Errorf("lvm worker nodes not found")
}
var imgDir string
// Cluster setup on github runner will have worker name starts with kind- like kind-worker, kind-worker2
// create disk image file at /mnt on host which will /host/host/mnt in e2e-agent container because
// on github runner one device is mounted
// and if worker name does not start kind- then create disk image file at /tmp directory of host
if strings.Contains(workerNodes[0], "kind-") {
imgDir = "/host/host/mnt"
} else {
imgDir = "/tmp"
}

loopDevice := e2e_agent.LoopDevice{
Size: size,
ImgDir: imgDir,
}

lvmNodeConfig = LvmNodesDevicePvVgConfig{
VgName: vgName,
Expand Down
22 changes: 18 additions & 4 deletions common/zfs/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package zfs

import (
"fmt"
"strings"

"github.com/openebs/openebs-e2e/common"
"github.com/openebs/openebs-e2e/common/e2e_agent"
Expand Down Expand Up @@ -103,14 +104,27 @@ func (zfsDevicePoolConfig *ZfsNodesDevicePoolConfig) ConfigureZfsNodesWithDevice

func SetupZfsNodes(poolName string, size int64) (ZfsNodesDevicePoolConfig, error) {
var zfsNodeConfig ZfsNodesDevicePoolConfig
loopDevice := e2e_agent.LoopDevice{
Size: size,
ImgDir: "/tmp",
}
workerNodes, err := ListZfsNode(common.NSOpenEBS())
if err != nil {
return zfsNodeConfig, fmt.Errorf("failed to list zfs worker nodes, error: %v", err)
}
if len(workerNodes) == 0 {
return zfsNodeConfig, fmt.Errorf("zfs worker nodes not found")
}
var imgDir string
// Cluster setup on github runner will have worker name starts with kind- like kind-worker, kind-worker2
// create disk image file at /mnt on host which will /host/host/mnt in e2e-agent container because
// on github runner one device is mounted
// and if worker name does not start kind- then create disk image file at /tmp directory of host
if strings.Contains(workerNodes[0], "kind-") {
imgDir = "/host/host/mnt"
} else {
imgDir = "/tmp"
}
loopDevice := e2e_agent.LoopDevice{
Size: size,
ImgDir: imgDir,
}

zfsNodeConfig = ZfsNodesDevicePoolConfig{
PoolName: poolName,
Expand Down
2 changes: 1 addition & 1 deletion tools/e2e-agent/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# as long as we do not make breaking changes.
set -e
IMAGE="openebs/e2e-agent"
TAG="v3.0.2"
TAG="v3.0.3"
registry=""
tag_as_latest=""

Expand Down
5 changes: 4 additions & 1 deletion tools/e2e-agent/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ func (disk *LoopDevice) createDiskImage() error {
if err != nil {
return fmt.Errorf("error truncating disk image. Error : %v", err)
}

err = f.Close()
if err != nil {
return fmt.Errorf("error closing disk image file %s. Error : %v", disk.ImageName, err)
}
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion tools/e2e-agent/e2e-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
securityContext:
privileged: true
allowPrivilegeEscalation: true
image: openebs/e2e-agent:v3.0.2
image: openebs/e2e-agent:v3.0.3
imagePullPolicy: Always
volumeMounts:
- name: host-root
Expand Down

0 comments on commit 95938b1

Please sign in to comment.