Skip to content

Commit 50b2d41

Browse files
committed
chore: trim prose
1 parent 0e62b87 commit 50b2d41

1 file changed

Lines changed: 23 additions & 49 deletions

File tree

docs/v2-import-map.md

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Status: FROZEN for import paths. The one open decision (renames) is resolved: the three hyphenated packages are renamed to idiomatic Go names at the `/v2` boundary.
44

5-
A rewrite of import paths alone is not sufficient to migrate. Some symbols also moved between modules during the v2 beta, after this map was frozen. Those are listed under [Symbols relocated during the v2 beta](#symbols-relocated-during-the-v2-beta), and they are compile errors, not silent changes.
5+
Rewriting import paths is not sufficient on its own: some symbols also moved between modules during the beta. See [Symbols relocated during the v2 beta](#symbols-relocated-during-the-v2-beta).
66

77
Built from the actual v1 layout at tag `v1.0.1-test` (27 `modules/` packages, 2 `cmd/` binaries, 1 `internal/lib` tree).
88

@@ -70,12 +70,9 @@ So e.g. `modules/logger/parser` -> `modules/core/v2/logger/parser`, `modules/aws
7070

7171
## Symbols relocated during the v2 beta
7272

73-
The import-path rewrite above is mechanical. These moves are not: the function keeps its name, arguments, return type
74-
and on-disk filename, but it now lives in the module that owns the type it operates on. This was done so that
75-
`teststructure` no longer requires `aws`, `k8s`, `packer` and `ssh` (#1877). Importing it for `RunTestStage` used to
76-
pull in the AWS SDK and client-go.
77-
78-
Each is a compile error after the path rewrite, so `go build ./...` finds every call site.
73+
These functions moved to the module that owns the type they operate on, so that `teststructure` no longer requires
74+
`aws`, `k8s`, `packer` and `ssh` (#1877). Name, arguments, return type and on-disk filename are unchanged. Each is a
75+
compile error, so `go build ./...` finds every call site.
7976

8077
| v2.0.0-beta.1 | v2.0.0-beta.2 onwards |
8178
|---|---|
@@ -88,58 +85,35 @@ Each is a compile error after the path rewrite, so `go build ./...` finds every
8885
| `teststructure.SaveSSHKeyPair` | `ssh.SaveSSHKeyPair` |
8986
| `teststructure.LoadSSHKeyPair` | `ssh.LoadSSHKeyPair` |
9087

91-
Everything else in `teststructure` stayed: `RunTestStage`, `CopyTerraformFolderToTemp`, all the Terraform helpers
92-
(`SaveTerraformOptions`, `LoadTerraformOptions`), `SaveString`/`LoadString`, `SaveInt`/`LoadInt`,
93-
`SaveArtifactID`/`LoadArtifactID`, and the generic `SaveTestData`/`LoadTestData`. Measured across Gruntwork's own
94-
repositories, the moved functions are about 6% of all `teststructure` call sites, and every affected file was already
95-
being edited for the import-path rewrite.
96-
97-
The generic primitives now live in `modules/core/v2/teststate` and are re-exported from `teststructure`, so calls to
98-
`SaveTestData` and friends are unaffected.
99-
100-
### Migrating
101-
102-
In the files the import rewrite already touches, swap the qualifier:
103-
104-
```
105-
teststructure.SaveEc2KeyPair( -> aws.SaveEc2KeyPair(
106-
teststructure.LoadEc2KeyPair( -> aws.LoadEc2KeyPair(
107-
teststructure.SaveKubectlOptions( -> k8s.SaveKubectlOptions(
108-
teststructure.LoadKubectlOptions( -> k8s.LoadKubectlOptions(
109-
teststructure.SavePackerOptions( -> packer.SavePackerOptions(
110-
teststructure.LoadPackerOptions( -> packer.LoadPackerOptions(
111-
teststructure.SaveSSHKeyPair( -> ssh.SaveSSHKeyPair(
112-
teststructure.LoadSSHKeyPair( -> ssh.LoadSSHKeyPair(
113-
```
88+
Nothing else moved. `RunTestStage`, `CopyTerraformFolderToTemp`, the Terraform helpers, `SaveString`/`LoadString`,
89+
`SaveInt`/`LoadInt`, `SaveArtifactID`/`LoadArtifactID` and the generic `SaveTestData`/`LoadTestData` all stay in
90+
`teststructure`. The generic primitives now live in `modules/core/v2/teststate` and are re-exported, so those calls
91+
are unaffected.
11492

115-
Two cautions before running a blind find and replace:
93+
Migration is a qualifier swap, with two cautions:
11694

117-
- The target module is usually already imported by the same file, since the value being saved came from it. Where it
118-
is not, add the import.
119-
- A file that imports both the AWS SDK and Terratest's `aws` module may have bound the plain `aws` identifier to the
120-
SDK and aliased Terratest's. Use that file's own alias rather than `aws.`.
95+
- The target module is usually already imported, since the value came from it. Where it is not, add the import.
96+
- A file importing both the AWS SDK and Terratest's `aws` may bind plain `aws` to the SDK and alias Terratest's. Use
97+
that file's alias.
12198

12299
## Behaviour changes during the v2 beta
123100

124101
No signature changed, but two behaviours did.
125102

126-
**Node address resolution now prefers `ExternalIP`** (#1878). `k8s.FindNodeHostnameContextE` and everything built on
127-
it, including `GetServiceEndpoint` for a NodePort service, now return the `ExternalIP` recorded on the Node object
128-
when one is present, falling back to the internal hostname as before when it is not. On EKS this is the instance's
129-
public IP, so the common case no longer needs an EC2 API call or the `ec2:DescribeInstances` permission. Clusters on
130-
any provider that advertise an `ExternalIP` will now resolve to it rather than to the internal hostname, which is
131-
what the documented contract has always described.
103+
**Node addresses prefer `ExternalIP`** (#1878). `k8s.FindNodeHostnameContextE`, and `GetServiceEndpoint` for a
104+
NodePort service, now return the `ExternalIP` on the Node object when present, falling back to the internal hostname
105+
as before. On EKS that is the instance's public IP, so the common case needs no EC2 call and no
106+
`ec2:DescribeInstances` permission. Clusters that advertise an `ExternalIP` now resolve to it rather than the
107+
internal hostname.
132108

133-
`FindNodeHostnameContext` and `FindNodeHostnameContextE` keep their original signatures. A new
134-
`FindNodeHostnameWithOptionsContext[E]` pair takes `*KubectlOptions` and consults `KubectlOptions.NodePublicIPLookup`,
135-
an escape hatch for clusters that do not advertise an `ExternalIP`. Wire it up with
109+
`FindNodeHostnameContext[E]` keep their original signatures. A new `FindNodeHostnameWithOptionsContext[E]` pair takes
110+
`*KubectlOptions` and consults `NodePublicIPLookup`, for clusters that do not advertise an `ExternalIP`:
136111
`options.NodePublicIPLookup = aws.GetPublicIpsOfEc2InstancesContextE`.
137112

138-
**`KubectlOptions` carrying a `RestConfig` no longer serializes** (#1879). A `rest.Config` cannot be rebuilt from
139-
JSON, so `MarshalJSON` returns `k8s.ErrRestConfigNotSerializable` rather than dropping it and leaving reloaded
140-
options with no cluster identity. Previously this failed too, with an opaque `json: unsupported type:
141-
transport.WrapperFunc`. For staged tests, build options with `NewKubectlOptions` (kubeconfig path and context name)
142-
or `NewKubectlOptionsWithInClusterAuth`; both round trip intact.
113+
**`KubectlOptions` carrying a `RestConfig` no longer serializes** (#1879). `MarshalJSON` returns
114+
`k8s.ErrRestConfigNotSerializable` rather than dropping the config and leaving reloaded options with no cluster
115+
identity. This failed before too, with an opaque `json: unsupported type: transport.WrapperFunc`. For staged tests
116+
use `NewKubectlOptions` or `NewKubectlOptionsWithInClusterAuth`; both round trip intact.
143117

144118
## Accounting
145119

0 commit comments

Comments
 (0)