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

HIP: dependency update evaluate conditionals #296

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions hips/hip-9999.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
hip: "9999"
title: "Support for Conditionals in helm dependency update"
authors: [ "Yonah Dissen <[email protected]>" ]
created: "2023-04-13"
type: "feature"
status: "draft"
---

## Abstract:

Currently, when using Helm charts with dependencies that have conditions specified in their Chart.yaml file e.g.
```
dependencies:
- name: nginx
version: "1.3.1"
condition: is.enabled
```
the conditionals are only evaluated during the installation process,
but not during the helm dependency update command. This can be confusing and can require workarounds to manage different versions of dependencies in different environments.
This proposal suggests enhancing the helm dependency update command to also evaluate the conditionals in the dependencies during the update process.

## Motivation:

Helm allows defining dependencies in a chart's Chart.yaml file which can have conditions specified using the condition field. This allows installing different versions of a dependency based on environment-specific requirements.
However, the current behavior of helm dependency update command, which updates all dependencies regardless of their conditions,
can cause confusion and inconvenience when managing different versions of dependencies in different environments.
In addition this would save unneccessary storage space consumed by the unwanted dependencies.

## Proposal:

The proposal suggests enhancing the helm dependency update command to evaluate the conditions specified in the dependencies' Chart.yaml file.
Currently, during the update process, helm dependency update fetches the latest versions of all dependencies and updates the requirements.lock file.
The proposal suggests modifying the update process to also consider the conditions specified in the dependencies, and only update the dependencies that satisfy their conditions.
This can be achieved by reusing the existing code used during the installation process that evaluates the conditions, and applying it during the helm dependency update command as well.

This enhancement would make managing different versions of dependencies in different environments more straightforward, without requiring workarounds such as using alias charts or conditional logic in the chart templates.
It would align with the behavior of dependencies during the installation process and provide a more intuitive and consistent experience for Helm users.

## Implementation Details:

The implementation of this proposal would require modifying the helm dependency update command to evaluate the conditions specified in the dependencies' Chart.yaml file during the update process.
This can be achieved by reusing the existing code used during the installation process that evaluates the conditions and updating the dependencies' versions only if their conditions are satisfied.
The updated dependencies' versions would then be reflected in the requirements.lock file.

## Backward Compatibility:

This proposal enhances the behavior of helm dependency update to evaluate the conditions specified in the dependencies' Chart.yaml file.
Existing charts with dependencies that do not have conditions specified would continue to work as before, and charts with conditions would benefit from the updated behavior during the helm dependency update command.

However, to maintain backward compatibility and provide flexibility, a new flag, such as --ignore-conditions, could be introduced to allow users to opt-out of condition evaluation during helm dependency update if they prefer to update all dependencies regardless of their conditions.
This flag would provide users with the option to choose whether to consider conditions during the update process or not, depending on their requirements.

## Conclusion:

The proposed enhancement to support conditionals in the helm dependency update command, along with the introduction of a flag to ignore conditions, would improve the consistency and usability of Helm charts with dependencies that have conditions specified.
It would provide a more intuitive way to manage different versions of dependencies in different environments, align with the behavior of dependencies during the installation process, and also provide flexibility for users who may need to update all dependencies regardless of conditions.
This proposal aims to simplify the management of Helm charts with dependencies and improve the overall user experience with Helm.