Skip to content

Commit e67c488

Browse files
⚠️ officially deprecate go/v2 plugin (legacy layout Kubebuilder 2.x) (#2734)
* ⚠️ officially deprecate go/v2 plugin Co-authored-by: Bryce Palmer <[email protected]> * Update docs/book/src/plugins/available-plugins.md Co-authored-by: Bryce Palmer <[email protected]> Co-authored-by: Bryce Palmer <[email protected]>
1 parent 15c1bb3 commit e67c488

File tree

13 files changed

+47
-8
lines changed

13 files changed

+47
-8
lines changed

docs/book/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
- [Extending the CLI](./plugins/extending-cli.md)
110110
- [Creating your own plugins](./plugins/creating-plugins.md)
111111
- [Available Plugins](./plugins/available-plugins.md)
112+
- [go/v2 plugin (Deprecated)](./plugins/go-v2-plugin.md)
112113
- [go/v3 plugin](./plugins/go-v3-plugin.md)
113-
- [go/v2 plugin](./plugins/go-v2-plugin.md)
114114
- [Declarative V1](./plugins/declarative-v1.md)
115115
- [Kustomize V1](./plugins/kustomize-v1.md)
116116
- [Plugins Versioning](./plugins/plugins-versioning.md)

docs/book/src/plugins/available-plugins.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ This section describes the plugins supported and shipped in with the Kubebuilder
44

55
| Plugin | Key | Description |
66
|---|---|---|
7-
| [go.kubebuilder.io/v3](go-v3-plugin.md) | `go/v3` | Default scaffold to create the projects when none plugin(s) are informed. Responsible for scaffold the Golang project and its configurations. |
8-
| [go.kubebuilder.io/v2](go-v2-plugin.md) | `go/v2` | Golang plugin responsible for scaffold the legacy layout provided with Kubebuilder CLI >= `2.0.0` and < `3.0.0`. |
7+
| [go.kubebuilder.io/v2 - (Deprecated)](go-v2-plugin.md) | `go/v2` | Golang plugin responsible for scaffolding the legacy layout provided with Kubebuilder CLI >= `2.0.0` and < `3.0.0`. |
8+
| [go.kubebuilder.io/v3 - (Default scaffold with Kubebuilder init)](go-v3-plugin.md) | `go/v3` | Default scaffold used for creating a project when no plugin(s) are provided. Responsible for scaffolding Golang projects and its configurations. |
99
| [declarative.go.kubebuilder.io/v1](declarative-v1.md) | `declarative/v1` | Optional plugin used to scaffold APIs/controllers using the [kubebuilder-declarative-pattern][kubebuilder-declarative-pattern] project. |
1010
| [kustomize.common.kubebuilder.io/v1](kustomize-v1.md) | `kustomize/v1` | Responsible for scaffold all manifests to configure the projects with [kustomize(v3)][kustomize]. (create and update the the `config/` directory). This plugin is used in the composition to create the plugin (`go/v3`). |
11-
| [kustomize.common.kubebuilder.io/v1](kustomize-v2-alpha.md) | `kustomize/v2-alpha` | It has the same purpose of `kustomize/v1`. However, it works with [kustomize][kustomize] version `v4` and address the required changes for the future kustomize configurations. It will probably be used with the future `go/v4-alpha` plugin. |
11+
| [kustomize.common.kubebuilder.io/v2-alpha](kustomize-v2-alpha.md) | `kustomize/v2-alpha` | It has the same purpose of `kustomize/v1`. However, it works with [kustomize][kustomize] version `v4` and addresses the required changes for future kustomize configurations. It will probably be used with the future `go/v4-alpha` plugin. |
1212
| `base.go.kubebuilder.io/v3` | `base/v3` | Responsible for scaffold all files which specific requires Golang. This plugin is used in the composition to create the plugin (`go/v3`) |
1313

1414
<aside class="note">

docs/book/src/plugins/go-v2-plugin.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
1-
# go/v2 (go.kubebuilder.io/v2)
1+
# [Deprecated] go/v2 (go.kubebuilder.io/v2 - "Kubebuilder 2.x" layout)
22

3-
The `go/v2` plugin has the purpose to scaffold Golang projects to help users to build projects with [controllers][controller-runtime] and keep the backwards compatibility with the default scaffold made using Kubebuilder CLI `2.x.z` releases.
3+
<aside class="note warning">
4+
<h1>Deprecated</h1>
5+
6+
The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.
7+
The `go/v2` plugin scaffolds with the `v1beta1` API version which was deprecated in Kubernetes `1.16` and removed in `1.22`.
8+
This plugin was kept to ensure backwards compatibility with projects that were scaffolded with the old `"Kubebuilder 2.x"` layout and does not work with the new plugin ecosystem that was introduced with Kubebuilder `3.0.0` [More info](plugins.md)
9+
10+
Since `28 Apr 2021`, the default layout produced by Kubebuilder changed and is done via the `go/v3`.
11+
We encourage you migrate your project to the latest version if your project was built with a Kubebuilder
12+
versions < `3.0.0`.
413

5-
<node>
14+
The recommended way to migrate a `v2` project is to create a new `v3` project and copy over the API
15+
and the reconciliation code. The conversion will end up with a project that looks like a native `v3` project.
16+
For further information check the [Migration guide](./../migration/manually_migration_guide_v2_v3.md)
17+
18+
</aside>
19+
20+
The `go/v2` plugin has the purpose to scaffold Golang projects to help users
21+
to build projects with [controllers][controller-runtime] and keep the backwards compatibility
22+
with the default scaffold made using Kubebuilder CLI `2.x.z` releases.
23+
24+
<aside class="note">
625

726
You can check samples using this plugin by looking at the `project-v2-<options>` directories under the [testdata][testdata] projects on the root directory of the Kubebuilder project.
827

9-
</node>
28+
</aside>
1029

1130
## When should I use this plugin ?
1231

pkg/config/v2/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

pkg/config/v2/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

pkg/plugins/golang/v2/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

pkg/plugins/golang/v2/edit.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

pkg/plugins/golang/v2/init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

pkg/plugins/golang/v2/plugin.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (
@@ -63,3 +64,12 @@ func (p Plugin) GetCreateWebhookSubcommand() plugin.CreateWebhookSubcommand {
6364

6465
// GetEditSubcommand will return the subcommand which is responsible for editing the scaffold of the project
6566
func (p Plugin) GetEditSubcommand() plugin.EditSubcommand { return &p.editSubcommand }
67+
68+
func (p Plugin) DeprecationWarning() string {
69+
return "This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`." +
70+
"The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version." +
71+
"Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and are" +
72+
"removed as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects that" +
73+
"work on Kubernetes versions >= 1.22, it is recommended to upgrade your project " +
74+
"to the latest versions available."
75+
}

pkg/plugins/golang/v2/webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

test/e2e/v2/e2e_suite_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

test/e2e/v2/plugin_cluster_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//go:deprecated This package has been deprecated
1718
package v2
1819

1920
import (

test/e2e/v3/plugin_cluster_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ var _ = Describe("kubebuilder", func() {
7777
kbc.Destroy()
7878
})
7979

80+
//TODO: remove me when the plugin go/v2 be removed
81+
//go:deprecated this plugin is deprecated
8082
Context("plugin go.kubebuilder.io/v2", func() {
8183
// Use cert-manager with v1beta2 CRs.
8284
BeforeEach(func() {

0 commit comments

Comments
 (0)