Skip to content

Commit f46a91b

Browse files
Techassisbernauer
andauthored
feat: Add duration doc page (#467)
* Add duration doc page * Apply suggestions Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.de> * Minor adjustments * Some more minor adjustments --------- Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
1 parent 6c8e92e commit f46a91b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

modules/concepts/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
** xref:tls_server_verification.adoc[]
1313
** xref:pod_placement.adoc[]
1414
** xref:overrides.adoc[]
15+
** xref:duration.adoc[]
1516
** xref:operations/index.adoc[]
1617
*** xref:operations/cluster_operations.adoc[]
1718
*** xref:operations/pod_placement.adoc[]

modules/concepts/pages/duration.adoc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
= Duration format
2+
3+
:rust-duration-max: https://doc.rust-lang.org/std/time/struct.Duration.html#associatedconstant.MAX
4+
:go-std-time: https://cs.opensource.google/go/go/+/refs/tags/go1.21.2:src/time/format.go;l=1589
5+
:k8s-cr: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
6+
:go: https://go.dev/
7+
8+
All Stackable operators use a human-readable duration format. It very closely resembles the format used by the {go}[Go] programming language - which Kubernetes uses internally.
9+
Every duration field of a {k8s-cr}[CustomResource], for example, the xref:trino:usage-guide/operations/graceful-shutdown.adoc[`spec.workers.roleConfig.gracefulShutdownTimeout`] field, supports this format.
10+
There is no official format specification, but the source code of {go-std-time}[`time.ParseDuration`] in the Go standard library can be used as an implementation reference.
11+
12+
The format looks like this: `15d18h34m42s`.
13+
xref:trino:index.adoc[Trino], for example, uses it in the following way:
14+
15+
[source,yaml]
16+
----
17+
# ...
18+
spec:
19+
workers:
20+
roleConfig:
21+
gracefulShutdownTimeout: 15d18h34m42s
22+
----
23+
24+
Valid time units are: `d`, `h`, `m`, `s`, and `ms`.
25+
Separating the duration fragments, which is a tuple of time value and time unit (`15d`), by spaces is **not** supported and will result in an error.
26+
The maximum amount of time which can safely be represented without precision loss or integer overflow is 584,942,417,355 years.
27+
See {rust-duration-max}[here] for more information.

0 commit comments

Comments
 (0)