Skip to content

Commit

Permalink
⚠️ officially deprecate go/v2 plugin
Browse files Browse the repository at this point in the history
Co-authored-by: Bryce Palmer <everettraven@gmail.com>
  • Loading branch information
Camila Macedo and everettraven committed Jun 21, 2022
1 parent 8b0f136 commit e83c9d7
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
- [Extending the CLI](./plugins/extending-cli.md)
- [Creating your own plugins](./plugins/creating-plugins.md)
- [Available Plugins](./plugins/available-plugins.md)
- [go/v2 plugin (Deprecated)](./plugins/go-v2-plugin.md)
- [go/v3 plugin](./plugins/go-v3-plugin.md)
- [go/v2 plugin](./plugins/go-v2-plugin.md)
- [Declarative V1](./plugins/declarative-v1.md)
- [Kustomize V1](./plugins/kustomize-v1.md)
- [Plugins Versioning](./plugins/plugins-versioning.md)
Expand Down
6 changes: 3 additions & 3 deletions docs/book/src/plugins/available-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This section describes the plugins supported and shipped in with the Kubebuilder

| Plugin | Key | Description |
|---|---|---|
| [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. |
| [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`. |
| [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`. |
| [go.kubebuilder.io/v3 - (Default scaffold with Kubebuilder init)](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. |
| [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. |
| [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`). |
| [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. |
| [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. |
| `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`) |

<aside class="note">
Expand Down
27 changes: 23 additions & 4 deletions docs/book/src/plugins/go-v2-plugin.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
# go/v2 (go.kubebuilder.io/v2)
# [Deprecated] go/v2 (go.kubebuilder.io/v2 - "Kubebuilder 2.x" layout)

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.
<aside class="note warning">
<h1>Deprecated</h1>

The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.
The `go/v2` plugin scaffolds with the `v1beta1` API version which was deprecated in Kubernetes `1.16` and removed in `1.22`.
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)

Since `28 Apr 2021`, the default layout produced by Kubebuilder changed and is done via the `go/v3`.
We encourage you migrate your project to the latest version if your project was built with a Kubebuilder
versions < `3.0.0`.

<node>
The recommended way to migrate a `v2` project is to create a new `v3` project and copy over the API
and the reconciliation code. The conversion will end up with a project that looks like a native `v3` project.
For further information check the [Migration guide](./../migration/manually_migration_guide_v2_v3.md)

</aside>

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.

<aside class="note">

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.

</node>
</aside>

## When should I use this plugin ?

Expand Down
1 change: 1 addition & 0 deletions pkg/config/v2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/config/v2/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/golang/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/golang/v2/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/golang/v2/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
10 changes: 10 additions & 0 deletions pkg/plugins/golang/v2/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down Expand Up @@ -63,3 +64,12 @@ func (p Plugin) GetCreateWebhookSubcommand() plugin.CreateWebhookSubcommand {

// GetEditSubcommand will return the subcommand which is responsible for editing the scaffold of the project
func (p Plugin) GetEditSubcommand() plugin.EditSubcommand { return &p.editSubcommand }

func (p Plugin) DeprecationWarning() string {
return "This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`." +
"The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version." +
"Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and are" +
"removed as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects that" +
"work on Kubernetes versions >= 1.22, it is recommended to upgrade your project " +
"to the latest versions available."
}
1 change: 1 addition & 0 deletions pkg/plugins/golang/v2/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
1 change: 1 addition & 0 deletions test/e2e/v2/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
1 change: 1 addition & 0 deletions test/e2e/v2/plugin_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:deprecated This package has been deprecated
package v2

import (
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/v3/plugin_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ var _ = Describe("kubebuilder", func() {
kbc.Destroy()
})

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

0 comments on commit e83c9d7

Please sign in to comment.