Skip to content

Commit 393ecfe

Browse files
committed
feat: improve event status consistency
Event Changes: - Renamed ActionGroupEvent.Type -> Status - Renamed Event.Operation -> Status - Renamed Status fields to use consistent prefixes and suffixes - Combined Applied, Changed, Unchanged, and ServersideApplied into ApplySuccessful - Added Failed status for apply, prune, and delete events - Replaced Unspecified with Pending - Made enum String output more consistent Printer Changes: - Added FormatSummary to print summary stats at the end of the apply/destroy, instead of after the last of each type of action group. - Modified printer output to match new more consistent events. - Updated JSON printer docs with latest schema details. BREAKING CHANGE: Event "operations" and "type" are now "status" BREAKING CHANGE: JSON printer schema changed to match events BREAKING CHANGE: Event status enums renamed/refactored
1 parent 8aaf739 commit 393ecfe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1274
-995
lines changed

examples/alphaTestExamples/MultipleServices.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ Destroy one service and make sure that only that service is destroyed and clean-
117117
```
118118
kapply destroy $BASE/wordpress | tee $OUTPUT/status;
119119

120-
expectedOutputLine "service/wordpress deleted"
121-
122-
expectedOutputLine "deployment.apps/wordpress deleted"
123-
124-
expectedOutputLine "2 resource(s) deleted, 0 skipped"
120+
expectedOutputLine "service/wordpress delete successful"
121+
expectedOutputLine "deployment.apps/wordpress delete successful"
122+
expectedOutputLine "delete result: 2 attempted, 2 successful, 0 skipped, 0 failed"
123+
expectedOutputLine "reconcile result: 2 attempted, 2 successful, 0 skipped, 0 failed, 0 timed out"
125124

126125
# Verify that we still have the mysql resources in the cluster.
127126
kubectl get all --no-headers --selector=app=mysql | wc -l | xargs | tee $OUTPUT/status

examples/alphaTestExamples/helloapp.md

+17-21
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ Run preview to check which commands will be executed
174174
```
175175
kapply preview $BASE | tee $OUTPUT/status
176176

177-
expectedOutputLine "3 resource(s) applied. 3 created, 0 unchanged, 0 configured, 0 failed"
177+
expectedOutputLine "apply result: 3 attempted, 3 successful, 0 skipped, 0 failed"
178178

179179
kapply preview $BASE --server-side | tee $OUTPUT/status
180180

181-
expectedOutputLine "3 resource(s) applied. 0 created, 0 unchanged, 0 configured, 0 failed, 3 serverside applied"
181+
expectedOutputLine "apply result: 3 attempted, 3 successful, 0 skipped, 0 failed"
182182

183183
# Verify that preview didn't create any resources.
184184
kubectl get all -n hellospace 2>&1 | tee $OUTPUT/status
@@ -222,7 +222,7 @@ kapply apply $BASE --reconcile-timeout=120s --status-events | tee $OUTPUT/status
222222

223223
expectedOutputLine "configmap/the-map2 is Current: Resource is always ready"
224224

225-
expectedOutputLine "configmap/the-map1 pruned"
225+
expectedOutputLine "configmap/the-map1 prune successful"
226226

227227
# Verify that the new configmap has been created and the old one pruned.
228228
kubectl get cm -n hellospace --no-headers | awk '{print $1}' | tee $OUTPUT/status
@@ -235,34 +235,30 @@ Clean-up the cluster
235235
```
236236
kapply preview $BASE --destroy | tee $OUTPUT/status
237237

238-
expectedOutputLine "deployment.apps/the-deployment deleted"
239-
240-
expectedOutputLine "configmap/the-map2 deleted"
241-
242-
expectedOutputLine "service/the-service deleted"
238+
expectedOutputLine "deployment.apps/the-deployment delete successful"
239+
expectedOutputLine "configmap/the-map2 delete successful"
240+
expectedOutputLine "service/the-service delete successful"
241+
expectedOutputLine "delete result: 3 attempted, 3 successful, 0 skipped, 0 failed"
243242

244243
kapply preview $BASE --destroy --server-side | tee $OUTPUT/status
245244

246-
expectedOutputLine "deployment.apps/the-deployment deleted"
247-
248-
expectedOutputLine "configmap/the-map2 deleted"
249-
250-
expectedOutputLine "service/the-service deleted"
245+
expectedOutputLine "deployment.apps/the-deployment delete successful"
246+
expectedOutputLine "configmap/the-map2 delete successful"
247+
expectedOutputLine "service/the-service delete successful"
248+
expectedOutputLine "delete result: 3 attempted, 3 successful, 0 skipped, 0 failed"
251249

252250
# Verify that preview all resources are still there after running preview.
253251
kubectl get --no-headers all -n hellospace | wc -l | xargs | tee $OUTPUT/status
254252
expectedOutputLine "6"
255253

256254
kapply destroy $BASE | tee $OUTPUT/status;
257255

258-
expectedOutputLine "deployment.apps/the-deployment deleted"
259-
260-
expectedOutputLine "configmap/the-map2 deleted"
261-
262-
expectedOutputLine "service/the-service deleted"
263-
264-
expectedOutputLine "3 resource(s) deleted, 0 skipped"
265-
expectedNotFound "resource(s) pruned"
256+
expectedOutputLine "deployment.apps/the-deployment delete successful"
257+
expectedOutputLine "configmap/the-map2 delete successful"
258+
expectedOutputLine "service/the-service delete successful"
259+
expectedOutputLine "delete result: 3 attempted, 3 successful, 0 skipped, 0 failed"
260+
expectedOutputLine "reconcile result: 3 attempted, 3 successful, 0 skipped, 0 failed, 0 timed out"
261+
expectedNotFound "prune result"
266262

267263
kind delete cluster;
268264
```

