Skip to content

TTL and LimitMarkerTTL should have the same type #386

Description

@ktarplee

What motivated this proposal?

Currently we have the following in v1beta2.

type KeyValueSpec struct {
  ...
  TTL                      string             `json:"ttl,omitempty"`
  LimitMarkerTTL time.Duration `json:"limitMarkerTtl,omitempty"`
}

To set the fields the equivalent value one must use:

apiVersion: jetstream.nats.io/v1beta2
kind: KeyValue
metadata:
  name: my-kv
spec:
  bucket: my-kv
  ttl: 24h
  limitMarkerTtl: 86_400_000_000_000 # 24h as an integer (ns)

Both types are incorrect IMHO. I think they should both be changed to metav2.Duration. https://pkg.go.dev/k8s.io/apimachinery@v0.36.2/pkg/apis/meta/v1#Duration

What is the proposed change?

type KeyValueSpec struct {
  ...
  TTL                     metav1.Duration  `json:"ttl,omitempty"`
  LimitMarkerTTL metav1.Duration `json:"limitMarkerTtl,omitempty"`
}

Same would be true for ConsumerSpec.PinnedTTL, ConsumerSpec.InactiveThreshold, ObjectStoreSpec.TTL, StreamSpec.MaxAge, and StreamSpec.SubjectDeleteMarkerTTL.

Who benefits from this change?

Users would see an more consistent API. When/if NACK changes to automatically generating the CRDs then the extra methods that metav1.Duration provide will enhance the documentation.

What alternatives have you evaluated?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalEnhancement idea or proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions