kubernetes-sigs / kubebuilder-declarative-pattern

A toolkit for building declarative operators with kubebuilder
Apache License 2.0
253 stars 84 forks source link

If an object transform fails, status is never updated #190

Closed tomasaschan closed 1 year ago

tomasaschan commented 2 years ago

What happened: Consider a declarative reconciler set up like this:

func (r *MyReconciler) setupReconciler(mgr ctrl.Manager) (declarative.LabelMaker, error) {
    // ...

    return watchLabels, r.Reconciler.Init(mgr, &myapiv1.MyResource{},
        // ...
        declarative.WithStatus(status.NewBasic(mgr.GetClient()),
        declarative.WithObjectTransform(myTransform),
    )
}

func myTransform(ctx context.Context, object declarative.DeclarativeObject, objects *manifest.Objects) error {
    return errors.New("demonstrate the issue")
}

What you expected to happen: When reconciling this resource, I would expect the status to be updated with .status.healthy: false, and at least the error message, perhaps even more detail, exposed in .status.errors and/or .status.phase. Instead, the reconciliation seems to crash completely, requeue itself and not update anything. This leaves the resource hanging without a status, and with no feedback to the user other than the fact that it doesn't have a status...

How to reproduce it (as minimally and precisely as possible):

  1. Define a declarative controller and resource
  2. Add a simple transform function, e.g. the one in the example above, that returns an error
  3. Observe the reconciliation behavior

Anything else we need to know?: I know there's a comment on NewBasic that it's been superseeded by NewKstatusCheck, but I haven't been able to get the latter to actually update the status even in the happy-path case.

Environment:

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

tomasaschan commented 2 years ago

/remove-lifecycle stale

atoato88 commented 2 years ago

In #199, any erros occured in reconciling are pass to Reconciled function. We may be able to utilize those error informations for updating status said this issue, I think.

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

atoato88 commented 2 years ago

/remove-lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

tomasaschan commented 2 years ago

/remove-lifecycle stale /add-lifecycle frozen

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

tomasaschan commented 1 year ago

/remove-lifecycle stale /add-lifecycle frozen

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

tomasaschan commented 1 year ago

/remove-lifecycle-rotten

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 1 year ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/issues/190#issuecomment-1537445023): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.