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

Track info.Err in the status field #389

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haiyanmeng
Copy link
Contributor

This allows the reconcilation errors such as errors encountered in the object transformers to be tracked in the field status.errors.

Currently, if errors happens during the execution of an object tranformer, the status field is set to:

status:
  healthy: false
  phase: InternalError

With this CL, the reconciliation errors are tracked in the field status.errors:

status:
  errors:
  - 'error building deployment objects: a test error'
  healthy: false
  phase: InternalError

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 31, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @haiyanmeng. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 31, 2024
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 31, 2024
@yuwenma
Copy link
Contributor

yuwenma commented May 31, 2024

two questions:

  1. I think we normally use the conditions for detailed error information.
  2. If tracking an object error, the errors should reflect the current status rather than a error history. Thus, I think we shall have a way to clean up stale errors.

@haiyanmeng
Copy link
Contributor Author

  1. I think we normally use the conditions for detailed error information.

How does the status.errors field being used today? Is it always empty?

  1. If tracking an object error, the errors should reflect the current status rather than a error history. Thus, I think we shall have a way to clean up stale errors.

Great point. Fixed it.

@tomasaschan
Copy link
Member

I agree this would be better to add to conditions rather than errors.

Not quite sure how errors is used today, though, but I feel like whatever it is used for should probably, eventually, be ported over to be exposed in conditions instead. Of course, that should not block you from exposing this info on the resource status, but we might want to be a little strict about adding more things to errors if we already know we might want to migrate away from it...

@tomasaschan
Copy link
Member

Fwiw, this relates to #190.

@haiyanmeng
Copy link
Contributor Author

Not quite sure how errors is used today, though, but I feel like whatever it is used for should probably, eventually, be ported over to be exposed in conditions instead.

Do we plan to deprecate the fields healthy and phase too?

type CommonStatus struct {
	Healthy bool     `json:"healthy"`
	Errors  []string `json:"errors,omitempty"`
	Phase   string   `json:"phase,omitempty"`
}

@tomasaschan
Copy link
Member

I don't know if the project has actually made any decisions in this direction, but I think we should 😸

I base this mostly on the Kubernetes API Conventions guide, where the following passage can be found:

Some resources in the v1 API contain fields called phase, and associated message, reason, and other status fields. The pattern of using phase is deprecated. Newer API types should use conditions instead.

But I do think this change makes the behavior better than it currently is, so I'm a little on the fence on whether to just say "that's a project for another day" and go with this as it is...

Copy link
Contributor

@justinsb justinsb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably look at making this more structured and supporting status.Conditions, but ... LGTM!

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 7, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haiyanmeng, justinsb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 7, 2024
@justinsb
Copy link
Contributor

justinsb commented Jun 7, 2024

Sorry, missed a lot of the context here when I approved this in VSCode!

I agree that we want to move to status.conditions. I think that will (likely?) have to be opt-in at the controller level; likely new controllers will stop using the "old" status fields altogether and existing controllers will support both (?). I think if we do that it can be something we can implement relatively quickly, at least for the new case.

I think adding this to the "old" status fields (healthy/phase/errors) makes sense in the interim / for controllers that choose not to support the "new" status fields (conditions)

@justinsb
Copy link
Contributor

justinsb commented Jun 7, 2024

/test pull-declarative-test

(In the hope that it's just a flake .. we should still fix flakes, but we don't need to fix it in this PR)

@haiyanmeng
Copy link
Contributor Author

/test pull-declarative-test

@k8s-ci-robot
Copy link
Contributor

@haiyanmeng: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test pull-declarative-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@haiyanmeng
Copy link
Contributor Author

Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

@justinsb , how can I become a trusted user? This would allow me to trigger tests.

@tomasaschan
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 10, 2024
This allows the reconcilation errors such as errors encountered in the
object transformers to be tracked in the field `status.errors`.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2024
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

@haiyanmeng: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-declarative-test 1715db6 link true /test pull-declarative-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants