Skip to content

Conversation

@porridge
Copy link

No description provided.

@robertsirc
Copy link
Member

@mattfarina

@robertsirc
Copy link
Member

can you look at this?

Comment on lines 67 to 84
#### 1. Official support for a policy which disables hook deletion

Add a new, documented hook deletion policy value: `never`.
When specified, such hook resource is not deleted.
Effectively, the same as suggestion for Helm 3, but explicitly supported.

Pros:
- Keeps compatibility with Helm 3.
- Allows a notion of resources which are installed by helm, but afterwards not managed by it in any way.
- StackRox chart continues to work as before without changing.
- Other charts (if any) which happen depend on current undocumented behaviour could easily be made to work by changing
whatever value they use to `never`.

Cons:
- It seems that hooks were generally intended to be resources whose previous instances are cleaned up
before (subsequent) chart applications. Supporting this policy breaks this assumption and
introduces some complexity when reasoning about possible scenarios. For example such `pre-install`
hook resources need to be guarded by a `if $.Release.IsInstall` condition in order not to break upgrades.

Choose a reason for hiding this comment

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

I prefer this one and would call it a bug fix. I think the con you listed, while valid, is probably the expected behavior for anyone that was previously using a not-supported string. This would just make it more explicit.

Comment on lines +124 to +130
Add a linter check that complains if an undocumented value for hook deletion policy is used.

Pros:
- Raises awareness about this issue.

Cons:
- None?

Choose a reason for hiding this comment

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

This should also be true.

@scottrigby
Copy link
Member

From today's meeting per @mattfarina – this non-backwards-compatibility should be for charts API v3. charts api v2 should work the same way.

Also @porridge please change to hip-9999 to start until a number is assigned.

@porridge porridge changed the title HIP 0027: Handling unknown hook-delete-policy values HIP: Handling unknown hook-delete-policy values Oct 13, 2025
- Refer to Helm charts API version, rather than Helm version.
- Capitalize Helm.

Signed-off-by: Marcin Owsiany <[email protected]>
@porridge
Copy link
Author

From today's meeting per @mattfarina – this non-backwards-compatibility should be for charts API v3. charts api v2 should work the same way.

Also @porridge please change to hip-9999 to start until a number is assigned.

Thanks @scottrigby I changed the HIP number and references to Helm 3/4 into references to Helm charts API v2/3.

- Other charts (if any) which happen depend on current undocumented behaviour could easily be made to work by changing
whatever value they use to `never`.

Cons:
Copy link
Member

Choose a reason for hiding this comment

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

Does Helm apply the standard labels to hook objects?

https://helm.sh/docs/chart_best_practices/labels/#standard-labels

If so, another con is that if the chart is uninstalled. The object will remain, appearing to be managed by Helm, when that is not true.

- Other charts (if any) which happen depend on current undocumented behaviour could easily be made to work by changing
whatever value they use to `never`.

Cons:
Copy link
Member

@gjenkins8 gjenkins8 Dec 4, 2025

Choose a reason for hiding this comment

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

The docs say (for Charts API v2 of course):

Garbage collection of hook resources when the corresponding release is deleted may be added to Helm 3 in the future, so any hook resources that must never be deleted should be annotated with helm.sh/resource-policy: keep.

Another con is that never duplicates the functionality of the (currently) documented approach

Copy link
Member

Choose a reason for hiding this comment

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

This option should consider deprecating the helm.sh/resource-policy: keep policy for hooks?

- It seems that hooks were generally intended to be resources whose previous instances are cleaned up
before (subsequent) chart applications. Supporting this policy breaks this assumption and
introduces some complexity when reasoning about possible scenarios. For example such `pre-install`
hook resources need to be guarded by a `if $.Release.IsInstall` condition in order not to break upgrades.
Copy link
Member

@gjenkins8 gjenkins8 Dec 4, 2025

Choose a reason for hiding this comment

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

pre-install hook objects are only created on install, right?

Why would a if $.Release.IsInstall condition be required to stop the object from being created on upgrade?

for installation; StackRox operator would still use Helm library internally, and manage the storage resources differently,
as it does now.

#### 4. Reject undocumented policies (_other than_ `never`)
Copy link
Member

Choose a reason for hiding this comment

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

This is really a sub-option of option 1? (which can choose to reject unknown policy values or not)

- If an older chart exists out there that uses an undocumented value other than `never`,
then its legacy versions would be incompatible with Helm charts API v3.

#### 5. Warn about undocumented policies
Copy link
Member

Choose a reason for hiding this comment

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

We should do this regardless I think

Copy link
Member

Choose a reason for hiding this comment

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

(also for Charts API v2)

Disclaimer: some of the reasoning below are conjectures since the motivation is lost in the mists of time.

A Helm chart was introduced for the StackRox project around 2020.
At that time, there was a strong concern that a user mistake might lead to data loss,
Copy link
Member

Choose a reason for hiding this comment

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

Note: iirc, Helm has special logic (that I disagree with) that retains PVs upon delete

Charts API v3 should remove this IMHO

### For Helm charts API v2

- No semantic changes to production code.
- There already is a [regression test](https://github.com/helm/helm/pull/31385) to make sure that the current behaviour is not changed by mistake.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- There already is a [regression test](https://github.com/helm/helm/pull/31385) to make sure that the current behaviour is not changed by mistake.
- There already is a [regression test](https://github.com/helm/helm/pull/31385) (merged) to make sure that the current behaviour is not changed by mistake.

- suggests keeping status quo for Helm charts API v2, for the sake of backwards compatibility,
- outlines a few options for charts API v3.

### For Helm charts API v2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
### For Helm charts API v2
### Charts API v2

nitpick: touch more clear I think

(and same for v3 below)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants