windows hostpath
This commit is contained in:
parent
8014fed9c0
commit
c6f9fd9a6e
|
|
@ -309,24 +309,31 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- local-hostpath/basic.yaml
|
||||
os: [Linux, Windows]
|
||||
include:
|
||||
- os: Linux
|
||||
template: "./ci/configs/local-hostpath/basic.yaml"
|
||||
run: |
|
||||
# run tests
|
||||
ci/bin/run.sh
|
||||
- os: Windows
|
||||
template: ".\\ci\\configs\\local-hostpath/basic.yaml"
|
||||
run: |
|
||||
# run tests
|
||||
ci\bin\run.ps1
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- ${{ matrix.os }}
|
||||
- X64
|
||||
- csi-sanity-zfs-local
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: node-modules-linux-amd64
|
||||
- name: csi-sanity
|
||||
run: |
|
||||
# run tests
|
||||
ci/bin/run.sh
|
||||
run: ${{ matrix.run }}
|
||||
env:
|
||||
TEMPLATE_CONFIG_FILE: "./ci/configs/${{ matrix.config }}"
|
||||
TEMPLATE_CONFIG_FILE: "${{ matrix.template }}"
|
||||
CSI_SANITY_SKIP: "should fail when requesting to create a snapshot with already existing name and different source volume ID|should fail when requesting to create a volume with already existing name and different capacity"
|
||||
|
||||
csi-sanity-windows-node:
|
||||
|
|
@ -356,6 +363,7 @@ jobs:
|
|||
SERVER_HOST: ${{ secrets.SANITY_ZFS_GENERIC_HOST }}
|
||||
SERVER_USERNAME: ${{ secrets.SANITY_ZFS_GENERIC_USERNAME }}
|
||||
SERVER_PASSWORD: ${{ secrets.SANITY_ZFS_GENERIC_PASSWORD }}
|
||||
CSI_SANITY_FOCUS: "Node Service"
|
||||
|
||||
build-docker-linux:
|
||||
needs:
|
||||
|
|
|
|||
|
|
@ -10,39 +10,48 @@ $exit_code = 0
|
|||
$tmpdir = New-Item -ItemType Directory -Path ([System.IO.Path]::GetTempPath()) -Name ([System.IO.Path]::GetRandomFileName())
|
||||
$env:CSI_SANITY_TEMP_DIR = $tmpdir.FullName
|
||||
|
||||
if (! $env:CSI_SANITY_FOCUS) {
|
||||
$env:CSI_SANITY_FOCUS = "Node Service"
|
||||
}
|
||||
|
||||
if (! $env:CSI_SANITY_SKIP) {
|
||||
$env:CSI_SANITY_SKIP = ""
|
||||
}
|
||||
|
||||
# cleanse endpoint to something csi-sanity plays nicely with
|
||||
$endpoint = ${env:CSI_ENDPOINT}
|
||||
$endpoint = $endpoint.replace("C:\", "/")
|
||||
$endpoint = $endpoint.replace("\", "/")
|
||||
|
||||
if (! $env:CSI_SANITY_FAILFAST) {
|
||||
$env:CSI_SANITY_FAILFAST = "false"
|
||||
}
|
||||
|
||||
$failfast = ""
|
||||
|
||||
if ($env:CSI_SANITY_FAILFAST -eq "true") {
|
||||
$failfast = "-ginkgo.failFast"
|
||||
}
|
||||
|
||||
Write-Output "launching csi-sanity"
|
||||
Write-Output "connecting to: ${endpoint}"
|
||||
Write-Output "failfast: ${env:CSI_SANITY_FAILFAST}"
|
||||
Write-Output "skip: ${env:CSI_SANITY_SKIP}"
|
||||
Write-Output "focus: ${env:CSI_SANITY_FOCUS}"
|
||||
|
||||
$skip = '"' + ${env:CSI_SANITY_SKIP} + '"'
|
||||
$focus = '"' + ${env:CSI_SANITY_FOCUS} + '"'
|
||||
|
||||
csi-sanity.exe -"csi.endpoint" "unix://${endpoint}" `
|
||||
-"ginkgo.failFast" `
|
||||
$failfast `
|
||||
-"csi.mountdir" "${env:CSI_SANITY_TEMP_DIR}\mnt" `
|
||||
-"csi.stagingdir" "${env:CSI_SANITY_TEMP_DIR}\stage" `
|
||||
-"csi.testvolumeexpandsize" 2147483648 `
|
||||
-"csi.testvolumesize" 1073741824 `
|
||||
-"ginkgo.focus" "${env:CSI_SANITY_FOCUS}"
|
||||
-"ginkgo.skip" $skip `
|
||||
-"ginkgo.focus" $focus
|
||||
|
||||
# does not work the same as linux for some reason
|
||||
#-"ginkgo.skip" "${env:CSI_SANITY_SKIP}" `
|
||||
# -"ginkgo.skip" "'" + ${env:CSI_SANITY_SKIP} + "'" `
|
||||
|
||||
if (-not $?) {
|
||||
$exit_code = $LASTEXITCODE
|
||||
Write-Output "csi-sanity exit code: ${exit_code}"
|
||||
$exit_code = 1
|
||||
if ($exit_code -gt 0) {
|
||||
$exit_code = 1
|
||||
}
|
||||
}
|
||||
|
||||
# remove tmp dir
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
|||
//let volume_content_source_volume_id;
|
||||
|
||||
// create target dir
|
||||
await driver.createDir(target_path);
|
||||
await driver.createDir(volume_path);
|
||||
|
||||
// create dataset
|
||||
if (volume_content_source) {
|
||||
|
|
|
|||
|
|
@ -1222,10 +1222,10 @@ class CsiBaseDriver {
|
|||
break;
|
||||
case NODE_OS_DRIVER_WINDOWS:
|
||||
// sanity check node_attach_driver
|
||||
if (!["smb", "iscsi"].includes(node_attach_driver)) {
|
||||
if (!["smb", "iscsi", "hostpath"].includes(node_attach_driver)) {
|
||||
throw new GrpcError(
|
||||
grpc.status.UNIMPLEMENTED,
|
||||
`csi-proxy does not work with node_attach_driver: ${node_attach_driver}`
|
||||
`windows does not work with node_attach_driver: ${node_attach_driver}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1233,7 +1233,7 @@ class CsiBaseDriver {
|
|||
if (fs_type && !["ntfs", "cifs"].includes(fs_type)) {
|
||||
throw new GrpcError(
|
||||
grpc.status.UNIMPLEMENTED,
|
||||
`csi-proxy does not work with fs_type: ${fs_type}`
|
||||
`windows does not work with fs_type: ${fs_type}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1592,6 +1592,39 @@ class CsiBaseDriver {
|
|||
);
|
||||
}
|
||||
break;
|
||||
case "hostpath":
|
||||
try {
|
||||
fs.statSync(win_staging_target_path);
|
||||
result = true;
|
||||
} catch (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
result = false;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// if exists already delete if folder, return if symlink
|
||||
if (result) {
|
||||
result = fs.lstatSync(win_staging_target_path);
|
||||
// remove pre-created dir by CO
|
||||
if (!result.isSymbolicLink()) {
|
||||
fs.rmdirSync(win_staging_target_path);
|
||||
} else {
|
||||
// assume symlink points to the correct location
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// create symlink
|
||||
fs.symlinkSync(
|
||||
filesystem.covertUnixSeparatorToWindowsSeparator(
|
||||
volume_context.path
|
||||
),
|
||||
win_staging_target_path
|
||||
);
|
||||
return {};
|
||||
break;
|
||||
default:
|
||||
throw new GrpcError(
|
||||
grpc.status.INVALID_ARGUMENT,
|
||||
|
|
@ -2254,6 +2287,9 @@ class CsiBaseDriver {
|
|||
// delete target/target portal/etc
|
||||
// do NOT do this now as removing the portal will remove all targets associated with it
|
||||
break;
|
||||
case "hostpath":
|
||||
// allow below code to remove symlink
|
||||
break;
|
||||
case "bypass":
|
||||
break;
|
||||
default:
|
||||
|
|
@ -2560,7 +2596,7 @@ class CsiBaseDriver {
|
|||
case "smb":
|
||||
//case "lustre":
|
||||
//case "oneclient":
|
||||
//case "hostpath":
|
||||
case "hostpath":
|
||||
case "iscsi":
|
||||
//case "zfs-local":
|
||||
// ensure appropriate directories/files
|
||||
|
|
@ -2956,7 +2992,7 @@ class CsiBaseDriver {
|
|||
|
||||
let node_attach_driver;
|
||||
|
||||
let target = await wutils.GetRealTarget(win_volume_path);
|
||||
let target = await wutils.GetRealTarget(win_volume_path) || "";
|
||||
if (target.startsWith("\\\\")) {
|
||||
node_attach_driver = "smb";
|
||||
}
|
||||
|
|
@ -2987,6 +3023,7 @@ class CsiBaseDriver {
|
|||
];
|
||||
break;
|
||||
case "bypass":
|
||||
res.usage = [{ total: 0, unit: "BYTES" }];
|
||||
break;
|
||||
default:
|
||||
throw new GrpcError(
|
||||
|
|
|
|||
Loading…
Reference in New Issue