Skip to content

IMPROVE: Report problems in consistent way #2344

@programmer04

Description

@programmer04

Problem Statement

Problems with configuration and/or operator should be reported to the user. There are 3 main ways of doing it. In KO, all of them are used.

  1. Kubernetes Events
    Operators should create events that describe configuration errors. Events are attached to relevant resources (like the DataPlane, ControlPlane, etc.).
    Users can view events using:

    kubectl describe <resource> <name>
  2. Status Field in Custom Resources
    Operators should update the .status field in the CR to describe validation errors or configuration problems.
    Users can view status using:

    kubectl get <crd> <name> -o yaml

    Example status block:

    ...
    status:
      conditions:
      - type: Ready
        status: False
        reason: InvalidConfiguration
        message: "Invalid value for field 'foo': must be a number"
  3. Logs
    Logs are useful for debugging and deep diagnostics, but they are not a Kubernetes-native way to report user-facing configuration problems for operators.

Proposed Solution

Use logs for internal troubleshooting and diagnostics. Spamming with configuration-related errors that are fixable by the user may not be desired by cluster administrators and may result in excessive billing in the monitoring system.

Problems with user configuration should be reported via Events and by updating the Status field of the Custom Resource. This is the Kubernetes-native way for operators to communicate errors and issues to users. Both of them should be updated to be consistent.

Additional Information

Let's agree on the general approach and use it everywhere. Every way has its own benefits and drawbacks. Sometimes what seems best from a purity/technical standpoint may not be what our users prefer. Thus, consult with the product.

Acceptance Criteria

  • A decision log / document is prepared with error category the decision has been made whether to log it / create an Event for it / status field of object is updated
  • A short guideline is prepared and committed to the repository
  • Create task(s) to make it consistent in KO

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions