You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/api.md
+61-3Lines changed: 61 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,12 +55,29 @@ _Appears in:_
55
55
56
56
57
57
58
-
#### DeletionPolicy
58
+
#### DeletionCondition
59
+
59
60
60
61
62
+
DeletionCondition specifies the trigger conditions for a deletion action.
61
63
62
64
63
65
66
+
_Appears in:_
67
+
-[DeletionRule](#deletionrule)
68
+
69
+
| Field | Description | Default | Validation |
70
+
| --- | --- | --- | --- |
71
+
|`ttlSecondsAfterFinished`_integer_| TTLSecondsAfterFinished is the time in seconds from when the JobStatus<br />reaches the specified terminal state to when this deletion action should be triggered.<br />The value must be a non-negative integer. | 0 | Minimum: 0 <br /> |
72
+
73
+
74
+
#### DeletionPolicy
75
+
76
+
77
+
78
+
DeletionPolicy is the legacy single-stage deletion policy.
79
+
Deprecated: This struct is part of the legacy API. Use DeletionRule for new configurations.
80
+
64
81
65
82
66
83
_Appears in:_
@@ -81,14 +98,54 @@ _Underlying type:_ _string_
81
98
82
99
_Appears in:_
83
100
-[DeletionPolicy](#deletionpolicy)
101
+
-[DeletionRule](#deletionrule)
102
+
103
+
104
+
105
+
#### DeletionRule
106
+
84
107
85
108
109
+
DeletionRule defines a single deletion action and its trigger condition.
110
+
This is the new, recommended way to define deletion behavior.
111
+
112
+
113
+
114
+
_Appears in:_
115
+
-[DeletionStrategy](#deletionstrategy)
116
+
117
+
| Field | Description | Default | Validation |
118
+
| --- | --- | --- | --- |
119
+
|`policy`_[DeletionPolicyType](#deletionpolicytype)_| The policy to take when the condition is met. This field is required. || Enum: [DeleteCluster DeleteWorkers DeleteSelf DeleteNone] <br /> |
120
+
|`condition`_[DeletionCondition](#deletioncondition)_| The condition under which this deletion rule is triggered. This field is required. |||
121
+
86
122
87
123
#### DeletionStrategy
88
124
89
125
90
126
127
+
DeletionStrategy defines the deletion policies for a RayJob.
128
+
It allows for fine-grained control over resource cleanup after a job finishes.
129
+
130
+
131
+
Legacy fields `onSuccess` and `onFailure` are still supported for backward compatibility,
132
+
but it is highly recommended to migrate to the new `deletionRules` field.
133
+
134
+
135
+
Notes:
136
+
- When this block is set, you must configure **either**
137
+
(a) BOTH `onSuccess` and `onFailure` policies,
138
+
OR
139
+
(b) the `deletionRules` field (which may be empty, in which case no deletion will occur).
140
+
-`onSuccess` / `onFailure` must NOT be used together with `deletionRules`.
141
+
-`onSuccess` and `onFailure` are **deprecated** and planned for removal in a future release.
142
+
143
+
144
+
Validation rules:
145
+
1. Prevent mixing legacy and new fields
146
+
91
147
148
+
2. Require either both legacy fields or deletionRules presence
|`onSuccess`_[DeletionPolicy](#deletionpolicy)_| OnSuccess is the deletion policy for a successful RayJob.<br />Deprecated: Use `deletionRules` instead for more flexible, multi-stage deletion strategies.<br />This field will be removed in a future release. |||
158
+
|`onFailure`_[DeletionPolicy](#deletionpolicy)_| OnFailure is the deletion policy for a failed RayJob.<br />Deprecated: Use `deletionRules` instead for more flexible, multi-stage deletion strategies.<br />This field will be removed in a future release. |||
159
+
|`deletionRules`_[DeletionRule](#deletionrule) array_| DeletionRules is a list of deletion rules, processed based on their trigger conditions.<br />While the rules can be used to define a sequence, if multiple rules are overdue (e.g., due to controller downtime),<br />the most impactful rule (e.g., DeleteCluster) will be executed first to prioritize resource cleanup and cost savings. |||
Copy file name to clipboardExpand all lines: ray-operator/apis/ray/v1/rayjob_types.go
+68-2Lines changed: 68 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -87,11 +87,77 @@ const (
87
87
88
88
typeDeletionPolicyTypestring
89
89
90
+
// DeletionStrategy defines the deletion policies for a RayJob.
91
+
// It allows for fine-grained control over resource cleanup after a job finishes.
92
+
//
93
+
// Legacy fields `onSuccess` and `onFailure` are still supported for backward compatibility,
94
+
// but it is highly recommended to migrate to the new `deletionRules` field.
95
+
//
96
+
// Notes:
97
+
// - When this block is set, you must configure **either**
98
+
// (a) BOTH `onSuccess` and `onFailure` policies,
99
+
// OR
100
+
// (b) the `deletionRules` field (which may be empty, in which case no deletion will occur).
101
+
// - `onSuccess` / `onFailure` must NOT be used together with `deletionRules`.
102
+
// - `onSuccess` and `onFailure` are **deprecated** and planned for removal in a future release.
103
+
//
104
+
// Validation rules:
105
+
// 1. Prevent mixing legacy and new fields
106
+
//
107
+
// +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
+
// 2. Require either both legacy fields or deletionRules presence
109
+
//
110
+
// +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)"
90
111
typeDeletionStrategystruct {
91
-
OnSuccessDeletionPolicy`json:"onSuccess"`
92
-
OnFailureDeletionPolicy`json:"onFailure"`
112
+
// OnSuccess is the deletion policy for a successful RayJob.
113
+
// Deprecated: Use `deletionRules` instead for more flexible, multi-stage deletion strategies.
114
+
// This field will be removed in a future release.
// DeletionPolicy is the legacy single-stage deletion policy.
160
+
// Deprecated: This struct is part of the legacy API. Use DeletionRule for new configurations.
95
161
typeDeletionPolicystruct {
96
162
// Valid values are 'DeleteCluster', 'DeleteWorkers', 'DeleteSelf' or 'DeleteNone'.
97
163
// +kubebuilder:validation:XValidation:rule="self in ['DeleteCluster', 'DeleteWorkers', 'DeleteSelf', 'DeleteNone']",message="the policy field value must be either 'DeleteCluster', 'DeleteWorkers', 'DeleteSelf', or 'DeleteNone'"
0 commit comments