Skip to content

Commit c272055

Browse files
ls-2018刘硕
and
刘硕
authoredNov 16, 2023
[Feature] Add force image pull (openkruise#1385)
Signed-off-by: 刘硕 <[email protected]> Co-authored-by: 刘硕 <[email protected]>
1 parent 01717ff commit c272055

File tree

582 files changed

+57238
-7167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

582 files changed

+57238
-7167
lines changed
 

‎apis/apps/defaults/v1alpha1.go

+3
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ func SetDefaultsImagePullJob(obj *v1alpha1.ImagePullJob) {
385385
if obj.Spec.PullPolicy.BackoffLimit == nil {
386386
obj.Spec.PullPolicy.BackoffLimit = utilpointer.Int32Ptr(3)
387387
}
388+
if obj.Spec.ImagePullPolicy == "" {
389+
obj.Spec.ImagePullPolicy = v1alpha1.PullIfNotPresent
390+
}
388391
}
389392

390393
// SetDefaultsImageListPullJob set default values for ImageListPullJob.

‎apis/apps/v1alpha1/imagepulljob_types.go

+16
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ const (
2727
ImagePreDownloadMinUpdatedReadyPods = "apps.kruise.io/image-predownload-min-updated-ready-pods"
2828
)
2929

30+
// ImagePullPolicy describes a policy for if/when to pull a container image
31+
// +enum
32+
type ImagePullPolicy string
33+
34+
const (
35+
// PullAlways means that kruise-daemon always attempts to pull the latest image.
36+
PullAlways ImagePullPolicy = "Always"
37+
// PullIfNotPresent means that kruise-daemon pulls if the image isn't present on disk.
38+
PullIfNotPresent ImagePullPolicy = "IfNotPresent"
39+
)
40+
3041
// ImagePullJobSpec defines the desired state of ImagePullJob
3142
type ImagePullJobSpec struct {
3243
// Image is the image to be pulled by the job
@@ -69,6 +80,11 @@ type ImagePullJobTemplate struct {
6980
// SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs
7081
// +optional
7182
SandboxConfig *SandboxConfig `json:"sandboxConfig,omitempty"`
83+
84+
// Image pull policy.
85+
// One of Always, IfNotPresent. Defaults to IfNotPresent.
86+
// +optional
87+
ImagePullPolicy ImagePullPolicy `json:"imagePullPolicy,omitempty"`
7288
}
7389

7490
// ImagePullJobPodSelector is a selector over pods

0 commit comments

Comments
 (0)
Please sign in to comment.