mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #98629 from wzshiming/fix-pull-image-url
Fix pull empty image URL
This commit is contained in:
commit
70481591b3
@ -60,7 +60,6 @@ var NodePrePullImageList = sets.NewString(
|
|||||||
imageutils.GetE2EImage(imageutils.Perl),
|
imageutils.GetE2EImage(imageutils.Perl),
|
||||||
imageutils.GetE2EImage(imageutils.Nonewprivs),
|
imageutils.GetE2EImage(imageutils.Nonewprivs),
|
||||||
imageutils.GetPauseImageName(),
|
imageutils.GetPauseImageName(),
|
||||||
getGPUDevicePluginImage(),
|
|
||||||
imageutils.GetE2EImage(imageutils.NodePerfNpbEp),
|
imageutils.GetE2EImage(imageutils.NodePerfNpbEp),
|
||||||
imageutils.GetE2EImage(imageutils.NodePerfNpbIs),
|
imageutils.GetE2EImage(imageutils.NodePerfNpbIs),
|
||||||
imageutils.GetE2EImage(imageutils.NodePerfTfWideDeep),
|
imageutils.GetE2EImage(imageutils.NodePerfTfWideDeep),
|
||||||
@ -75,7 +74,16 @@ func updateImageAllowList() {
|
|||||||
framework.ImagePrePullList = NodePrePullImageList.Union(commontest.PrePulledImages)
|
framework.ImagePrePullList = NodePrePullImageList.Union(commontest.PrePulledImages)
|
||||||
// Images from extra envs
|
// Images from extra envs
|
||||||
framework.ImagePrePullList.Insert(getNodeProblemDetectorImage())
|
framework.ImagePrePullList.Insert(getNodeProblemDetectorImage())
|
||||||
framework.ImagePrePullList.Insert(getSRIOVDevicePluginImage())
|
if sriovDevicePluginImage, err := getSRIOVDevicePluginImage(); err != nil {
|
||||||
|
klog.Errorln(err)
|
||||||
|
} else {
|
||||||
|
framework.ImagePrePullList.Insert(sriovDevicePluginImage)
|
||||||
|
}
|
||||||
|
if gpuDevicePluginImage, err := getGPUDevicePluginImage(); err != nil {
|
||||||
|
klog.Errorln(err)
|
||||||
|
} else {
|
||||||
|
framework.ImagePrePullList.Insert(gpuDevicePluginImage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNodeProblemDetectorImage() string {
|
func getNodeProblemDetectorImage() string {
|
||||||
@ -214,42 +222,35 @@ func PrePullAllImages() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getGPUDevicePluginImage returns the image of GPU device plugin.
|
// getGPUDevicePluginImage returns the image of GPU device plugin.
|
||||||
func getGPUDevicePluginImage() string {
|
func getGPUDevicePluginImage() (string, error) {
|
||||||
ds, err := e2emanifest.DaemonSetFromURL(e2egpu.GPUDevicePluginDSYAML)
|
ds, err := e2emanifest.DaemonSetFromURL(e2egpu.GPUDevicePluginDSYAML)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("Failed to parse the device plugin image: %v", err)
|
return "", fmt.Errorf("failed to parse the device plugin image: %w", err)
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
if ds == nil {
|
if ds == nil {
|
||||||
klog.Errorf("Failed to parse the device plugin image: the extracted DaemonSet is nil")
|
return "", fmt.Errorf("failed to parse the device plugin image: the extracted DaemonSet is nil")
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
if len(ds.Spec.Template.Spec.Containers) < 1 {
|
if len(ds.Spec.Template.Spec.Containers) < 1 {
|
||||||
klog.Errorf("Failed to parse the device plugin image: cannot extract the container from YAML")
|
return "", fmt.Errorf("failed to parse the device plugin image: cannot extract the container from YAML")
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
return ds.Spec.Template.Spec.Containers[0].Image
|
return ds.Spec.Template.Spec.Containers[0].Image, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getSRIOVDevicePluginImage returns the image of SRIOV device plugin.
|
// getSRIOVDevicePluginImage returns the image of SRIOV device plugin.
|
||||||
func getSRIOVDevicePluginImage() string {
|
func getSRIOVDevicePluginImage() (string, error) {
|
||||||
data, err := e2etestfiles.Read(SRIOVDevicePluginDSYAML)
|
data, err := e2etestfiles.Read(SRIOVDevicePluginDSYAML)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("Failed to read the device plugin manifest: %v", err)
|
return "", fmt.Errorf("failed to read the device plugin manifest: %w", err)
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
ds, err := e2emanifest.DaemonSetFromData(data)
|
ds, err := e2emanifest.DaemonSetFromData(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("Failed to parse the device plugin image: %v", err)
|
return "", fmt.Errorf("failed to parse the device plugin image: %w", err)
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
if ds == nil {
|
if ds == nil {
|
||||||
klog.Errorf("Failed to parse the device plugin image: the extracted DaemonSet is nil")
|
return "", fmt.Errorf("failed to parse the device plugin image: the extracted DaemonSet is nil")
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
if len(ds.Spec.Template.Spec.Containers) < 1 {
|
if len(ds.Spec.Template.Spec.Containers) < 1 {
|
||||||
klog.Errorf("Failed to parse the device plugin image: cannot extract the container from YAML")
|
return "", fmt.Errorf("failed to parse the device plugin image: cannot extract the container from YAML")
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
return ds.Spec.Template.Spec.Containers[0].Image
|
return ds.Spec.Template.Spec.Containers[0].Image, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user