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
{{ message }}
Repository navigation
Commit 76445ba
Browse filesBrowse the repository at this point in the historyBrowse files
fix(monitoring): reject a negative tracingStorages storage
The storage guard only matched zero-shaped values, so -1Gi passed it and
the schema's quantity pattern alike, rendered into the VTCluster/VTSingle
spec, and left the release failing under retries: -1 once the API server
refused the PVC. Refuse a leading minus in the same guard, so the error
names the field before anything is applied and matches what the message
promises.
Signed-off-by: Alexey Artamonov <[email protected]>
Assisted-by: LLM
{{- fail (printf"monitoring: tracingStorages[%s].mode must be either \"cluster\" or \"single\""$name) -}}
243
243
{{- end -}}
244
-
{{- if regexMatch "^[+-]?[0.]*([KMGTPE]i|[numkMGTPE]|[eE][+-]?[0-9]+)?$" ($s.storage| default ""| toString) -}}
245
-
{{- fail (printf"monitoring: tracingStorages[%s].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."$name) -}}
{{- fail (printf"monitoring: tracingStorages[%s].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."$name) -}}
Copy file name to clipboardExpand all lines: packages/system/monitoring/tests/vtraces_tracingstorages_required_test.yaml
+37-9Lines changed: 37 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -268,7 +268,7 @@ tests:
268
268
storage: ""
269
269
asserts:
270
270
- failedTemplate:
271
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
271
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
272
272
273
273
- it: rejects a zero storage (0Gi) in single mode (the operator would mount an EmptyDir)
274
274
templates:
@@ -281,7 +281,7 @@ tests:
281
281
storage: 0Gi
282
282
asserts:
283
283
- failedTemplate:
284
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
284
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
285
285
286
286
- it: rejects a zero storage (0) in single mode (the operator would mount an EmptyDir)
287
287
templates:
@@ -294,7 +294,7 @@ tests:
294
294
storage: "0"
295
295
asserts:
296
296
- failedTemplate:
297
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
297
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
298
298
299
299
- it: rejects a zero storage (0.0) in single mode (the operator would mount an EmptyDir)
300
300
templates:
@@ -307,7 +307,7 @@ tests:
307
307
storage: "0.0"
308
308
asserts:
309
309
- failedTemplate:
310
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
310
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
311
311
312
312
- it: rejects a zero storage (0e3) in single mode (the operator would mount an EmptyDir)
313
313
templates:
@@ -320,7 +320,7 @@ tests:
320
320
storage: "0e3"
321
321
asserts:
322
322
- failedTemplate:
323
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
323
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
324
324
325
325
- it: rejects a zero storage (.0) in single mode (the operator would mount an EmptyDir)
326
326
templates:
@@ -333,7 +333,7 @@ tests:
333
333
storage: ".0"
334
334
asserts:
335
335
- failedTemplate:
336
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
336
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
337
337
338
338
- it: rejects a zero storage (0m) in single mode (the operator would mount an EmptyDir)
339
339
templates:
@@ -346,7 +346,7 @@ tests:
346
346
storage: "0m"
347
347
asserts:
348
348
- failedTemplate:
349
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
349
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
350
350
351
351
- it: rejects a zero storage (+0) in single mode (the operator would mount an EmptyDir)
352
352
templates:
@@ -359,7 +359,7 @@ tests:
359
359
storage: "+0"
360
360
asserts:
361
361
- failedTemplate:
362
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
362
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
363
363
364
364
- it: rejects a zero storage (-0Mi) in single mode (the operator would mount an EmptyDir)
365
365
templates:
@@ -372,7 +372,35 @@ tests:
372
372
storage: "-0Mi"
373
373
asserts:
374
374
- failedTemplate:
375
-
errorMessage: "monitoring: tracingStorages[generic].storage must be a non-zero Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule."
375
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
376
+
377
+
- it: rejects a negative storage (-1Gi)
378
+
templates:
379
+
- templates/vtraces/vtraces.yaml
380
+
set:
381
+
tracingStorages:
382
+
- name: generic
383
+
mode: cluster
384
+
retentionPeriod: "14d"
385
+
storage: "-1Gi"
386
+
asserts:
387
+
- failedTemplate:
388
+
errorMessage: "monitoring: tracingStorages[generic].storage must be a positive Kubernetes quantity (e.g. 10Gi). A zero size makes the operator mount an EmptyDir instead of a PVC in single mode, so the backend reports Ready while every stored span is lost on the next reschedule; a negative one fails the release when the PVC is created."
389
+
390
+
- it: accepts an explicitly signed positive storage (+5Gi)
391
+
templates:
392
+
- templates/vtraces/vtraces.yaml
393
+
set:
394
+
tracingStorages:
395
+
- name: generic
396
+
mode: single
397
+
retentionPeriod: "14d"
398
+
storage: "+5Gi"
399
+
asserts:
400
+
- containsDocument:
401
+
apiVersion: operator.victoriametrics.com/v1
402
+
kind: VTSingle
403
+
name: generic
376
404
377
405
- it: accepts a non-zero storage written with an exponent (5e3)
0 commit comments