|
| 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 | +helm-version: "4" |
| 9 | +--- |
| 10 | + |
| 11 | +## Abstract |
| 12 | + |
| 13 | +This HIP proposes supporting a `minimumHelmVersion` field in `Chart.yaml`. |
| 14 | +By enabling this feature, an error can be raised if the Helm version used to operate on the chart is below the declared version. |
| 15 | +This allows Helm to provide forward compatibility guarantees for Helm features/functionality over time. |
| 16 | + |
| 17 | + |
| 18 | +## Motivation |
| 19 | + |
| 20 | +Helm has no mechanism for a chart to declare the minimal version of Helm required for the chart to install/update correctly. |
| 21 | +As such, it is invalid to release a chart that utilizes features/fixes included in newer versions of Helm. |
| 22 | + |
| 23 | +At best, any incompatibility will be detected and there will be an explicit failure (and the user will be notified with an error). |
| 24 | +But potentially an incompatibility may go undetected, and no hard error will be presented. |
| 25 | + |
| 26 | +While the hard-failure case is better, it still requires the user to debug and realize the failure is due to a version mismatch. |
| 27 | +The second "soft-failure" case is much worse, as it could lead to unexpected behavior in the deployed chart application, 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 minimum 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, if 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 (if it exists) and perform the version constraint check at this point. |
| 59 | +This is to provide better UX than simply raising an error on any potential new fields in `Chart.yaml` that are unknown to the current version of Helm. |
| 60 | + |
| 61 | +## Backwards compatibility |
| 62 | + |
| 63 | +As `minimumHelmVersion` is an optional field, it will be inferred to be unset in existing charts. |
| 64 | +And when unset, Helm will retain existing behavior (no check will be implemented) |
| 65 | + |
| 66 | +Older versions of Helm which do not understand the `minimumHelmVersion` field will ignore the field even if set (as they load `Chart.yaml` ignoring unknown fields). |
| 67 | +However, there isn't anything that can practically be done to address this encoded behavior. |
| 68 | + |
| 69 | + |
| 70 | +## Security implications |
| 71 | + |
| 72 | +None |
| 73 | + |
| 74 | + |
| 75 | +## How to teach this |
| 76 | + |
| 77 | +Update docs for `Chart.yaml` |
| 78 | + |
| 79 | + |
| 80 | +## Reference implementation |
| 81 | + |
| 82 | +N/A |
| 83 | + |
| 84 | + |
| 85 | +## Rejected ideas |
| 86 | + |
| 87 | +**Generic version contraints:** |
| 88 | +It is thought a "minimum" constraint is preferred over a generic "constraint" system. |
| 89 | +ie. where a user could list multiple version constraints to be satisfied |
| 90 | +Similar to e.g. [pip's requirement-specifiers][3]. |
| 91 | +This is because Helm makes great effort to remain [backwards compatibility][4]. |
| 92 | +And so it is presumed unnecessary that a user would need to specify anything but a single minimum version constraint. |
| 93 | +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. |
| 94 | + |
| 95 | +**Capabilities:** |
| 96 | +Providing a capabilities based system. |
| 97 | +Rather than just directly inferring Helm capabilities from its version. |
| 98 | + |
| 99 | +A `Chart.yaml` could describe its required features ie. capabilities it expects/requires the Helm version to provide. |
| 100 | +Helm could inspect and match against features/capabilities that the specific version does provide. |
| 101 | +However, since core Helm capabilities are only every additive due to Helm's [backwards-compatibility rules][4], a capabilities based system is redundant. |
| 102 | + |
| 103 | +*NB: at the time of writing, plugins for extending Helm's functionality are being heavily discussed. |
| 104 | +And while plugins will likely allow extending capabilities independent of the Helm version, it is presumed plugins will include their own version constraint specifier system. |
| 105 | +That will ensure conditions for valid plugin versions are met* |
| 106 | + |
| 107 | +### Future ideas |
| 108 | + |
| 109 | +Extending `helm lint` to detect incompatible chart features for the currently specified `minimumHelmVersion`. |
| 110 | + |
| 111 | + |
| 112 | +## Open issues |
| 113 | + |
| 114 | +N/A |
| 115 | + |
| 116 | + |
| 117 | +## References |
| 118 | + |
| 119 | +[1]: <https://go.dev/blog/toolchain#forward> "Golang forward compatibility" |
| 120 | +[2]: <https://semver.org> "Semantic versioning" |
| 121 | +[3]: <https://pip.pypa.io/en/stable/reference/requirement-specifiers/#requirement-specifiers> "Pip request-specifiers" |
| 122 | +[4]: <hip-0004.md> "hip-0004: Document backwards-compatibility rules" |
0 commit comments