Skip to content

Commit bc24ab9

Browse files
committed
fix: correct stale "v1" package name in types.NewPackage calls and clarify upgrade guide
Signed-off-by: JP Schoombee <jpschoombee@gmail.com>
1 parent 8145003 commit bc24ab9

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

docs/upjet-v2-upgrade.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ github.com/crossplane/upjet/ => github.com/crossplane/upjet/v2/
135135
>
136136
> 1. In `go.mod` bump `github.com/crossplane/crossplane-runtime/v2` to
137137
> `v2.3.x` and add a direct require on
138-
> `github.com/crossplane/crossplane/apis/v2 v2.3.x`. Run `go mod tidy`.
138+
> `github.com/crossplane/crossplane/apis/v2 v2.3.x`. Run `go mod tidy`
139+
> and confirm it succeeds before proceeding — the build will not compile
140+
> without the new direct dependency in place.
139141
> 2. Run `make generate`. Upjet's code generator emits the new package
140142
> path and type names automatically for all your generated `zz_*.go`
141-
> files. Any hand-written code that imports `crossplane-runtime/v2/apis/common/{v1,v2}`
142-
> needs its import path updated to the consolidated package.
143+
> files. Any hand-written code that imports
144+
> `crossplane-runtime/v2/apis/common/{v1,v2}` needs its import path
145+
> updated to the consolidated package.
143146
>
144147
> If you have generated `zz_*.go` files committed and you're not ready to
145148
> regenerate yet, you can also bulk-rewrite the import paths and the two
@@ -180,6 +183,11 @@ type ProviderConfig struct {
180183

181184
### `apis` directory
182185

186+
> **Note:** The import paths in the examples below are for the base
187+
> Upjet v1 → v2 migration (crossplane-runtime v1 module). If you are
188+
> already on Upjet v2 and only bumping to crossplane-runtime v2.3.x, see
189+
> the callout above instead.
190+
183191
- In `apis/namespaced/v1beta1/types.go`, make sure that `ProviderConfigUsage` type inlines `xpv2.TypedProviderConfigUsage`
184192

185193
```diff

pkg/types/reference.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,43 +31,43 @@ const (
3131
// Types to use from by reference generator.
3232
var (
3333
typeReferenceField types.Type = types.NewNamed(
34-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "Reference", nil),
34+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "Reference", nil),
3535
types.NewStruct(nil, nil),
3636
nil,
3737
)
3838
typeSelectorField types.Type = types.NewNamed(
39-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "Selector", nil),
39+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "Selector", nil),
4040
types.NewStruct(nil, nil),
4141
nil,
4242
)
4343
typeSecretKeySelector types.Type = types.NewNamed(
44-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "SecretKeySelector", nil),
44+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "SecretKeySelector", nil),
4545
types.NewStruct(nil, nil),
4646
nil,
4747
)
4848
typeSecretReference types.Type = types.NewNamed(
49-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "SecretReference", nil),
49+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "SecretReference", nil),
5050
types.NewStruct(nil, nil),
5151
nil,
5252
)
5353
typeLocalSecretReference types.Type = types.NewNamed(
54-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "LocalSecretReference", nil),
54+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "LocalSecretReference", nil),
5555
types.NewStruct(nil, nil),
5656
nil,
5757
)
5858
typeLocalSecretKeySelector types.Type = types.NewNamed(
59-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "LocalSecretKeySelector", nil),
59+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "LocalSecretKeySelector", nil),
6060
types.NewStruct(nil, nil),
6161
nil,
6262
)
6363
typeNamespacedReferenceField types.Type = types.NewNamed(
64-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "NamespacedReference", nil),
64+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "NamespacedReference", nil),
6565
types.NewStruct(nil, nil),
6666
nil,
6767
)
6868

6969
typeNamespacedSelectorField types.Type = types.NewNamed(
70-
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v1"), "NamespacedSelector", nil),
70+
types.NewTypeName(token.NoPos, types.NewPackage(PackagePathXPCommonAPIs, "v2"), "NamespacedSelector", nil),
7171
types.NewStruct(nil, nil),
7272
nil,
7373
)

0 commit comments

Comments
 (0)