Skip to content

Tracking: Support human-readable duration format in CRDs #649

Closed
@sbernauer

Description

@sbernauer

I AS A USER want to not put in random big integer numbers in CRDs such as terminationgraceperiodseconds: 8763762374, but instead want to have some human readable duration such as terminationgraceperiod: 42h.

I AS A STACKABLE DEVELOPER want to not implement this in all operators, so have it in operator-rs

Requirements

  1. Must: Try to stick to the k8s way of specifying durations. It is ok to omit or add more features if this makes sense. In general its always easy to add new features, and hard to remove them again.
  2. Must: Having support for s,m,h,d,w
  3. Could: Having support for M,y as the implementation is more complicated but we might need this for ca certificate lifetime.
  4. Could: Millisecond support
  5. Must NOT: Support long variants 5seconds or 42minutes. K8s does not support this as well
  6. Should: You should be able to do all the stuff std::time::Duration supports

Implementation decisions

  • Custom struct Duration with inner type std::time::Duration
  • impl Deref for Duration with Target = std::time::Duration
  • operators should use the Duration struct everywhere in their code possible and prefer that over std::time::Duration so that, for example, log messages are consistent to the k8s way of formatting durations.

Implementation checklists

### Tasks
- [x] https://github.com/stackabletech/operator-rs/pull/647
- [x] https://github.com/stackabletech/operator-rs/pull/654
- [ ] https://github.com/stackabletech/trino-operator/pull/474
- [ ] https://github.com/stackabletech/operator-rs/pull/671
- [ ] https://github.com/stackabletech/documentation/pull/467
### Operator Tasks
- [ ] https://github.com/stackabletech/airflow-operator/pull/333
- [ ] https://github.com/stackabletech/druid-operator/pull/478
- [ ] https://github.com/stackabletech/hbase-operator/pull/401
- [ ] https://github.com/stackabletech/hdfs-operator/pull/408
- [ ] https://github.com/stackabletech/hive-operator/pull/378
- [ ] https://github.com/stackabletech/spark-k8s-operator/pull/292
- [ ] https://github.com/stackabletech/superset-operator/pull/412
- [ ] https://github.com/stackabletech/zookeeper-operator/pull/733
- [ ] https://github.com/stackabletech/opa-operator/pull/483
- [ ] https://github.com/stackabletech/secret-operator/pull/306
- [ ] https://github.com/stackabletech/listener-operator/pull/115

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions