Skip to content

Commit 0644523

Browse files
committed
Made a no-op windows implementation of the linkcache package
1 parent 804505a commit 0644523

File tree

5 files changed

+42
-15
lines changed

5 files changed

+42
-15
lines changed

manifest_osversion.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -o xtrace
44

55
# The following is a workaround for issue https://github.com/moby/moby/issues/41417
66
# to manually inserver os.version information into docker manifest file
7-
# TODO: once docker manifest annotation for os.versions is availabler for the installed docker here,
7+
# TODO: once docker manifest annotation for os.versions is available for the installed docker here,
88
# replace the following with annotation approach. https://github.com/docker/cli/pull/2578
99

1010
export DOCKER_CLI_EXPERIMENTAL=enabled
@@ -14,7 +14,7 @@ IFS=', ' read -r -a imagetags <<< "$WINDOWS_IMAGE_TAGS"
1414
IFS=', ' read -r -a baseimages <<< "$WINDOWS_BASE_IMAGES"
1515
MANIFEST_TAG=${STAGINGIMAGE}:${STAGINGVERSION}
1616

17-
# translate from image tag to docker manifest foler format
17+
# translate from image tag to docker manifest folder format
1818
# e.g., gcr.io_k8s-staging-csi_gce-pd-windows-v2
1919
manifest_folder=$(echo "${MANIFEST_TAG}" | sed "s|/|_|g" | sed "s/:/-/")
2020
echo ${manifest_folder}

pkg/linkcache/cache_test.go

Lines changed: 0 additions & 1 deletion
This file was deleted.

pkg/linkcache/devices.go renamed to pkg/linkcache/devices_linux.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ import (
1515

1616
const byIdDir = "/dev/disk/by-id"
1717

18-
type deviceMapping struct {
19-
symlink string
20-
realPath string
21-
}
22-
23-
type DeviceCache struct {
24-
volumes map[string]deviceMapping
25-
period time.Duration
26-
// dir is the directory to look for device symlinks
27-
dir string
28-
}
29-
3018
func NewDeviceCacheForNode(ctx context.Context, period time.Duration, nodeName string) (*DeviceCache, error) {
3119
node, err := k8sclient.GetNodeWithRetry(ctx, nodeName)
3220
if err != nil {

pkg/linkcache/devices_windows.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//go:build windows
2+
3+
package linkcache
4+
5+
import (
6+
"context"
7+
"fmt"
8+
"time"
9+
)
10+
11+
func NewDeviceCacheForNode(ctx context.Context, period time.Duration, nodeName string) (*DeviceCache, error) {
12+
return nil, fmt.Errorf("NewDeviceCacheForNode is not implemented for Windows")
13+
}
14+
15+
func (d *DeviceCache) Run(ctx context.Context) {
16+
// Not implemented for Windows
17+
}
18+
19+
func (d *DeviceCache) AddVolume(volumeID string) error {
20+
return fmt.Errorf("AddVolume is not implemented for Windows")
21+
}
22+
23+
func (d *DeviceCache) RemoveVolume(volumeID string) {
24+
// Not implemented for Windows
25+
}

pkg/linkcache/types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package linkcache
2+
3+
import "time"
4+
5+
type deviceMapping struct {
6+
symlink string
7+
realPath string
8+
}
9+
10+
type DeviceCache struct {
11+
volumes map[string]deviceMapping
12+
period time.Duration
13+
// dir is the directory to look for device symlinks
14+
dir string
15+
}

0 commit comments

Comments
 (0)