Skip to content

Commit 4722a7f

Browse files
authoredOct 9, 2024··
feat: add Actions for PipelineRollout to allow/disallow data loss (#20298)
* add Actions for PipelineRollout to allow/disallow data loss Signed-off-by: Julie Vogelman <julievogelman0@gmail.com> * fix: test, add codegen generated docs Signed-off-by: Julie Vogelman <julievogelman0@gmail.com> * fix name Signed-off-by: Julie Vogelman <julievogelman0@gmail.com> * fix: make actions more robust to handle empty metadata Signed-off-by: Julie Vogelman <julievogelman0@gmail.com> * spacing Signed-off-by: Julie Vogelman <julievogelman0@gmail.com> --------- Signed-off-by: Julie Vogelman <julievogelman0@gmail.com>
1 parent 19d85aa commit 4722a7f

File tree

8 files changed

+284
-1
lines changed

8 files changed

+284
-1
lines changed
 

‎docs/operator-manual/resource_actions_builtin.md

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎resource_customizations/numaplane.numaproj.io/PipelineRollout/actions/action_test.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ actionTests:
44
expectedOutputPath: testdata/rollout-paused.yaml
55
- action: unpause
66
inputPath: testdata/rollout-paused.yaml
7-
expectedOutputPath: testdata/rollout-running.yaml
7+
expectedOutputPath: testdata/rollout-running.yaml
8+
- action: allow-data-loss
9+
inputPath: testdata/rollout-in-ppnd.yaml
10+
expectedOutputPath: testdata/rollout-allowing-data-loss.yaml
11+
- action: disallow-data-loss
12+
inputPath: testdata/rollout-allowing-data-loss.yaml
13+
expectedOutputPath: testdata/rollout-disallowing-data-loss.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if obj.metadata.annotations == nil then
2+
obj.metadata.annotations = {}
3+
end
4+
obj.metadata.annotations["numaplane.numaproj.io/allow-data-loss"] = "true"
5+
return obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if obj.metadata.annotations == nil then
2+
obj.metadata.annotations = {}
3+
end
4+
obj.metadata.annotations["numaplane.numaproj.io/allow-data-loss"] = "false"
5+
return obj

‎resource_customizations/numaplane.numaproj.io/PipelineRollout/actions/discovery.lua

+12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
local actions = {}
22
actions["pause"] = {["disabled"] = true}
33
actions["unpause"] = {["disabled"] = true}
4+
actions["allow-data-loss"] = {["disabled"] = true}
5+
actions["disallow-data-loss"] = {["disabled"] = true}
46

7+
-- pause/unpause
58
local paused = false
69
if obj.spec.pipeline.spec.lifecycle ~= nil and obj.spec.pipeline.spec.lifecycle.desiredPhase ~= nil and obj.spec.pipeline.spec.lifecycle.desiredPhase == "Paused" then
710
paused = true
@@ -11,4 +14,13 @@ if paused then
1114
else
1215
actions["pause"]["disabled"] = false
1316
end
17+
18+
-- allow-data-loss/disallow-data-loss
19+
if obj.status ~= nil and obj.status.upgradeInProgress == "PipelinePauseAndDrain" then
20+
actions["allow-data-loss"]["disabled"] = false
21+
end
22+
if obj.metadata.annotations ~= nil and obj.metadata.annotations["numaplane.numaproj.io/allow-data-loss"] == "true" then
23+
actions["disallow-data-loss"]["disabled"] = false
24+
end
25+
1426
return actions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
apiVersion: numaplane.numaproj.io/v1alpha1
2+
kind: PipelineRollout
3+
metadata:
4+
creationTimestamp: "2024-10-02T23:01:46Z"
5+
annotations:
6+
numaplane.numaproj.io/allow-data-loss: "true"
7+
finalizers:
8+
- numaplane.numaproj.io/numaplane-controller
9+
generation: 2
10+
name: test-pipeline-rollout
11+
namespace: numaplane-system
12+
resourceVersion: "1771"
13+
uid: f89f2135-a6a6-443c-8584-cbf6d789f2db
14+
spec:
15+
pipeline:
16+
spec:
17+
edges:
18+
- conditions: null
19+
from: in
20+
to: cat
21+
- conditions: null
22+
from: cat
23+
to: out
24+
interStepBufferServiceName: test-isbservice-rollout
25+
lifecycle: {}
26+
vertices:
27+
- name: in
28+
scale:
29+
max: 1
30+
min: 1
31+
zeroReplicaSleepSeconds: 15
32+
source:
33+
generator:
34+
duration: 1s
35+
rpu: 5
36+
updateStrategy: {}
37+
- name: cat
38+
scale:
39+
max: 1
40+
min: 1
41+
zeroReplicaSleepSeconds: 15
42+
udf:
43+
builtin:
44+
name: cat
45+
container: null
46+
groupBy: null
47+
updateStrategy: {}
48+
- name: out
49+
scale:
50+
max: 1
51+
min: 1
52+
zeroReplicaSleepSeconds: 15
53+
sink:
54+
log: {}
55+
retryStrategy: {}
56+
updateStrategy: {}
57+
watermark: {}
58+
status:
59+
conditions:
60+
- lastTransitionTime: "2024-10-02T23:01:46Z"
61+
message: Successful
62+
observedGeneration: 1
63+
reason: Successful
64+
status: "True"
65+
type: ChildResourceDeployed
66+
- lastTransitionTime: "2024-10-02T23:02:41Z"
67+
message: Pipeline Progressing
68+
observedGeneration: 2
69+
reason: Progressing
70+
status: "False"
71+
type: ChildResourcesHealthy
72+
- lastTransitionTime: "2024-10-02T23:02:41Z"
73+
message: Pipeline pausing
74+
observedGeneration: 2
75+
reason: PipelinePausing
76+
status: "True"
77+
type: PipelinePausingOrPaused
78+
message: Progressing
79+
nameCount: 0
80+
observedGeneration: 2
81+
pauseStatus:
82+
lastPauseBeginTime: "2024-10-02T23:02:41Z"
83+
lastPauseEndTime: null
84+
phase: Pending
85+
upgradeInProgress: PipelinePauseAndDrain
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
apiVersion: numaplane.numaproj.io/v1alpha1
2+
kind: PipelineRollout
3+
metadata:
4+
creationTimestamp: "2024-10-02T23:01:46Z"
5+
annotations:
6+
numaplane.numaproj.io/allow-data-loss: "false"
7+
finalizers:
8+
- numaplane.numaproj.io/numaplane-controller
9+
generation: 2
10+
name: test-pipeline-rollout
11+
namespace: numaplane-system
12+
resourceVersion: "1771"
13+
uid: f89f2135-a6a6-443c-8584-cbf6d789f2db
14+
spec:
15+
pipeline:
16+
spec:
17+
edges:
18+
- conditions: null
19+
from: in
20+
to: cat
21+
- conditions: null
22+
from: cat
23+
to: out
24+
interStepBufferServiceName: test-isbservice-rollout
25+
lifecycle: {}
26+
vertices:
27+
- name: in
28+
scale:
29+
max: 1
30+
min: 1
31+
zeroReplicaSleepSeconds: 15
32+
source:
33+
generator:
34+
duration: 1s
35+
rpu: 5
36+
updateStrategy: {}
37+
- name: cat
38+
scale:
39+
max: 1
40+
min: 1
41+
zeroReplicaSleepSeconds: 15
42+
udf:
43+
builtin:
44+
name: cat
45+
container: null
46+
groupBy: null
47+
updateStrategy: {}
48+
- name: out
49+
scale:
50+
max: 1
51+
min: 1
52+
zeroReplicaSleepSeconds: 15
53+
sink:
54+
log: {}
55+
retryStrategy: {}
56+
updateStrategy: {}
57+
watermark: {}
58+
status:
59+
conditions:
60+
- lastTransitionTime: "2024-10-02T23:01:46Z"
61+
message: Successful
62+
observedGeneration: 1
63+
reason: Successful
64+
status: "True"
65+
type: ChildResourceDeployed
66+
- lastTransitionTime: "2024-10-02T23:02:41Z"
67+
message: Pipeline Progressing
68+
observedGeneration: 2
69+
reason: Progressing
70+
status: "False"
71+
type: ChildResourcesHealthy
72+
- lastTransitionTime: "2024-10-02T23:02:41Z"
73+
message: Pipeline pausing
74+
observedGeneration: 2
75+
reason: PipelinePausing
76+
status: "True"
77+
type: PipelinePausingOrPaused
78+
message: Progressing
79+
nameCount: 0
80+
observedGeneration: 2
81+
pauseStatus:
82+
lastPauseBeginTime: "2024-10-02T23:02:41Z"
83+
lastPauseEndTime: null
84+
phase: Pending
85+
upgradeInProgress: PipelinePauseAndDrain
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
apiVersion: numaplane.numaproj.io/v1alpha1
2+
kind: PipelineRollout
3+
metadata:
4+
creationTimestamp: "2024-10-02T23:01:46Z"
5+
finalizers:
6+
- numaplane.numaproj.io/numaplane-controller
7+
generation: 2
8+
name: test-pipeline-rollout
9+
namespace: numaplane-system
10+
resourceVersion: "1771"
11+
uid: f89f2135-a6a6-443c-8584-cbf6d789f2db
12+
spec:
13+
pipeline:
14+
spec:
15+
edges:
16+
- conditions: null
17+
from: in
18+
to: cat
19+
- conditions: null
20+
from: cat
21+
to: out
22+
interStepBufferServiceName: test-isbservice-rollout
23+
lifecycle: {}
24+
vertices:
25+
- name: in
26+
scale:
27+
max: 1
28+
min: 1
29+
zeroReplicaSleepSeconds: 15
30+
source:
31+
generator:
32+
duration: 1s
33+
rpu: 5
34+
updateStrategy: {}
35+
- name: cat
36+
scale:
37+
max: 1
38+
min: 1
39+
zeroReplicaSleepSeconds: 15
40+
udf:
41+
builtin:
42+
name: cat
43+
container: null
44+
groupBy: null
45+
updateStrategy: {}
46+
- name: out
47+
scale:
48+
max: 1
49+
min: 1
50+
zeroReplicaSleepSeconds: 15
51+
sink:
52+
log: {}
53+
retryStrategy: {}
54+
updateStrategy: {}
55+
watermark: {}
56+
status:
57+
conditions:
58+
- lastTransitionTime: "2024-10-02T23:01:46Z"
59+
message: Successful
60+
observedGeneration: 1
61+
reason: Successful
62+
status: "True"
63+
type: ChildResourceDeployed
64+
- lastTransitionTime: "2024-10-02T23:02:41Z"
65+
message: Pipeline Progressing
66+
observedGeneration: 2
67+
reason: Progressing
68+
status: "False"
69+
type: ChildResourcesHealthy
70+
- lastTransitionTime: "2024-10-02T23:02:41Z"
71+
message: Pipeline pausing
72+
observedGeneration: 2
73+
reason: PipelinePausing
74+
status: "True"
75+
type: PipelinePausingOrPaused
76+
message: Progressing
77+
nameCount: 0
78+
observedGeneration: 2
79+
pauseStatus:
80+
lastPauseBeginTime: "2024-10-02T23:02:41Z"
81+
lastPauseEndTime: null
82+
phase: Pending
83+
upgradeInProgress: PipelinePauseAndDrain

0 commit comments

Comments
 (0)
Please sign in to comment.