examples/alphaTestExamples/inventoryNamespace.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ test-namespace is created first, so the following resources within the namespace
9393
<!-- @runApply @testE2EAgainstLatestRelease -->
9494
```
9595
kapply apply $BASE --reconcile-timeout=1m | tee $OUTPUT/status
96-
expectedOutputLine "namespace/test-namespace unchanged"
97-
expectedOutputLine "configmap/cm-a created"
98-
expectedOutputLine "2 resource(s) applied. 1 created, 1 unchanged, 0 configured"
96+
expectedOutputLine "namespace/test-namespace apply successful"
97+
expectedOutputLine "configmap/cm-a apply successful"
98+
expectedOutputLine "apply result: 2 attempted, 2 successful, 0 skipped, 0 failed"
99+
expectedOutputLine "reconcile result: 2 attempted, 2 successful, 0 skipped, 0 failed, 0 timed out"
99100

100101
# There should be only one inventory object
101102
kubectl get cm -n test-namespace --selector='cli-utils.sigs.k8s.io/inventory-id' --no-headers | wc -l | tee $OUTPUT/status
@@ -119,7 +120,8 @@ that the subsequent apply does not prune this omitted namespace.
119120
```
120121
rm -f $BASE/test-namespace.yaml
121122
kapply apply $BASE --reconcile-timeout=1m | tee $OUTPUT/status
122-
expectedOutputLine "0 resource(s) pruned, 1 skipped"
123+
expectedOutputLine "prune result: 1 attempted, 0 successful, 1 skipped, 0 failed"
124+
expectedOutputLine "reconcile result: 1 attempted, 0 successful, 1 skipped, 0 failed, 0 timed out"
123125

124126
# Inventory namespace should still exist
125127
kubectl get ns test-namespace --no-headers | wc -l | tee $OUTPUT/status

