in executors/kubernetes/kubernetes.go [1527:1586]
func (s *executor) getVolumeMountsForConfig() []api.VolumeMount {
var mounts []api.VolumeMount
for _, mount := range s.Config.Kubernetes.Volumes.HostPaths {
mounts = append(mounts, api.VolumeMount{
Name: mount.Name,
MountPath: s.Build.GetAllVariables().ExpandValue(mount.MountPath),
SubPath: s.Build.GetAllVariables().ExpandValue(mount.SubPath),
ReadOnly: mount.ReadOnly,
MountPropagation: (*api.MountPropagationMode)(mount.MountPropagation),
})
}
for _, mount := range s.Config.Kubernetes.Volumes.Secrets {
mounts = append(mounts, api.VolumeMount{
Name: mount.Name,
MountPath: s.Build.GetAllVariables().ExpandValue(mount.MountPath),
SubPath: s.Build.GetAllVariables().ExpandValue(mount.SubPath),
ReadOnly: mount.ReadOnly,
})
}
for _, mount := range s.Config.Kubernetes.Volumes.PVCs {
mounts = append(mounts, api.VolumeMount{
Name: s.Build.GetAllVariables().ExpandValue(mount.Name),
MountPath: s.Build.GetAllVariables().ExpandValue(mount.MountPath),
SubPath: s.Build.GetAllVariables().ExpandValue(mount.SubPath),
ReadOnly: mount.ReadOnly,
MountPropagation: (*api.MountPropagationMode)(mount.MountPropagation),
})
}
for _, mount := range s.Config.Kubernetes.Volumes.ConfigMaps {
mounts = append(mounts, api.VolumeMount{
Name: mount.Name,
MountPath: s.Build.GetAllVariables().ExpandValue(mount.MountPath),
SubPath: s.Build.GetAllVariables().ExpandValue(mount.SubPath),
ReadOnly: mount.ReadOnly,
})
}
for _, mount := range s.Config.Kubernetes.Volumes.EmptyDirs {
mounts = append(mounts, api.VolumeMount{
Name: mount.Name,
MountPath: s.Build.GetAllVariables().ExpandValue(mount.MountPath),
SubPath: s.Build.GetAllVariables().ExpandValue(mount.SubPath),
})
}
for _, mount := range s.Config.Kubernetes.Volumes.CSIs {
mounts = append(mounts, api.VolumeMount{
Name: mount.Name,
MountPath: s.Build.GetAllVariables().ExpandValue(mount.MountPath),
SubPath: s.Build.GetAllVariables().ExpandValue(mount.SubPath),
ReadOnly: mount.ReadOnly,
})
}
return mounts
}