Repository navigation
Conversation
|
for some reason SignOff check did not pass. |
Yes I forgot the Signoff line in the commit messages. Will attempt the suggested fix. |
OK looks like suggested fix worked; now have two signed off commits. |
|
This is awesome . Such a swift turnaround after we raised this issue with @mattfarina and defiintly a +1 from me. |
Testing: KNOWN BUG: helm list -A does not work, there is an issue in loadRemainingChunks(), K8s API returns error about call requiring value for namespace. Have not yet figured out how to make that work, it's this line that fails: I'm working on multisecrets_test.go and other unit test related changes. Thanks, |
|
@sciornei-dox @liorkesos @mattfarina We think this PR is ready for maintainer review. Thanks to @shipengqi and @yong-jie-gong for fixing helm list -A bug and the multi secret driver unit tests. |
|
Updated PR title to "Support Helm release data stored in multiple K8s Secrets" |
|
@sciornei-dox @liorkesos @mattfarina I wanted to check on the status of this PR as this will solve the size issue of the (single) helm release secret for us. |
|
Hey @mattfarina , Let me know if any change is required in this PR. Thanks! |
|
Note, I am reviewing this. It's going to take some time to work through it, test it, and consider some different implications. |
| Name: instanceName, | ||
| Labels: kblabels.Merge(lbs.toMap(), lbs2.toMap()), | ||
| }, | ||
| Type: "helm.sh/release.v1", |
There was a problem hiding this comment.
Consider the case where you have two Helm users. One deploys an application using chunked secrets and another who doesn't (either has not set chunked secrets or is on an older version of Helm).
In the current setup, the chunked secrets would show up for the user who is using traditional secrets. When they try to perform an operation there will be a broken experience with no direction on how to deal with it. This is an experience problem.
What about a design that shows just non-chunked to secret users but then shows chunked instances to those who have enabled it in addition to regular secrets?
It would be OK to change the Type so that chunked users have a different type (e.g., helm.sh/release.chunk.v1)
There was a problem hiding this comment.
@mattfarina with current implementation, if size <= 10M, "hem list" with HELM_DRIVER="secret" contains all of releases created by "secret" and "multisecret". if we introduce new type "helm.sh/release.chunk.v1", for single release whose size >1MB, first secret data will be labelled by "helm.sh/release.v", others will be labelled by "helm.sh/release.chunk.v1", it is a little bit strange. besides, we dont' benefit from new secret type.
currently, with HELM_DRIVER="multisecret" , "helm list" will contains releases created by "secret" and "multisecret"
with HELM_DRIVER="secret", it will list the releases created with "secret", "multisecret" whose size is <1MB. if we want to support the releases created with "mutlisecret", we need change existing helm secret driver logic. but if that is case, why not make "multisecret" as default. currently, i think with "HLEM_DRIVER=secret", it needn't take care of the secretd created with "multisecret" since it is not supported by itself. what do you think?
There was a problem hiding this comment.
Indeed critical to consider the behavior of old and new clients in parallel, @mattfarina!
The current design considers the situation that helm charts can grow over a period of time, and only eventually run into the size limit. Once this point is reached with a new chart version, the use of the chunked-secret storage is mandatory for all users who manage that release (chart/values combination), a user with an old client would not be able to manage this application any more in any case.
I'd assume that if the multisecret driver introduced a completely new type, then either:
- We could constrain that a switch from secret to multisecret is not even possible - this would kill the upgrade experience and force users to completely restart with a fresh install of release-1, as opposed to smoothly transition from their existing single-secret release version history to now include a multi-secret release version (and potentially back, if the size reduced later on again in a newer release)
- If we allowed the transition from single-secret to multi-secret storage but eclipsed those release versions that stored in chunks, then a user with an old client would see an incomplete version history, and potentially misinterpret what the deployed version actually is (including retrieving wrong values or basing upgrades on wrong version)
I believe both of these approaches would be worse for users than requiring that two users who jointly manage an instance of a deployed application to agree on using the new helm version with the chunked storage feature. Ultimately, the app team that provides such large helm charts would have to give respective instructions to their users, i.e. I cannot imagine that one user knows of the need for multi-secret, and the other doesn't.
I wonder if we could place something in the release info (e.g. in the release description) that would indicate the switch to multisecret mode, such that a helm history with an old client could still display the (multisecret) release as a line item with a human-readable text ("upgrade completed to multisecret storage") that would complement the potential error that an old client would show it someone tried to do a values retrieval or upgrade based on that version?
There was a problem hiding this comment.
@mattfarina as an update to your question on coexistence between multisecret-created helm releases and old helm clients that don't have multisecret support, I have discussed an approach with @joejulian where the multisecret driver uses regular helm.sh/release.v1-type secrets if chunking is not required (the majority of cases), and uses a new secret-type helm.sh/release-multisecret.v1 in those cases where chunking is required because of the 1-MB limit. The following is the experience for users of an old helm client if a release uses the new type:
Helm list does not show the release if the "deployed" release is split across multiple secrets and thus cannot be parsed by the secret storage driver. No cryptic error message, good:
helm list -n apptest
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
If the user wonders about where the release is gone, inspecting the release storage gives a good indication with the different type:
kubectl get secret -n apptest | grep sh.helm
sh.helm.release.v1.apptest.v1 helm.sh/release.v1 1 46h
sh.helm.release.v1.apptest.v2 helm.sh/release.v1 1 46h
sh.helm.release.v1.apptest.v3 helm.sh/release.v1 1 46h
sh.helm.release.v1.apptest.v4 helm.sh/release.v1 1 46h
sh.helm.release.v1.apptest.v5 helm.sh/release.v1 1 46h
sh.helm.release.v1.apptest.v6 helm.sh/release-multisecret.v1 1 25h
sh.helm.release.v1.apptest.v6.2 helm.sh/release-multisecret.v1 1 25h
Helm history works to the level that it lists all non-chunked releases and shows the correct status "superseded". Again, if a user wonders why the "deployed" release does not show, an inspection of the Kube secrets would show:
helm history apptest -n apptest
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Mon Sep 9 16:56:11 2024 superseded apptest-0.0.1 0.0.1 Install complete
2 Mon Sep 9 17:03:24 2024 superseded apptest-0.0.1 0.0.1 Upgrade complete
3 Mon Sep 9 17:06:40 2024 superseded apptest-0.0.1 0.0.1 Upgrade complete
4 Mon Sep 9 17:13:27 2024 superseded apptest-0.0.1 0.0.1 Upgrade complete
5 Mon Sep 9 17:17:04 2024 superseded apptest-0.0.1 0.0.1 Upgrade complete
@joejulian had the concern if the user could accidentally install an application with the same name into the namespace. That concern has not materialized, the old client shows the ergular error message that comes up in these cases, good:
helm install apptest -n apptest apptest -f my-values2.yaml
Error: INSTALLATION FAILED: cannot re-use a name that is still in use
de247c7 to
e09ffaa
Compare
Signed-off-by: Ralf Van Dorsselaer <[email protected]>
… from existing secret Signed-off-by: Ralf Van Dorsselaer <[email protected]>
Signed-off-by: shipengqi <[email protected]>
Signed-off-by: shipengqi <[email protected]>
Signed-off-by: shipengqi <[email protected]>
Signed-off-by: shipengqi <[email protected]>
Signed-off-by: shipengqi <[email protected]>
Signed-off-by: shipengqi <[email protected]>
Signed-off-by: shipengqi <[email protected]>
Signed-off-by: Ralf Van Dorsselaer <[email protected]>
Signed-off-by: Vincent <[email protected]>
Signed-off-by: Vincent <[email protected]>
|
Whats does pushing to main mean ? Seems like this is the last stretch.. |
|
This pull request has been marked as stale because it has been open for 90 days with no activity. This pull request will be automatically closed in 30 days if no further activity occurs. |
|
Very unfortunate that this has stalled. Is there any other plan (except the postgres backend) to have a split across multiple secrets to overcome the size limits of etcd? - I myself try to keep charts atomic so they will never exceed this threshold, but I know a lot of cases, where customers put their whole stack into a single chart and then run into this limitation over time, as they are not aware of it. |
Indeed it is. We failed to get traction on this. IMO the main blocker was that we did not find a good enough answer for the backward compatibility questions raised by the maintainers for older Helm versions that would not support a Helm release definition across multiple K8s Secrets. Without code changes to older versions, such releases would either not be shown or commands would not work against them. The implementation in the PR handles conversion to and from transparently but yes, older releases cannot handle the new format and while not failing, the fact that they produce unexpected behaviour is not nice and seemed unacceptable even if new functionality for splitting would be included in a major release (where you're allowed to break things). There is a 2nd PR that I know of that handles this #11791, which is also "stale" but not yet closed. Reading through the maintainer meeting notes https://docs.google.com/document/d/1d-6xJEx0C78csIYSPKJzRPeWaHG_8W1Hjl72OJggwdc/edit?tab=t.0#heading=h.cafxi2yfgqg1 it looks to me that external to K8s storage is preferred which is IMO a dumb idea and no company that I know uses external storage driver for Helm. The last mention of multiple secrets for a Helm release is about a year ago now. |
|
Thank you so much for providing some background information, really appreciate it 👍 |
|
Hi @ralfv, see my post from Sep/30 (last year...) on the compatibility - we actually found and validated an approach for sufficient backwards compatibility via the introduction of a new secret-type that I reviewed with @joejulian back then. We added those changes on top of your initial PR but the PR would nevertheless not proceed, and we never received further feedback. |
…naged Helm applies the CRDs in gateway-helm's crds/ directory once, on install, and never upgrades them, so every Envoy Gateway upgrade that changes a CRD needs a manual kubectl apply first. The gateway-crds-helm chart cannot close that gap: it keeps the CRDs in templates/ and Helm stores a chart's templates in the release record, which exceeds the 1 MiB Secret limit (envoyproxy#6105). Splitting the record across Secrets (helm/helm#12277) was closed unmerged. The crds subchart can now render the CRDs it already carries as templates of the release: crds.envoyGateway.managed for the Envoy Gateway CRDs and crds.gatewayAPI.managed for the Gateway API CRDs (experimental channel). The templates read the files from crds/ through .Files, so nothing is duplicated and the default (install once from crds/) is unchanged. Because the templates live in a subchart, only the rendered manifest counts toward the release record: 30 KiB today, 513 KiB with the Envoy Gateway CRDs managed, 779 KiB with both, against the 1 MiB limit. Managed CRDs carry helm.sh/resource-policy: keep unless crds.keep is false; a template fails the render instead of shipping a CRD without the annotation when a document has no single top-level metadata.annotations key to add it to. The Gateway API bundle's license header is dropped from the render so it does not become a comment-only document. Helm still applies the crds/ directory on install, so a release with managed CRDs is installed with --take-ownership to adopt CRDs that are already in the cluster, or with --skip-crds when every CRD set is managed or installed separately; an existing release switches with helm upgrade --take-ownership. Without either, Helm fails with its ownership error. Verified on kind with Helm 3.21: the default install is unchanged, the conflict without a flag, adoption with --take-ownership on install and on upgrade, a changed CRD file updating the live CRD on helm upgrade, keep across helm uninstall, a fresh --skip-crds install, and deletion with crds.keep=false. Related to envoyproxy#4001 and envoyproxy#6105. Signed-off-by: Leontii Istomin <[email protected]>
…naged Helm applies the CRDs in gateway-helm's crds/ directory once, on install, and never upgrades them, so every Envoy Gateway upgrade that changes a CRD needs a manual kubectl apply first. The gateway-crds-helm chart cannot close that gap: it keeps the CRDs in templates/ and Helm stores a chart's templates in the release record, which exceeds the 1 MiB Secret limit (envoyproxy#6105). Splitting the record across Secrets (helm/helm#12277) was closed unmerged. The crds subchart can now render the CRDs it already carries as templates of the release: crds.envoyGateway.managed for the Envoy Gateway CRDs and crds.gatewayAPI.managed for the Gateway API CRDs (experimental channel). The templates read the files from crds/ through .Files, so nothing is duplicated and the default (install once from crds/) is unchanged. Because the templates live in a subchart, only the rendered manifest counts toward the release record: 30 KiB today, 513 KiB with the Envoy Gateway CRDs managed, 779 KiB with both, against the 1 MiB limit. Managed CRDs carry helm.sh/resource-policy: keep unless crds.keep is false; a template fails the render instead of shipping a CRD without the annotation when a document has no single top-level metadata.annotations key to add it to. The Gateway API bundle's license header is dropped from the render so it does not become a comment-only document. Helm still applies the crds/ directory on install, so a release with managed CRDs is installed with --take-ownership to adopt CRDs that are already in the cluster, or with --skip-crds when every CRD set is managed or installed separately; an existing release switches with helm upgrade --take-ownership. Without either, Helm fails with its ownership error. Verified on kind with Helm 3.21: the default install is unchanged, the conflict without a flag, adoption with --take-ownership on install and on upgrade, a changed CRD file updating the live CRD on helm upgrade, keep across helm uninstall, a fresh --skip-crds install, and deletion with crds.keep=false. Related to envoyproxy#4001 and envoyproxy#6105. Signed-off-by: Leontii Istomin <[email protected]>
…naged Helm applies the CRDs in gateway-helm's crds/ directory once, on install, and never upgrades them, so every Envoy Gateway upgrade that changes a CRD needs a manual kubectl apply first. The gateway-crds-helm chart cannot close that gap: it keeps the CRDs in templates/ and Helm stores a chart's templates in the release record, which exceeds the 1 MiB Secret limit (envoyproxy#6105). Splitting the record across Secrets (helm/helm#12277) was closed unmerged. The crds subchart can now render the CRDs it already carries as templates of the release: crds.envoyGateway.managed for the Envoy Gateway CRDs and crds.gatewayAPI.managed for the Gateway API CRDs (experimental channel). The templates read the files from crds/ through .Files, so nothing is duplicated and the default (install once from crds/) is unchanged. Because the templates live in a subchart, only the rendered manifest counts toward the release record: 30 KiB today, 513 KiB with the Envoy Gateway CRDs managed, 779 KiB with both, against the 1 MiB limit. Managed CRDs carry helm.sh/resource-policy: keep unless crds.keep is false; a template fails the render instead of shipping a CRD without the annotation when a document has no single top-level metadata.annotations key to add it to. The Gateway API bundle's license header is dropped from the render so it does not become a comment-only document. Helm still applies the crds/ directory on install, so a release with managed CRDs is installed with --take-ownership to adopt CRDs that are already in the cluster, or with --skip-crds when every CRD set is managed or installed separately; an existing release switches with helm upgrade --take-ownership. Without either, Helm fails with its ownership error. Verified on kind with Helm 3.21: the default install is unchanged, the conflict without a flag, adoption with --take-ownership on install and on upgrade, a changed CRD file updating the live CRD on helm upgrade, keep across helm uninstall, a fresh --skip-crds install, and deletion with crds.keep=false. Related to envoyproxy#4001 and envoyproxy#6105. Signed-off-by: Leontii Istomin <[email protected]>
…naged Helm applies the CRDs in gateway-helm's crds/ directory once, on install, and never upgrades them, so every Envoy Gateway upgrade that changes a CRD needs a manual kubectl apply first. The gateway-crds-helm chart cannot close that gap: it keeps the CRDs in templates/ and Helm stores a chart's templates in the release record, which exceeds the 1 MiB Secret limit (envoyproxy#6105). Splitting the record across Secrets (helm/helm#12277) was closed unmerged. The crds subchart can now render the CRDs it already carries as templates of the release: crds.envoyGateway.managed for the Envoy Gateway CRDs and crds.gatewayAPI.managed for the Gateway API CRDs (experimental channel). The templates read the files from crds/ through .Files, so nothing is duplicated and the default (install once from crds/) is unchanged. Because the templates live in a subchart, only the rendered manifest counts toward the release record: 30 KiB today, 513 KiB with the Envoy Gateway CRDs managed, 779 KiB with both, against the 1 MiB limit. Managed CRDs carry helm.sh/resource-policy: keep unless crds.keep is false; a template fails the render instead of shipping a CRD without the annotation when a document has no single top-level metadata.annotations key to add it to. The Gateway API bundle's license header is dropped from the render so it does not become a comment-only document. Helm still applies the crds/ directory on install, so a release with managed CRDs is installed with --take-ownership to adopt CRDs that are already in the cluster, or with --skip-crds when every CRD set is managed or installed separately; an existing release switches with helm upgrade --take-ownership. Without either, Helm fails with its ownership error. Verified on kind with Helm 3.21: the default install is unchanged, the conflict without a flag, adoption with --take-ownership on install and on upgrade, a changed CRD file updating the live CRD on helm upgrade, keep across helm uninstall, a fresh --skip-crds install, and deletion with crds.keep=false. Related to envoyproxy#4001 and envoyproxy#6105. Signed-off-by: Leontii Istomin <[email protected]>
…naged Helm applies the CRDs in gateway-helm's crds/ directory once, on install, and never upgrades them, so every Envoy Gateway upgrade that changes a CRD needs a manual kubectl apply first. The gateway-crds-helm chart cannot close that gap: it keeps the CRDs in templates/ and Helm stores a chart's templates in the release record, which exceeds the 1 MiB Secret limit (envoyproxy#6105). Splitting the record across Secrets (helm/helm#12277) was closed unmerged. The crds subchart can now render the CRDs it already carries as templates of the release: crds.envoyGateway.managed for the Envoy Gateway CRDs and crds.gatewayAPI.managed for the Gateway API CRDs (experimental channel). The templates read the files from crds/ through .Files, so nothing is duplicated and the default (install once from crds/) is unchanged. Because the templates live in a subchart, only the rendered manifest counts toward the release record: 30 KiB today, 513 KiB with the Envoy Gateway CRDs managed, 779 KiB with both, against the 1 MiB limit. Managed CRDs carry helm.sh/resource-policy: keep unless crds.keep is false; a template fails the render instead of shipping a CRD without the annotation when a document has no single top-level metadata.annotations key to add it to. The Gateway API bundle's license header is dropped from the render so it does not become a comment-only document. Helm still applies the crds/ directory on install, so a release with managed CRDs is installed with --take-ownership to adopt CRDs that are already in the cluster, or with --skip-crds when every CRD set is managed or installed separately; an existing release switches with helm upgrade --take-ownership. Without either, Helm fails with its ownership error. Verified on kind with Helm 3.21: the default install is unchanged, the conflict without a flag, adoption with --take-ownership on install and on upgrade, a changed CRD file updating the live CRD on helm upgrade, keep across helm uninstall, a fresh --skip-crds install, and deletion with crds.keep=false. Related to envoyproxy#4001 and envoyproxy#6105. Signed-off-by: Leontii Istomin <[email protected]>
HIP PR helm/community#256
What this PR does / why we need it:
This is the implementation for HIP helm/community#256 "HIP Support Helm release data stored in multiple K8s Secrets".
(This is a continuation of inadvertently closed PR #11087)
It allows Helm releases to be stored in multiple K8s Secrets if the size is > (1024*1000) bytes. For more details see the HIP.
The storage driver is implemented as HELM_DRIVER=multisecret | multisecrets
If secrets are <1MB they are 100% BWC and can be processed by helm binaries that do not know of split Helm secrets.
By default, the multisecret driver splits into multiple K8s Secrets when the compressed Helm release data > 10241000 bytes. If a Helm upgrade for a release results in Helm release data < 10241000 bytes then the driver will create a single K8s Secret same as the standard secret Helm driver.
Testing:
To test with default split size of 1MB:
To test the splitting more easily for example to create K8s Secrets that contain Helm release data <= 1024 bytes:
Example, this will create 8 K8s Secrets for a single revision of a Helm release:
helm create test
helm install test ./test
Special notes for your reviewer:
If applicable:
Signed-off-by: Ralf Van Dorsselaer [email protected]