-
Notifications
You must be signed in to change notification settings - Fork 133
Fix Helm chart pre-mounted Terraform binary path mismatch #11880
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
Open
willdavsmith
wants to merge
7
commits into
radius-project:main
Choose a base branch
from
willdavsmith:terraform-path-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4085e40
Fix Helm chart pre-mounted Terraform binary path mismatch
willdavsmith 366e6bd
Address review feedback: hard-code global terraform path, add error h…
willdavsmith dcb64f5
Address review: enforce terraform.path=/terraform and add regression …
willdavsmith 1d19c5d
Address review: move helm-unittest 'template:' key onto each assert
willdavsmith 28d25ff
Address review: enforce terraform.path=/terraform unconditionally
willdavsmith 17a6da3
Pin pre-mounted Terraform version to match runtime fallback (1.14.9)
willdavsmith ced1204
Merge branch 'main' into terraform-path-fix
willdavsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| suite: test terraform init container path mismatch fix | ||
| templates: | ||
| - rp/deployment.yaml | ||
| - dynamic-rp/deployment.yaml | ||
|
willdavsmith marked this conversation as resolved.
|
||
| tests: | ||
| # Regression test for https://github.com/radius-project/radius/pull/11880 | ||
| # The pre-mounted Terraform binary path written by the init container MUST | ||
| # match the constants in pkg/recipes/terraform/install.go: | ||
| # defaultGlobalTerraformBinary = "/terraform/.terraform-global/terraform" | ||
| # defaultGlobalMarkerFile = "/terraform/.terraform-global/.terraform-ready" | ||
| # If these strings drift, ensureGlobalTerraformBinary falls through to | ||
| # downloadAndInstallTerraform and the init container's work is wasted. | ||
| - it: rp init container writes terraform binary to the global path expected by install.go | ||
| asserts: | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'GLOBAL_DIR="/terraform/\.terraform-global"' | ||
| template: rp/deployment.yaml | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'cp terraform "\$GLOBAL_DIR/terraform"' | ||
| template: rp/deployment.yaml | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'touch "\$GLOBAL_DIR/\.terraform-ready"' | ||
| template: rp/deployment.yaml | ||
|
|
||
| - it: dynamic-rp init container writes terraform binary to the global path expected by install.go | ||
| asserts: | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'GLOBAL_DIR="/terraform/\.terraform-global"' | ||
| template: dynamic-rp/deployment.yaml | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'cp terraform "\$GLOBAL_DIR/terraform"' | ||
| template: dynamic-rp/deployment.yaml | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'touch "\$GLOBAL_DIR/\.terraform-ready"' | ||
| template: dynamic-rp/deployment.yaml | ||
|
|
||
| - it: rp template fails when rp.terraform.path is overridden away from /terraform | ||
| set: | ||
| rp.terraform.path: "/other" | ||
| asserts: | ||
| - failedTemplate: | ||
| errorMessage: 'rp.terraform.path must be "/terraform" -- the runtime configmap (deploy/Chart/templates/rp/configmaps.yaml) and pkg/recipes/terraform/install.go both hard-code /terraform, so overriding the mount path produces an inconsistent deployment and silently breaks Terraform execution/caching.' | ||
| template: rp/deployment.yaml | ||
|
|
||
| - it: dynamic-rp template fails when dynamicrp.terraform.path is overridden away from /terraform | ||
| set: | ||
| dynamicrp.terraform.path: "/other" | ||
| asserts: | ||
| - failedTemplate: | ||
| errorMessage: 'dynamicrp.terraform.path must be "/terraform" -- the runtime configmap (deploy/Chart/templates/dynamic-rp/configmaps.yaml) and pkg/recipes/terraform/install.go both hard-code /terraform, so overriding the mount path produces an inconsistent deployment and silently breaks Terraform execution/caching.' | ||
| template: dynamic-rp/deployment.yaml | ||
|
|
||
| - it: rp template still fails when rp.terraform.path is overridden, even with terraform pre-download disabled | ||
| set: | ||
| global.terraform.enabled: false | ||
| rp.terraform.path: "/other" | ||
| asserts: | ||
| - failedTemplate: | ||
| errorMessage: 'rp.terraform.path must be "/terraform" -- the runtime configmap (deploy/Chart/templates/rp/configmaps.yaml) and pkg/recipes/terraform/install.go both hard-code /terraform, so overriding the mount path produces an inconsistent deployment and silently breaks Terraform execution/caching.' | ||
| template: rp/deployment.yaml | ||
|
|
||
| - it: dynamic-rp template still fails when dynamicrp.terraform.path is overridden, even with terraform pre-download disabled | ||
| set: | ||
| global.terraform.enabled: false | ||
| dynamicrp.terraform.path: "/other" | ||
| asserts: | ||
| - failedTemplate: | ||
| errorMessage: 'dynamicrp.terraform.path must be "/terraform" -- the runtime configmap (deploy/Chart/templates/dynamic-rp/configmaps.yaml) and pkg/recipes/terraform/install.go both hard-code /terraform, so overriding the mount path produces an inconsistent deployment and silently breaks Terraform execution/caching.' | ||
| template: dynamic-rp/deployment.yaml | ||
|
|
||
| # Regression test for the second half of #11880: after fixing the | ||
| # binary-path mismatch the runtime actually uses the pre-mounted | ||
| # binary, so its version MUST match terraformVersion in | ||
| # pkg/recipes/terraform/version.go (currently "1.14.9"). If these | ||
| # drift the runtime download fallback and the pre-mount install | ||
| # different versions, causing recipes to behave differently between | ||
| # cold and warm starts (see Test_TerraformRecipe_Context failure). | ||
| - it: rp init container pins terraform version to match pkg/recipes/terraform/version.go | ||
| asserts: | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'TERRAFORM_VERSION="1\.14\.9"' | ||
| template: rp/deployment.yaml | ||
|
|
||
| - it: dynamic-rp init container pins terraform version to match pkg/recipes/terraform/version.go | ||
| asserts: | ||
| - matchRegex: | ||
| path: spec.template.spec.initContainers[?(@.name=='terraform-init')].command[2] | ||
| pattern: 'TERRAFORM_VERSION="1\.14\.9"' | ||
| template: dynamic-rp/deployment.yaml | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.