mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
issue 8960: implement PodVolume exposer for PVB/PVR
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -42,8 +42,8 @@ const (
|
||||
// nodeAgentRole marks pods with node-agent role on all nodes.
|
||||
nodeAgentRole = "node-agent"
|
||||
|
||||
// hostPodVolume is the name of the volume in node-agent for host-pod mount
|
||||
hostPodVolume = "host-pods"
|
||||
// HostPodVolumeMount is the name of the volume in node-agent for host-pod mount
|
||||
HostPodVolumeMount = "host-pods"
|
||||
|
||||
// HostPodVolumeMountPoint is the mount point of the volume in node-agent for host-pod mount
|
||||
HostPodVolumeMountPoint = "host_pods"
|
||||
@@ -269,7 +269,7 @@ func GetHostPodPath(ctx context.Context, kubeClient kubernetes.Interface, namesp
|
||||
|
||||
var volume *corev1api.Volume
|
||||
for _, v := range ds.Spec.Template.Spec.Volumes {
|
||||
if v.Name == hostPodVolume {
|
||||
if v.Name == HostPodVolumeMount {
|
||||
volume = &v
|
||||
break
|
||||
}
|
||||
@@ -289,3 +289,11 @@ func GetHostPodPath(ctx context.Context, kubeClient kubernetes.Interface, namesp
|
||||
|
||||
return volume.HostPath.Path, nil
|
||||
}
|
||||
|
||||
func HostPodVolumeMountPath() string {
|
||||
return "/" + HostPodVolumeMountPoint
|
||||
}
|
||||
|
||||
func HostPodVolumeMountPathWin() string {
|
||||
return "\\" + HostPodVolumeMountPoint
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ func TestGetHostPodPath(t *testing.T) {
|
||||
Spec: corev1api.PodSpec{
|
||||
Volumes: []corev1api.Volume{
|
||||
{
|
||||
Name: hostPodVolume,
|
||||
Name: HostPodVolumeMount,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -636,7 +636,7 @@ func TestGetHostPodPath(t *testing.T) {
|
||||
Spec: corev1api.PodSpec{
|
||||
Volumes: []corev1api.Volume{
|
||||
{
|
||||
Name: hostPodVolume,
|
||||
Name: HostPodVolumeMount,
|
||||
VolumeSource: corev1api.VolumeSource{
|
||||
HostPath: &corev1api.HostPathVolumeSource{},
|
||||
},
|
||||
@@ -660,7 +660,7 @@ func TestGetHostPodPath(t *testing.T) {
|
||||
Spec: corev1api.PodSpec{
|
||||
Volumes: []corev1api.Volume{
|
||||
{
|
||||
Name: hostPodVolume,
|
||||
Name: HostPodVolumeMount,
|
||||
VolumeSource: corev1api.VolumeSource{
|
||||
HostPath: &corev1api.HostPathVolumeSource{
|
||||
Path: "/var/lib/kubelet/pods",
|
||||
|
||||
Reference in New Issue
Block a user