Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/install/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ func DaemonSet(namespace string, opts ...podTemplateOption) *appsv1api.DaemonSet
if c.forWindows {
dsName = "node-agent-windows"
}
hostPodsVolumePath := filepath.Join(c.kubeletRootDir, "pods")
hostPluginsVolumePath := filepath.Join(c.kubeletRootDir, "plugins")
// Use forward slashes for hostPath paths to ensure POSIX-style paths in generated manifests
// even when velero CLI runs on Windows. Kubernetes hostPath.path must use '/' separator.
kubeletRoot := strings.TrimRight(c.kubeletRootDir, "/\\")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubeletRootDir could be specified by users, so in a Windows cluster, users may specify a Windows styled path, e.g., C:\\var\\lib\\kubelet.
As a result, it ends with a path mixed with / and \\, e.g., C:\\var\\lib\\kubelet/pods.

Even though Windows supports this mix, but since you are making this change for the purpose of Use forward slashes for hostPath paths to ensure POSIX-style path in generated manifests and it looks the right way, could you consider the above case and make the entire path in POSIX style?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --use-node-agent flag indicates that an agent must be deployed on the Linux cluster.

Copy link
Contributor

@Lyndon-Li Lyndon-Li Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the code here is shared by both linux cluster installation and Windows cluster installation.

hostPodsVolumePath := kubeletRoot + "/pods"
hostPluginsVolumePath := kubeletRoot + "/plugins"
volumes := []corev1api.Volume{}
volumeMounts := []corev1api.VolumeMount{}
if !c.nodeAgentDisableHostPath {
Expand Down