examples/alphaTestExamples/pruneAndDelete.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ Apply the three resources to the cluster.
134134
```
135135
kapply apply $BASE --reconcile-timeout=1m | tee $OUTPUT/status
136136

137-
expectedOutputLine "3 resource(s) applied. 3 created, 0 unchanged, 0 configured, 0 failed"
138-
expectedOutputLine "3 resource(s) reconciled, 0 skipped, 0 failed to reconcile, 0 timed out"
137+
expectedOutputLine "apply result: 3 attempted, 3 successful, 0 skipped, 0 failed"
138+
expectedOutputLine "reconcile result: 3 attempted, 3 successful, 0 skipped, 0 failed, 0 timed out"
139139
```
140140
141141
Use the preview command to show what will happen if we run destroy. This should
@@ -145,10 +145,10 @@ command.
145145
```
146146
kapply preview --destroy $BASE | tee $OUTPUT/status
147147

148-
expectedOutputLine "configmap/firstmap deleted"
148+
expectedOutputLine "configmap/firstmap delete successful"
149149
expectedOutputLine 'configmap/secondmap delete skipped: annotation prevents deletion ("cli-utils.sigs.k8s.io/on-remove": "keep")'
150150
expectedOutputLine 'configmap/thirdmap delete skipped: annotation prevents deletion ("client.lifecycle.config.k8s.io/deletion": "detach")'
151-
expectedOutputLine "1 resource(s) deleted, 2 skipped"
151+
expectedOutputLine "delete result: 3 attempted, 1 successful, 2 skipped, 0 failed"
152152
```
153153
154154
We run the destroy command and see that the resource without the annotations (firstmap)
@@ -158,17 +158,15 @@ cluster.
158158
```
159159
kapply destroy $BASE | tee $OUTPUT/status
160160

161-
expectedOutputLine "configmap/firstmap deleted"
161+
expectedOutputLine "configmap/firstmap delete successful"
162162
expectedOutputLine 'configmap/secondmap delete skipped: annotation prevents deletion ("cli-utils.sigs.k8s.io/on-remove": "keep")'
163163
expectedOutputLine 'configmap/thirdmap delete skipped: annotation prevents deletion ("client.lifecycle.config.k8s.io/deletion": "detach")'
164-
expectedOutputLine "1 resource(s) deleted, 2 skipped"
165-
166-
expectedOutputLine "configmap/firstmap reconciled"
164+
expectedOutputLine "configmap/firstmap reconcile successful"
167165
expectedOutputLine "configmap/secondmap reconcile skipped"
168166
expectedOutputLine "configmap/thirdmap reconcile skipped"
169-
expectedOutputLine "1 resource(s) reconciled, 2 skipped, 0 failed to reconcile, 0 timed out"
170-
171-
expectedNotFound "resource(s) pruned"
167+
expectedOutputLine "delete result: 3 attempted, 1 successful, 2 skipped, 0 failed"
168+
expectedOutputLine "reconcile result: 3 attempted, 1 successful, 2 skipped, 0 failed, 0 timed out"
169+
expectedNotFound "prune result"
172170

173171
kubectl get cm --no-headers | awk '{print $1}' | tee $OUTPUT/status
174172
expectedOutputLine "secondmap"

examples/alphaTestExamples/pruneBasic.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ no resources should be pruned.
102102
<!-- @runApply @testE2EAgainstLatestRelease -->
103103
```
104104
kapply apply $BASE --reconcile-timeout=1m | tee $OUTPUT/status
105-
expectedOutputLine "configmap/cm-a created"
106-
expectedOutputLine "configmap/cm-b created"
107-
expectedOutputLine "configmap/cm-c created"
105+
expectedOutputLine "configmap/cm-a apply successful"
106+
expectedOutputLine "configmap/cm-b apply successful"
107+
expectedOutputLine "configmap/cm-c apply successful"
108+
expectedOutputLine "apply result: 3 attempted, 3 successful, 0 skipped, 0 failed"
109+
expectedOutputLine "reconcile result: 3 attempted, 3 successful, 0 skipped, 0 failed, 0 timed out"
108110

109111
# There should be only one inventory object
110112
kubectl get cm --selector='cli-utils.sigs.k8s.io/inventory-id' --no-headers | wc -l | tee $OUTPUT/status
@@ -154,11 +156,13 @@ cm-d should be created.
154156
<!-- @applySecondTime @testE2EAgainstLatestRelease -->
155157
```
156158
kapply apply $BASE --reconcile-timeout=1m | tee $OUTPUT/status
157-
expectedOutputLine "configmap/cm-a pruned"
158-
expectedOutputLine "configmap/cm-b unchanged"
159-
expectedOutputLine "configmap/cm-c unchanged"
160-
expectedOutputLine "configmap/cm-d created"
161-
expectedOutputLine "1 resource(s) pruned, 0 skipped"
159+
expectedOutputLine "configmap/cm-a prune successful"
160+
expectedOutputLine "configmap/cm-b apply successful"
161+
expectedOutputLine "configmap/cm-c apply successful"
162+
expectedOutputLine "configmap/cm-d apply successful"
163+
expectedOutputLine "apply result: 3 attempted, 3 successful, 0 skipped, 0 failed"
164+
expectedOutputLine "prune result: 1 attempted, 1 successful, 0 skipped, 0 failed"
165+
expectedOutputLine "reconcile result: 4 attempted, 4 successful, 0 skipped, 0 failed, 0 timed out"
162166

163167
# There should be only one inventory object
164168
kubectl get cm --selector='cli-utils.sigs.k8s.io/inventory-id' --no-headers | wc -l | tee $OUTPUT/status

examples/alphaTestExamples/pruneNamespace.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ no resources should be pruned.
116116
<!-- @runApply @testE2EAgainstLatestRelease -->
117117
```
118118
kapply apply $BASE --reconcile-timeout=1m | tee $OUTPUT/status
119-
expectedOutputLine "namespace/test-namespace created"
120-
expectedOutputLine "configmap/cm-a created"
121-
expectedOutputLine "configmap/cm-b created"
122-
expectedOutputLine "configmap/cm-c created"
123-
expectedOutputLine "4 resource(s) applied. 4 created, 0 unchanged, 0 configured"
119+
expectedOutputLine "namespace/test-namespace apply successful"
120+
expectedOutputLine "configmap/cm-a apply successful"
121+
expectedOutputLine "configmap/cm-b apply successful"
122+
expectedOutputLine "configmap/cm-c apply successful"
123+
expectedOutputLine "apply result: 4 attempted, 4 successful, 0 skipped, 0 failed"
124+
expectedOutputLine "reconcile result: 4 attempted, 4 successful, 0 skipped, 0 failed, 0 timed out"
124125

