Skip to content

Conversation

@cappyzawa
Copy link
Member

Resolves: #1352

@cappyzawa cappyzawa marked this pull request as ready for review January 16, 2026 11:41
@cappyzawa cappyzawa force-pushed the issues/1352 branch 2 times, most recently from 931da80 to 8442962 Compare January 16, 2026 15:23
@hiddeco
Copy link
Member

hiddeco commented Jan 16, 2026

Wouldn't it be better to build this state through observations in the storage layer?

@matheuscscp
Copy link
Member

Wouldn't it be better to build this state through observations in the storage layer?

Hi @hiddeco! You raise an excellent point here, that was my recommendation as well. I was told that doing this through storage observations would be more reliable. I have a gut feeling that this is accurate, but I don't have the precise explanation. Could you please shed some light on the details of why this is more reliable? (I'm guessing that the explanation is a one-liner but I can't get it together myself)

@cappyzawa
Copy link
Member Author

@matheuscscp You did mention using storage.ObserveFunc in your initial guidance - I apologize for losing track of that recommendation as I progressed through the implementation.

@hiddeco @matheuscscp You're both right. Using the storage layer would bring a similar pattern to kustomize-controller - building inventory at the point of persistence rather than fetching from Helm storage after the fact.

I'll rework the implementation to use ObserveFunc.

@cappyzawa cappyzawa added hold Issues and pull requests put on hold and removed hold Issues and pull requests put on hold labels Jan 16, 2026
@cappyzawa
Copy link
Member Author

Thanks for the great feedback! I've addressed the suggestions in 7d3fa01:

  • Removed buildInventory() from atomic_release.go and reimplemented as observeInventory() in release.go
  • Uses storage.ObserveFunc pattern to build inventory when the release is persisted to storage
  • Install/Upgrade/Rollback call observeInventory, Uninstall clears the inventory
  • Emits warning event on error (no log, following existing patterns in the reconcile package)
  • Added inventory assertions to install_test.go, upgrade_test.go, uninstall_test.go

Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

Great iteration!

@stefanprodan stefanprodan added enhancement New feature or request area/api API related issues and pull requests labels Jan 19, 2026
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

Please add a section to the API docs for the inventory after https://github.com/fluxcd/helm-controller/blob/main/docs/spec/v2/helmreleases.md#history

Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

Please squash for the merge 😁

This adds the `.status.inventory` field to HelmRelease, similar to
Kustomization, to expose managed Kubernetes objects.

The inventory includes:
- Objects from the release manifest (with namespace complement)
- CRDs from the chart's crds/ directory

Helm hooks are excluded as they are ephemeral resources deleted
after execution.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
@matheuscscp matheuscscp merged commit fd77f8b into fluxcd:helm4 Jan 22, 2026
2 checks passed
@cappyzawa cappyzawa deleted the issues/1352 branch January 22, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API related issues and pull requests enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants