| 
 | 1 | +---  | 
 | 2 | +hip: 9999  | 
 | 3 | +title: "Forward compatibility: Chart.yaml minimumHelmVersion"  | 
 | 4 | +authors:  [ "George Jenkins <[email protected]>" ]  | 
 | 5 | +created: "2024-11-18"  | 
 | 6 | +type: "feature"  | 
 | 7 | +status: "draft"  | 
 | 8 | +---  | 
 | 9 | + | 
 | 10 | +## Abstract  | 
 | 11 | + | 
 | 12 | +This HIP proposes supporting a `minimumHelmVersion` field in `Chart.yaml`.  | 
 | 13 | +That will allow Helm to directly error if the Helm version used to operate on the chart is below this version.  | 
 | 14 | +Allowing Helm to provide forward compatibility guarantees for Helm features/functionality over time.  | 
 | 15 | + | 
 | 16 | + | 
 | 17 | +## Motivation  | 
 | 18 | + | 
 | 19 | +Helm has no mechanism for a chart to declare the minimal version of Helm required for the chart to install/update correctly.  | 
 | 20 | +As such, it is invalid to release a chart that utilizes features/fixes included in newer versions of Helm.  | 
 | 21 | + | 
 | 22 | +At best, any incompatibility will be detected and there will an explicit failure (and the user will be notified as an error).  | 
 | 23 | +But potentially an incompatibility may go undetected, and no hard error will be presented.  | 
 | 24 | + | 
 | 25 | +While the hard-failure case is better, it still requires the user to debug and conclude the failure is due to a version mismatch.  | 
 | 26 | +The second "soft-failure" case is much worse, as it could lead to unexpected behavior in the deployed chart application.  | 
 | 27 | +Likely requiring a much more involved debugging requirement and confusing user experience.  | 
 | 28 | + | 
 | 29 | +Providing a mechanism for a chart to prescribe the minimum versions of Helm for the chart's feature set will enable chart developers to prevent indirect errors for chart consumers/operators.  | 
 | 30 | + | 
 | 31 | +Supporting a simple SemVer based `minimumHelmVersion` field in chart's `Chart.yaml` is thought to be a simple way to provide forward compatibility guarantees.  | 
 | 32 | + | 
 | 33 | + | 
 | 34 | +## Rationale  | 
 | 35 | + | 
 | 36 | +It is thought that over time, as Helm extends its functionality, there will be greater scope for forward compatibility errors to present themselves.  | 
 | 37 | + | 
 | 38 | +And in particular, the mechanism that describes the minimum feature set must be built into and understood by prior versions of Helm.  | 
 | 39 | + | 
 | 40 | +Utilizing a simple minimum version SemVer field in a chart is thought to be a simple and succinct way to enable forward compatibility guarantees for future versions of Helm.  | 
 | 41 | + | 
 | 42 | +Similar to the way the Go toolchains allow forward compatibility guarentees via [`go.mod`][1].  | 
 | 43 | + | 
 | 44 | + | 
 | 45 | +## Specification  | 
 | 46 | + | 
 | 47 | +`Chart.yaml` will include an optional field `minimumHelmVersion`, which is a [SemVer][2] string for the version of Helm required for the chart to operate:  | 
 | 48 | + | 
 | 49 | +```  | 
 | 50 | +minimumHelmVersion: <MAJOR>[.<MINOR>[.PATCH]]  | 
 | 51 | +```  | 
 | 52 | + | 
 | 53 | +The minor and patch fields are optional.  | 
 | 54 | +And will be inferred as zeros if not specified.  | 
 | 55 | + | 
 | 56 | +When loading a chart, iff the `minimumHelmVersion` exists, Helm will verify its version exceeds or equals the version constraint specified in the field.  | 
 | 57 | + | 
 | 58 | +When "strict" loading of `Chart.yaml` is used: ie. the loading of `Chart.yaml` errors when unknown fields are present, Helm will first 'peek' into `Chart.yaml` and extract the `minimumHelmVersion` field (iff it exists) and perform the version constraint check at this point.  | 
 | 59 | +This is to provide better UX that simply erroring on any potential new fields in `Chart.yaml` that are unknown to the current version of Helm.  | 
 | 60 | + | 
 | 61 | +`helm create` will pre-fill Chart.yaml's `minimumHelmVersion` field with the current version of Helm.  | 
 | 62 | +While this may not be strictly necessary, it will provide a backstop for features that may be included in the chart by the user for their current Helm version or `helm create`.  | 
 | 63 | +The user can remove/reduce the specified `minimumHelmVersion` if desired.  | 
 | 64 | + | 
 | 65 | +`helm lint` will produce a warning, if the current version of Helm is newer than the minimum version constraint.  | 
 | 66 | +This is to encourage users to update the minimum version to currently utilized version of Helm (that the user is using to develop the chart).  | 
 | 67 | + | 
 | 68 | + | 
 | 69 | +## Backwards compatibility  | 
 | 70 | + | 
 | 71 | +As `minimumHelmVersion` is an optional field, it will be inferred to be unset in existing charts.  | 
 | 72 | +And when unset, Helm will retain existing behavior (won't implement any checks)  | 
 | 73 | + | 
 | 74 | +Older versions of Helm which don't understand the `minimumHelmVersion` field will actually ignore the field even if set (as they load `Chart.yaml` ignoring unknown fields).  | 
 | 75 | +However, there isn't anything that can practically be done to address this encoded behavior.  | 
 | 76 | +Also see [HIP-9999 (Default to strict `Chart.yaml` loading)](./hip-9999.md) for a fix for this going forward.  | 
 | 77 | + | 
 | 78 | +Operations that utilize strict yaml loaded (such as `helm lint` in newer versions of Helm v3) will outright fail to load a `Chart.yaml` with `minimumHelmVersion` set (with a generic "unknown field" error). However, while this error isn't as specific as desirable, an error is appropriate.  | 
 | 79 | + | 
 | 80 | + | 
 | 81 | +## Security implications  | 
 | 82 | + | 
 | 83 | +None  | 
 | 84 | + | 
 | 85 | + | 
 | 86 | +## How to teach this  | 
 | 87 | + | 
 | 88 | +Update docs for `Chart.yaml`  | 
 | 89 | + | 
 | 90 | + | 
 | 91 | +## Reference implementation  | 
 | 92 | + | 
 | 93 | +N/A  | 
 | 94 | + | 
 | 95 | + | 
 | 96 | +## Rejected ideas  | 
 | 97 | + | 
 | 98 | +**Generic version contraints:**  | 
 | 99 | +It is thought a "minimum" constraint is preferred over a generic "constraint" system.  | 
 | 100 | +ie. where a user could list multiple version constraints to be satisfied  | 
 | 101 | +Similar to e.g. [pip's requirement-specifiers][3].  | 
 | 102 | +This is because Helm makes great effort to remain [backwards compatible][4].  | 
 | 103 | +And so it is presumed unnecessary that a user would need to specify anything but a single minimum version constraint.  | 
 | 104 | +And in the future when Helm does make breaking changes to charts, it is expected the chart API version will be incremented to explicitly signify this new incompatiblity.  | 
 | 105 | + | 
 | 106 | +**Capabilities:**  | 
 | 107 | +Providing a capabilities based system.  | 
 | 108 | +Rather than just directly inferring Helm capabilities from its version.  | 
 | 109 | + | 
 | 110 | +A `Chart.yaml` could describe its required features ie. capabilities it expects/requires the Helm version to provide.  | 
 | 111 | +From which Helm could inspect and matches against features/capabilities the in use version does provide.  | 
 | 112 | +However, since core Helm capabilities are only every additive due to Helm's [backwards-compatibility rules][4], a capabilities based system is redundant.  | 
 | 113 | + | 
 | 114 | +*NB: at the time of writing, plugins for extending Helm's functionality are being heavily discussed.  | 
 | 115 | +And while plugins will likely allow extending capabilities independent of the Helm version.  | 
 | 116 | +It is presumed plugins will include their own version constraint specifier system.  | 
 | 117 | +That will ensure conditions for valid plugin versions are met*  | 
 | 118 | + | 
 | 119 | +### Future ideas  | 
 | 120 | + | 
 | 121 | +Extending Helm lint to detect incompatible chart features for the currently specified `minimumHelmVersion`.  | 
 | 122 | + | 
 | 123 | + | 
 | 124 | +## Open issues  | 
 | 125 | + | 
 | 126 | +N/A  | 
 | 127 | + | 
 | 128 | + | 
 | 129 | +## References  | 
 | 130 | + | 
 | 131 | +[1]: <https://go.dev/blog/toolchain#forward> "Golang forward compatibility"  | 
 | 132 | +[2]: <https://semver.org> "Semantic versioning"  | 
 | 133 | +[3]: <https://pip.pypa.io/en/stable/reference/requirement-specifiers/#requirement-specifiers> "Pip request-specifiers"  | 
 | 134 | +[4]: <hip-0004.md> "hip-0004: Document backwards-compatibility rules"  | 
0 commit comments