Validate the `duration` parameter in SGBOps to match the iso 8601 format
If the duration parameter does not match with the iso 8601 format you'll get the next error:
Error from server (https://stackgres.io/doc/1.0/api/responses/error#constraint-violation): error when creating "SGDbOps_benchmark.yaml": admission webhook "sgdbops.stackgres-operator.stackgres" denied the request: SGDbOps has invalid properties
this could be reproduced whit the next example:
apiVersion: stackgres.io/v1
kind: SGDbOps
metadata:
name: benchmark
spec:
sgCluster: my-cluster
op: benchmark
benchmark:
type: pgbench
pgbench:
databaseSize: 1Gi
duration: P5M
concurrentClients: 10
threads: 10
connectionType: primary-service
The message is not clear about what is the error, so is difficult to understand what is missing.
Add a validation to force the value match the iso 8601 format P(n)Y(n)M(n)DT(n)H(n)M(n)S
Edited by Matteo Melli