125126
# There should be only one inventory object
126127
kubectl get cm --selector='cli-utils.sigs.k8s.io/inventory-id' --no-headers | wc -l | tee $OUTPUT/status
@@ -172,19 +173,20 @@ test-namespace should **not** be pruned.
172173
kapply apply $BASE --reconcile-timeout=1m | tee $OUTPUT/status
173174

174175
expectedOutputLine "configmap/cm-c apply skipped: dependency scheduled for delete: _test-namespace__Namespace"
175-
expectedOutputLine "1 resource(s) applied. 0 created, 1 unchanged, 0 configured, 0 failed"
176176
expectedOutputLine "configmap/cm-c reconcile skipped"
177177

178-
expectedOutputLine "configmap/cm-a pruned"
179-
expectedOutputLine "configmap/cm-b pruned"
178+
expectedOutputLine "configmap/cm-a prune successful"
179+
expectedOutputLine "configmap/cm-b prune successful"
180180
expectedOutputLine "namespace/test-namespace prune skipped: namespace still in use: test-namespace"
181-
expectedOutputLine "2 resource(s) pruned, 1 skipped, 0 failed to prune"
182181

183182
expectedOutputLine "namespace/test-namespace reconcile skipped"
184-
expectedOutputLine "configmap/cm-a reconciled"
185-
expectedOutputLine "configmap/cm-b reconciled"
183+
expectedOutputLine "configmap/cm-a reconcile successful"
184+
expectedOutputLine "configmap/cm-b reconcile successful"
186185
expectedOutputLine "configmap/cm-c reconcile skipped"
187-
expectedOutputLine "2 resource(s) reconciled, 2 skipped, 0 failed to reconcile, 0 timed out"
186+
187+
expectedOutputLine "apply result: 1 attempted, 0 successful, 1 skipped, 0 failed"
188+
expectedOutputLine "prune result: 3 attempted, 2 successful, 1 skipped, 0 failed"
189+
expectedOutputLine "reconcile result: 4 attempted, 2 successful, 2 skipped, 0 failed, 0 timed out"
188190

189191
# The test-namespace should not be pruned.
190192
kubectl get ns test-namespace --no-headers | wc -l | tee $OUTPUT/status

examples/alphaTestExamples/serverSideApply.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ no resources should be pruned.
9393
<!-- @runServerSideApply @testE2EAgainstLatestRelease -->
9494
```
9595
kapply apply $BASE --server-side --reconcile-timeout=1m | tee $OUTPUT/status
96-
expectedOutputLine "configmap/cm-a serversideapplied"
97-
expectedOutputLine "configmap/cm-b serversideapplied"
98-
expectedOutputLine "2 serverside applied"
96+
expectedOutputLine "configmap/cm-a apply successful"
97+
expectedOutputLine "configmap/cm-b apply successful"
98+
expectedOutputLine "apply result: 2 attempted, 2 successful, 0 skipped, 0 failed"
99+
expectedOutputLine "reconcile result: 2 attempted, 2 successful, 0 skipped, 0 failed, 0 timed out"
99100

100101
# There should be only one inventory object
101102
kubectl get cm --selector='cli-utils.sigs.k8s.io/inventory-id' --no-headers | wc -l | tee $OUTPUT/status
@@ -129,7 +130,8 @@ data:
129130
EOF
130131

131132
kapply apply $BASE --server-side --field-manager=sean --force-conflicts --reconcile-timeout=1m | tee $OUTPUT/status
132-
expectedOutputLine "configmap/cm-a serversideapplied"
133-
expectedOutputLine "configmap/cm-b serversideapplied"
134-
expectedOutputLine "2 serverside applied"
133+
expectedOutputLine "configmap/cm-a apply successful"
134+
expectedOutputLine "configmap/cm-b apply successful"
135+
expectedOutputLine "apply result: 2 attempted, 2 successful, 0 skipped, 0 failed"
136+
expectedOutputLine "reconcile result: 2 attempted, 2 successful, 0 skipped, 0 failed, 0 timed out"
135137
```

0 commit comments

Comments
 (0)