Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions provisioner/pkg/deleter/jobcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ func (c *jobController) RemoveJob(pvName string) (CleanupState, *time.Time, erro
}

// NewCleanupJob creates manifest for a cleaning job.
func NewCleanupJob(pv *apiv1.PersistentVolume, volMode apiv1.PersistentVolumeMode, imageName string, nodeName string, namespace string, mountPath string,
config common.MountConfig) (*batch_v1.Job, error) {
func NewCleanupJob(pv *apiv1.PersistentVolume, volMode apiv1.PersistentVolumeMode, imageName string, nodeName string, namespace string, mountPath string, config common.MountConfig) (*batch_v1.Job, error) {
priv := true
// Container definition
jobContainer := apiv1.Container{
Expand Down Expand Up @@ -290,7 +289,24 @@ func NewCleanupJob(pv *apiv1.PersistentVolume, volMode apiv1.PersistentVolumeMod
Name: mountName,
MountPath: config.MountDir},
}

if volMode == apiv1.PersistentVolumeBlock {
// We need to mount /dev into clean job for block volume.
// Note that in certain docker setup, this may override `/dev/init`
// which is mounted by docker to start container process.
// https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner/issues/50
volumes = append(volumes, apiv1.Volume{
Name: "dev",
VolumeSource: apiv1.VolumeSource{
HostPath: &apiv1.HostPathVolumeSource{
Path: "/dev",
},
},
})
jobContainer.VolumeMounts = append(jobContainer.VolumeMounts, apiv1.VolumeMount{
Name: "dev",
MountPath: "/dev",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm assuming this doesn't have any issues if we override the container's /dev?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, to discover and cleanup we need to mount host /dev into provisioner and cleanup containers.
Potential issue is in certain docker setup program cannot start when host /dev is mounted into container, but provisioner cannot too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a comment with a link to the issue?

I assume mounting /dev somewhere else won't work because of symlink resolution issues?

Copy link
Copy Markdown
Member Author

@cofyc cofyc Mar 20, 2019

Choose a reason for hiding this comment

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

Updated.

I assume mounting /dev somewhere else won't work because of symlink resolution issues?

Yes

})
}
// Make job query-able by some useful labels for admins.
labels := map[string]string{
common.NodeNameLabel: nodeName,
Expand Down
Loading