Skip to content

Panic policy #634

Open
kube-rs/website
#21
@nightkr

Description

@nightkr

Currently, we have a bunch of helpers that can implicitly panic the program when their invariants aren't upheld externally, such as ResourceExt::name. These essentially allow the apiserver (or any other source of Resource-impling objects) to panic the whole process.

Are these a good idea to encourage? Should we at least ban their transitive usage within the core kube crates?

If we do keep them around, we should probably at the very least document a policy for which invariants should be allowed to cause kube to panic. For example, it's worth considering (in escalating order of exposure):

  1. private kube invariants
  2. kube invariants exposed to the application (for example: any object to be created on the apiserver must have a non-empty .metadata.name xor .metadata.generate_name)
  3. apiserver invariants (for example: any object returned by the apiserver must have a non-empty .metadata.name)
  4. object-level expectations (for example: Pod will pretty much always have >=1 container)

Currently we don't really have a strong policy on this (or we wouldn't need this issue), but in general we've been leaning towards 3 being the limit for when we're allowed to panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsunclear documentationerrorserror handling or error ergonomics

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions