K-Phoen / dark

(grafana) Dashboards As Resources in Kubernetes
MIT License
428 stars 21 forks source link

fix(controllers): do not reconcile status updates #233

Closed jlevesy closed 1 year ago

jlevesy commented 1 year ago

What does this PR do?

This PR places an event filter when setting up that filters out updates to the status of all managed resources by this controller. We only want to reconcile the dashboards only if there's a change in the spec of the object, not the status.

I'm not 100% sure of myself but I suspect this creates an infinite loop of events: as it is, when the first reconciliation is done, dark sets the status to OK, which triggers another update and another reconciliation, and another status update... and so on and so forth 😅

Happy to chat about this.

Reference: https://github.com/kubernetes-sigs/kubebuilder/issues/1103 and https://github.com/kubernetes-sigs/kubebuilder/issues/618

jlevesy commented 1 year ago

CI failure looks unrelated. I'll take a stab at fixing it.

codecov-commenter commented 1 year ago

Codecov Report

Merging #233 (653c817) into master (675523d) will decrease coverage by 0.07%. Report is 4 commits behind head on master. The diff coverage is 16.66%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/K-Phoen/dark/pull/233/graphs/tree.svg?width=650&height=150&src=pr&token=GSxlROtzzx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez)](https://app.codecov.io/gh/K-Phoen/dark/pull/233?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez) ```diff @@ Coverage Diff @@ ## master #233 +/- ## ========================================== - Coverage 40.99% 40.93% -0.07% ========================================== Files 39 39 Lines 2583 2587 +4 ========================================== Hits 1059 1059 - Misses 1484 1488 +4 Partials 40 40 ``` | [Files](https://app.codecov.io/gh/K-Phoen/dark/pull/233?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez) | Coverage Δ | | |---|---|---| | [...nternal/pkg/controllers/alertmanager\_controller.go](https://app.codecov.io/gh/K-Phoen/dark/pull/233?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez#diff-aW50ZXJuYWwvcGtnL2NvbnRyb2xsZXJzL2FsZXJ0bWFuYWdlcl9jb250cm9sbGVyLmdv) | `0.00% <0.00%> (ø)` | | | [internal/pkg/controllers/apikey\_controller.go](https://app.codecov.io/gh/K-Phoen/dark/pull/233?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez#diff-aW50ZXJuYWwvcGtnL2NvbnRyb2xsZXJzL2FwaWtleV9jb250cm9sbGVyLmdv) | `0.00% <0.00%> (ø)` | | | [internal/pkg/controllers/datasource\_controller.go](https://app.codecov.io/gh/K-Phoen/dark/pull/233?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez#diff-aW50ZXJuYWwvcGtnL2NvbnRyb2xsZXJzL2RhdGFzb3VyY2VfY29udHJvbGxlci5nbw==) | `0.00% <0.00%> (ø)` | | | [...nal/pkg/controllers/grafanadashboard\_controller.go](https://app.codecov.io/gh/K-Phoen/dark/pull/233?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez#diff-aW50ZXJuYWwvcGtnL2NvbnRyb2xsZXJzL2dyYWZhbmFkYXNoYm9hcmRfY29udHJvbGxlci5nbw==) | `0.00% <0.00%> (ø)` | | | [internal/pkg/converter/gauge.go](https://app.codecov.io/gh/K-Phoen/dark/pull/233?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K%C3%A9vin+Gomez#diff-aW50ZXJuYWwvcGtnL2NvbnZlcnRlci9nYXVnZS5nbw==) | `55.00% <50.00%> (ø)` | |
K-Phoen commented 1 year ago

Thanks!