-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KEP-672: Implement the DependsOn API #740
base: main
Are you sure you want to change the base?
Changes from all commits
718087c
6f58d62
7463e32
3024bf4
ee80b1c
fd02136
7d06e74
3f2a576
ac32d7c
b6889b7
4394179
c7cbe97
13e133c
0df9651
c0bf232
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -79,6 +79,8 @@ const ( | |||
) | ||||
|
||||
// JobSetSpec defines the desired state of JobSet | ||||
// +kubebuilder:validation:XValidation:rule="!(has(self.startupPolicy) && self.startupPolicy.startupPolicyOrder == 'InOrder' && self.replicatedJobs.exists(x, has(x.dependsOn)))",message="StartupPolicy and DependsOn APIs are mutually exclusive" | ||||
// +kubebuilder:validation:XValidation:rule="!(has(self.replicatedJobs[0].dependsOn))",message="DependsOn can't be set for the first ReplicatedJob" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the test case:
|
||||
type JobSetSpec struct { | ||||
// ReplicatedJobs is the group of jobs that will form the set. | ||||
// +listType=map | ||||
|
@@ -105,6 +107,7 @@ type JobSetSpec struct { | |||
FailurePolicy *FailurePolicy `json:"failurePolicy,omitempty"` | ||||
|
||||
// StartupPolicy, if set, configures in what order jobs must be started | ||||
// Deprecated: StartupPolicy is deprecated, please use the DependsOn API. | ||||
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable" | ||||
StartupPolicy *StartupPolicy `json:"startupPolicy,omitempty"` | ||||
|
||||
|
@@ -230,8 +233,44 @@ type ReplicatedJob struct { | |||
// Jobs names will be in the format: <jobSet.name>-<spec.replicatedJob.name>-<job-index> | ||||
// +kubebuilder:default=1 | ||||
Replicas int32 `json:"replicas,omitempty"` | ||||
|
||||
// DependsOn is an optional list that specifies the preceding ReplicatedJobs upon which | ||||
// the current ReplicatedJob depends. If specified, the ReplicatedJob will be created | ||||
// only after the referenced ReplicatedJobs reach their desired state. | ||||
// The Order of ReplicatedJobs is defined by their enumeration in the slice. | ||||
// Note, that the first ReplicatedJob in the slice cannot use the DependsOn API. | ||||
// Currently, only a single item is supported in the DependsOn list. | ||||
// This API is mutually exclusive with the StartupPolicy API. | ||||
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable" | ||||
// +kubebuilder:validation:MaxItems=1 | ||||
// +optional | ||||
// +listType=map | ||||
// +listMapKey=name | ||||
DependsOn []DependsOn `json:"dependsOn,omitempty"` | ||||
} | ||||
|
||||
// DependsOn defines the dependency on the previous ReplicatedJob status. | ||||
type DependsOn struct { | ||||
// Name of the previous ReplicatedJob. | ||||
Name string `json:"name"` | ||||
|
||||
// Status defines the condition for the ReplicatedJob. Only Ready or Complete status can be set. | ||||
// +kubebuilder:validation:Enum=Ready;Complete | ||||
Status DependsOnStatus `json:"status"` | ||||
} | ||||
|
||||
type DependsOnStatus string | ||||
|
||||
const ( | ||||
// DependencyReady means the Ready + Succeeded + Failed counter | ||||
// equals the number of child Jobs of the dependant ReplicatedJob. | ||||
DependencyReady DependsOnStatus = "Ready" | ||||
|
||||
// DependencyComplete means the Succeeded counter | ||||
// equals the number of child Jobs of the dependant ReplicatedJob. | ||||
DependencyComplete DependsOnStatus = "Complete" | ||||
) | ||||
|
||||
type Network struct { | ||||
// EnableDNSHostnames allows pods to be reached via their hostnames. | ||||
// Pods will be reachable using the fully qualified pod hostname: | ||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get some kind of test that confirms this works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We test it here:
jobset/test/integration/webhook/jobset_webhook_test.go
Line 445 in c0bf232