-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ImageListPullJob to simplify ImagePullJob
Signed-off-by: liuzhenwei <dui_zhang@163.com> calculate status for imagelistpulljob Signed-off-by: liuzhenwei <dui_zhang@163.com> make generate manifests Signed-off-by: liuzhenwei <dui_zhang@163.com> add imagelistpulljob.status.status Signed-off-by: liuzhenwei <dui_zhang@163.com> make generate manifests Signed-off-by: liuzhenwei <dui_zhang@163.com> regist webhook handler delete image pull job which is not existed in ImageListPullJob.Spec.Images Signed-off-by: liuzhenwei <dui_zhang@163.com> support the same behavior as image pull job for TTLSecondsAfterFinished and CompletionTime fields Signed-off-by: liuzhenwei <dui_zhang@163.com> resourceVersionExpectations Signed-off-by: liuzhenwei <dui_zhang@163.com> add ut Signed-off-by: liuzhenwei <dui_zhang@163.com> verify the maximum number of images cannot > 255 Signed-off-by: liuzhenwei <dui_zhang@163.com> make generate manifests Signed-off-by: liuzhenwei <dui_zhang@163.com> add failled image pull job status Signed-off-by: liuzhenwei <dui_zhang@163.com> add proposal doc && supoort ImagePullJobTemplate field Signed-off-by: liuzhenwei <dui_zhang@163.com>
- Loading branch information
Showing
32 changed files
with
2,778 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
/* | ||
Copyright 2023 The Kruise Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/util/intstr" | ||
) | ||
|
||
// ImageListPullJobSpec defines the desired state of ImageListPullJob | ||
type ImageListPullJobSpec struct { | ||
|
||
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling the image. | ||
// If specified, these secrets will be passed to individual puller implementations for them to use. For example, | ||
// in the case of docker, only DockerConfig type secrets are honored. | ||
// +optional | ||
PullSecrets []string `json:"pullSecrets,omitempty"` | ||
|
||
// Selector is a query over nodes that should match the job. | ||
// nil to match all nodes. | ||
// +optional | ||
Selector *ImagePullJobNodeSelector `json:"selector,omitempty"` | ||
|
||
// PodSelector is a query over pods that should pull image on nodes of these pods. | ||
// Mutually exclusive with Selector. | ||
// +optional | ||
PodSelector *ImagePullJobPodSelector `json:"podSelector,omitempty"` | ||
|
||
// Parallelism is the requested parallelism, it can be set to any non-negative value. If it is unspecified, | ||
// it defaults to 1. If it is specified as 0, then the Job is effectively paused until it is increased. | ||
// +optional | ||
Parallelism *intstr.IntOrString `json:"parallelism,omitempty"` | ||
|
||
// PullPolicy is an optional field to set parameters of the pulling task. If not specified, | ||
// the system will use the default values. | ||
// +optional | ||
PullPolicy *PullPolicy `json:"pullPolicy,omitempty"` | ||
|
||
// CompletionPolicy indicates the completion policy of the job. | ||
// Default is Always CompletionPolicyType. | ||
CompletionPolicy CompletionPolicy `json:"completionPolicy"` | ||
|
||
// SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs | ||
// +optional | ||
SandboxConfig *SandboxConfig `json:"sandboxConfig,omitempty"` | ||
|
||
// ImagePullJobTemplate imagePullJobSpec list | ||
ImagePullJobTemplate []ImagePullJobSpec `json:"imagePullJobTemplate"` | ||
} | ||
|
||
// ImageListPullJobStatus defines the observed state of ImageListPullJob | ||
type ImageListPullJobStatus struct { | ||
// Represents time when the job was acknowledged by the job controller. | ||
// It is not guaranteed to be set in happens-before order across separate operations. | ||
// It is represented in RFC3339 form and is in UTC. | ||
// +optional | ||
StartTime *metav1.Time `json:"startTime,omitempty"` | ||
|
||
// Represents time when the all the image pull job was completed. It is not guaranteed to | ||
// be set in happens-before order across separate operations. | ||
// It is represented in RFC3339 form and is in UTC. | ||
// +optional | ||
CompletionTime *metav1.Time `json:"completionTime,omitempty"` | ||
|
||
// The desired number of ImagePullJobs, this is typically equal to the number of len(spec.Images). | ||
Desired int32 `json:"desired"` | ||
|
||
// The number of actively running ImagePullJobs(status.ACTIVE>0). | ||
// +optional | ||
Active int32 `json:"active"` | ||
|
||
// The number of ImagePullJobs which status.CompletionTime!=nil | ||
// +optional | ||
Completed int32 `json:"completed"` | ||
|
||
// The number of image pull job which status.Failed==0. | ||
// +optional | ||
Succeeded int32 `json:"succeeded"` | ||
|
||
// Succeeded/Completed | ||
// +optional | ||
Status string `json:"status"` | ||
|
||
// The status of ImagePullJob which has the failed nodes(status.Failed>0) . | ||
// +optional | ||
FailedImagePullJobStatuses []*FailedImagePullJobStatus `json:"failedImagePullJobStatuses,omitempty"` | ||
} | ||
|
||
// FailedImagePullJobStatus the state of ImagePullJob which has the failed nodes(status.Failed>0) | ||
type FailedImagePullJobStatus struct { | ||
// The name of ImagePullJob which has the failed nodes(status.Failed>0) | ||
// +optional | ||
Name string `json:"name,omitempty"` | ||
|
||
// Image is the image to be pulled by the job | ||
// +optional | ||
Image string `json:"image,omitempty"` | ||
|
||
// The number of pulling tasks which reached phase Failed of this ImagePullJob. | ||
// +optional | ||
Failed int32 `json:"failed,omitempty"` | ||
|
||
// The nodes that failed to pull the image of this ImagePullJob. | ||
// +optional | ||
FailedNodes []string `json:"failedNodes,omitempty"` | ||
} | ||
|
||
// +genclient | ||
// +k8s:openapi-gen=true | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="TOTAL",type="integer",JSONPath=".status.desired",description="Number of image pull job" | ||
// +kubebuilder:printcolumn:name="ACTIVE",type="integer",JSONPath=".status.active",description="Number of image pull job active" | ||
// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.status",description="status.succeeded/status.completed" | ||
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." | ||
|
||
// ImageListPullJob is the Schema for the imagelistpulljobs API | ||
type ImageListPullJob struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ImageListPullJobSpec `json:"spec,omitempty"` | ||
Status ImageListPullJobStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// ImageListPullJobList contains a list of ImageListPullJob | ||
type ImageListPullJobList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []ImageListPullJob `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&ImageListPullJob{}, &ImageListPullJobList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.