Skip to content

Commit 0f9dd7b

Browse files
committed
trigger ci
1 parent 16a287c commit 0f9dd7b

File tree

7 files changed

+21
-24
lines changed

7 files changed

+21
-24
lines changed

docs/reference/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ Two mutually exclusive styles are supported:
129129

130130

131131
Legacy: provide both onSuccess and onFailure (deprecated; removal planned for 1.6.0). May be combined with shutdownAfterJobFinishes and (optionally) global TTLSecondsAfterFinished.
132-
Rules: provide deletionRules (list; may be empty to explicitly select rules mode). Rules mode is incompatible with shutdownAfterJobFinishes, legacy fields, and the global TTLSecondsAfterFinished (use per‑rule condition.ttlSeconds instead).
132+
Rules: provide deletionRules (non-empty list). Rules mode is incompatible with shutdownAfterJobFinishes, legacy fields, and the global TTLSecondsAfterFinished (use per‑rule condition.ttlSeconds instead).
133133

134134

135135
Semantics:
136-
- An empty deletionRules slice still selects rules mode.
136+
- A non-empty deletionRules selects rules mode; empty lists are treated as unset.
137137
- Legacy requires both onSuccess and onFailure; specifying only one is invalid.
138138
- Global TTLSecondsAfterFinished > 0 requires shutdownAfterJobFinishes=true; therefore it cannot be used with rules mode or with legacy alone (no shutdown).
139139
- Feature gate RayJobDeletionPolicy must be enabled when this block is present.
@@ -297,7 +297,7 @@ _Appears in:_
297297
| `clusterSelector` _object (keys:string, values:string)_ | clusterSelector is used to select running rayclusters by labels | | |
298298
| `submitterConfig` _[SubmitterConfig](#submitterconfig)_ | Configurations of submitter k8s job. | | |
299299
| `managedBy` _string_ | ManagedBy is an optional configuration for the controller or entity that manages a RayJob.<br />The value must be either 'ray.io/kuberay-operator' or 'kueue.x-k8s.io/multikueue'.<br />The kuberay-operator reconciles a RayJob which doesn't have this field at all or<br />the field value is the reserved string 'ray.io/kuberay-operator',<br />but delegates reconciling the RayJob with 'kueue.x-k8s.io/multikueue' to the Kueue.<br />The field is immutable. | | |
300-
| `deletionStrategy` _[DeletionStrategy](#deletionstrategy)_ | DeletionStrategy automates post-completion cleanup.<br />Choose one style or omit:<br /> - Legacy: both onSuccess & onFailure (deprecated; may combine with shutdownAfterJobFinishes and TTLSecondsAfterFinished).<br /> - Rules: deletionRules (empty or non-empty) — incompatible with shutdownAfterJobFinishes, legacy fields, and global TTLSecondsAfterFinished (use per-rule condition.ttlSeconds).<br />Global TTLSecondsAfterFinished > 0 requires shutdownAfterJobFinishes=true.<br />Feature gate RayJobDeletionPolicy must be enabled when this field is set. | | |
300+
| `deletionStrategy` _[DeletionStrategy](#deletionstrategy)_ | DeletionStrategy automates post-completion cleanup.<br />Choose one style or omit:<br /> - Legacy: both onSuccess & onFailure (deprecated; may combine with shutdownAfterJobFinishes and TTLSecondsAfterFinished).<br /> - Rules: deletionRules (non-empty) — incompatible with shutdownAfterJobFinishes, legacy fields, and global TTLSecondsAfterFinished (use per-rule condition.ttlSeconds).<br />Global TTLSecondsAfterFinished > 0 requires shutdownAfterJobFinishes=true.<br />Feature gate RayJobDeletionPolicy must be enabled when this field is set. | | |
301301
| `entrypoint` _string_ | Entrypoint represents the command to start execution. | | |
302302
| `runtimeEnvYAML` _string_ | RuntimeEnvYAML represents the runtime environment configuration<br />provided as a multi-line YAML string. | | |
303303
| `jobId` _string_ | If jobId is not set, a new jobId will be auto-generated. | | |

helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/apis/ray/v1/rayjob_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ const (
9191
// Two mutually exclusive styles are supported:
9292
//
9393
// Legacy: provide both onSuccess and onFailure (deprecated; removal planned for 1.6.0). May be combined with shutdownAfterJobFinishes and (optionally) global TTLSecondsAfterFinished.
94-
// Rules: provide deletionRules (list; may be empty to explicitly select rules mode). Rules mode is incompatible with shutdownAfterJobFinishes, legacy fields, and the global TTLSecondsAfterFinished (use per‑rule condition.ttlSeconds instead).
94+
// Rules: provide deletionRules (non-empty list). Rules mode is incompatible with shutdownAfterJobFinishes, legacy fields, and the global TTLSecondsAfterFinished (use per‑rule condition.ttlSeconds instead).
9595
//
9696
// Semantics:
97-
// - An empty deletionRules slice still selects rules mode.
97+
// - A non-empty deletionRules selects rules mode; empty lists are treated as unset.
9898
// - Legacy requires both onSuccess and onFailure; specifying only one is invalid.
9999
// - Global TTLSecondsAfterFinished > 0 requires shutdownAfterJobFinishes=true; therefore it cannot be used with rules mode or with legacy alone (no shutdown).
100100
// - Feature gate RayJobDeletionPolicy must be enabled when this block is present.
@@ -105,7 +105,7 @@ const (
105105
// - onSuccess/onFailure are deprecated; migration to deletionRules is encouraged.
106106
//
107107
// +kubebuilder:validation:XValidation:rule="!((has(self.onSuccess) || has(self.onFailure)) && has(self.deletionRules))",message="legacy policies (onSuccess/onFailure) and deletionRules cannot be used together within the same deletionStrategy"
108-
// +kubebuilder:validation:XValidation:rule="((has(self.onSuccess) && has(self.onFailure)) || has(self.deletionRules))",message="deletionStrategy requires either BOTH onSuccess and onFailure, OR the deletionRules field (which may be empty)"
108+
// +kubebuilder:validation:XValidation:rule="((has(self.onSuccess) && has(self.onFailure)) || (has(self.deletionRules) && size(self.deletionRules) > 0))",message="deletionStrategy requires either BOTH onSuccess and onFailure, OR the deletionRules field (cannot be empty)"
109109
type DeletionStrategy struct {
110110
// OnSuccess is the deletion policy for a successful RayJob.
111111
// Deprecated: Use `deletionRules` instead for more flexible, multi-stage deletion strategies.
@@ -228,7 +228,7 @@ type RayJobSpec struct {
228228
// DeletionStrategy automates post-completion cleanup.
229229
// Choose one style or omit:
230230
// - Legacy: both onSuccess & onFailure (deprecated; may combine with shutdownAfterJobFinishes and TTLSecondsAfterFinished).
231-
// - Rules: deletionRules (empty or non-empty) — incompatible with shutdownAfterJobFinishes, legacy fields, and global TTLSecondsAfterFinished (use per-rule condition.ttlSeconds).
231+
// - Rules: deletionRules (non-empty) — incompatible with shutdownAfterJobFinishes, legacy fields, and global TTLSecondsAfterFinished (use per-rule condition.ttlSeconds).
232232
// Global TTLSecondsAfterFinished > 0 requires shutdownAfterJobFinishes=true.
233233
// Feature gate RayJobDeletionPolicy must be enabled when this field is set.
234234
// +optional

ray-operator/config/crd/bases/ray.io_rayjobs.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/controllers/ray/rayjob_controller.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,11 +1120,6 @@ func (r *RayJobReconciler) handleDeletionRules(ctx context.Context, rayJob *rayv
11201120
var overdueRules []rayv1.DeletionRule
11211121
var nextRequeueTime *time.Time
11221122

1123-
if len(rayJob.Spec.DeletionStrategy.DeletionRules) == 0 {
1124-
logger.Info("No deletion rules are defined; skipping deletion handling.")
1125-
return ctrl.Result{}, nil
1126-
}
1127-
11281123
// Categorize all applicable and incomplete rules into "overdue" or "pending".
11291124
for _, rule := range rayJob.Spec.DeletionStrategy.DeletionRules {
11301125
// Skip rules that don't match the current job status.

ray-operator/controllers/ray/utils/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func validateDeletionConfiguration(rayJob *rayv1.RayJob) error {
281281
}
282282

283283
legacyConfigured := rayJob.Spec.DeletionStrategy.OnSuccess != nil || rayJob.Spec.DeletionStrategy.OnFailure != nil
284-
rulesConfigured := rayJob.Spec.DeletionStrategy.DeletionRules != nil // explicit empty slice counts as rules mode
284+
rulesConfigured := len(rayJob.Spec.DeletionStrategy.DeletionRules) > 0
285285

286286
// Mutual exclusivity: rules mode forbids shutdown & legacy. (TTL+rules is implicitly invalid because TTL requires shutdown.)
287287
if rulesConfigured && rayJob.Spec.ShutdownAfterJobFinishes {
@@ -301,7 +301,7 @@ func validateDeletionConfiguration(rayJob *rayv1.RayJob) error {
301301
return err
302302
}
303303
} else {
304-
return fmt.Errorf("The RayJob spec is invalid: DeletionStrategy requires either BOTH onSuccess and onFailure, OR the deletionRules field (which may be empty list)")
304+
return fmt.Errorf("The RayJob spec is invalid: DeletionStrategy requires either BOTH onSuccess and onFailure, OR the deletionRules field (cannot be empty)")
305305
}
306306

307307
return nil

ray-operator/controllers/ray/utils/validation_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ func TestValidateRayJobSpecWithFeatureGate(t *testing.T) {
10121012
OnFailure: &rayv1.DeletionPolicy{
10131013
Policy: ptr.To(rayv1.DeleteCluster),
10141014
},
1015-
}, ShutdownAfterJobFinishes: false,
1015+
}, ShutdownAfterJobFinishes: true,
10161016
RayClusterSpec: createBasicRayClusterSpec(),
10171017
},
10181018
expectError: false,
@@ -1048,7 +1048,7 @@ func TestValidateRayJobSpecWithFeatureGate(t *testing.T) {
10481048
OnFailure: &rayv1.DeletionPolicy{
10491049
Policy: ptr.To(rayv1.DeleteNone),
10501050
},
1051-
}, ShutdownAfterJobFinishes: false,
1051+
}, ShutdownAfterJobFinishes: true,
10521052
RayClusterSpec: createBasicRayClusterSpec(),
10531053
},
10541054
expectError: true,
@@ -1060,7 +1060,7 @@ func TestValidateRayJobSpecWithFeatureGate(t *testing.T) {
10601060
OnFailure: &rayv1.DeletionPolicy{
10611061
Policy: ptr.To(rayv1.DeleteNone),
10621062
},
1063-
}, ShutdownAfterJobFinishes: false,
1063+
}, ShutdownAfterJobFinishes: true,
10641064
RayClusterSpec: createBasicRayClusterSpec(),
10651065
},
10661066
expectError: true,
@@ -1072,7 +1072,7 @@ func TestValidateRayJobSpecWithFeatureGate(t *testing.T) {
10721072
OnSuccess: &rayv1.DeletionPolicy{
10731073
Policy: ptr.To(rayv1.DeleteNone),
10741074
},
1075-
}, ShutdownAfterJobFinishes: false,
1075+
}, ShutdownAfterJobFinishes: true,
10761076
RayClusterSpec: createBasicRayClusterSpec(),
10771077
},
10781078
expectError: true,
@@ -1085,7 +1085,7 @@ func TestValidateRayJobSpecWithFeatureGate(t *testing.T) {
10851085
Policy: ptr.To(rayv1.DeleteNone),
10861086
},
10871087
OnFailure: &rayv1.DeletionPolicy{},
1088-
}, ShutdownAfterJobFinishes: false,
1088+
}, ShutdownAfterJobFinishes: true,
10891089
RayClusterSpec: createBasicRayClusterSpec(),
10901090
},
10911091
expectError: true,
@@ -1174,7 +1174,7 @@ func TestValidateRayJobSpecWithFeatureGate(t *testing.T) {
11741174
},
11751175
RayClusterSpec: createBasicRayClusterSpec(),
11761176
},
1177-
expectError: false,
1177+
expectError: true,
11781178
},
11791179
{
11801180
name: "duplicate rule in deletionRules",

0 commit comments

Comments
 (0)