Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point to K8s Events emitted for misconfigured objects in their statuses automatically #6842

Open
2 of 3 tasks
programmer04 opened this issue Dec 16, 2024 · 0 comments
Open
2 of 3 tasks
Labels
area/debt area/feature New feature or request

Comments

@programmer04
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Does this enhancement require public documentation?

  • I have added an Acceptance Criteria item for adding and/or adjusting public documentation (if applicable)

Problem Statement

Discovered during work on

that mechanism for setting appropriate values in the object's status field automatically when a K8s Event with Warning severity is generated for such an object is only implemented for generated controllers with the helper EnsureProgrammedCondition.

Hence, for e.g. HTTPRoute in such a situation, something like this happens

...
  status:
    parents:
    - conditions:
      - lastTransitionTime: "2024-12-12T16:06:22Z"
        message: ""
        observedGeneration: 1
        reason: Accepted
        status: "True"
        type: Accepted
      - lastTransitionTime: "2024-12-12T16:06:22Z"
        message: ""
        observedGeneration: 1
        reason: ResolvedRefs
        status: "True"
        type: ResolvedRefs
      - lastTransitionTime: "2024-12-12T16:06:22Z"
        message: ""
        observedGeneration: 1
        reason: Unknown
        status: Unknown
        type: Programmed
      controllerName: konghq.com/kic-gateway-controller
      parentRef:
        group: gateway.networking.k8s.io
        kind: Gateway
        name: kong
        namespace: default

having reason and status set to Unknown is not the best user experience. Even generic information is provided by the helper EnsureProgrammedCondition to check K8s Events generated for a respective object is much better user experience. e.g.

Proposed Solution

Adjust and reuse EnsureProgrammedCondition to provide properly set status for an object when a Warning K8s Event is registered for it. So for the example mentioned above instead of Unknown something like the below should be populated.

...
  status:
    conditions:
    - lastTransitionTime: "2024-12-06T14:35:10Z"
      message: Object failed to be configured in Kong - see its attached Events for
        more information.
      observedGeneration: 1
      reason: Invalid
      status: "False"
      type: Programmed

It's a baseline and a nice default. Of course, having as detailed as possible statuses in addition to K8s Event makes KIC easier to use. Actual handling should be decided case by case.

Additional information

No response

Acceptance Criteria

  • For any configured K8s object, when a K8s Event with severity Warning is emitted, status is set accordingly as it happens for cgenerated controllersgenerated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/debt area/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant