Fix #463: Ensure Helm action timeout and context timeout properly propagate from config - #1846
Open
dennismdejong wants to merge 1 commit into
Open
Fix #463: Ensure Helm action timeout and context timeout properly propagate from config#1846dennismdejong wants to merge 1 commit into
dennismdejong wants to merge 1 commit into
Conversation
…perly propagate from config - Extend context timeout with max(timeout_attr, timeouts_block) in Create/Update/Delete so the context doesn't cancel before the Helm SDK's internal timeout expires. - Set Install/Upgrade/Uninstall action.Timeout from the effective context timeout. - Use Install/Upgrade RunWithContext to propagate the provider context (with its deadline) to the Helm SDK, ensuring the timeouts block is honored. - Set a 300s default timeout on the Kubernetes REST client config to prevent indefinite hangs when no context deadline is present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause
The
timeoutattribute onhelm_releasewas not reliably honored because:Context not propagated to Helm SDK: The provider creates a context with timeout (from
timeoutsblock) but never passes it to the Helm action.Install.Run(),Upgrade.Run(), andUninstall.Run()all usecontext.Background()internally, bypassing the providers deadline.Context timeout only from timeouts block: The context timeout was set exclusively from the Terraform
timeouts { create/update/delete }block, ignoring thetimeoutattribute. If a user set onlytimeout(not thetimeoutsblock), the context could expire before the Helm SDK finished.No default Kubernetes REST client timeout: The
rest.Config.Timeoutwas left at 0 (no timeout), meaning individual Kubernetes API requests could hang indefinitely.Changes
helm/resource_helm_release.go:max(timeout_attr, timeouts_block)in Create/Update/Delete so the context never cancels before the Helm SDK internal timeout.action.Timeout(Install/Upgrade/Uninstall) from the effective context timeout instead of the raw attribute.Install.RunWithContext()andUpgrade.RunWithContext()to propagate the provider context (with its deadline) to the Helm SDK.helm/kubeconfig.go:rest.ConfiginToRESTConfig()to prevent indefinite hangs on Kubernetes API requests when no context deadline is present.Testing
go build ./...passesgo test ./helm/...passes (all existing tests)