diff --git a/docs/book/src/plugins/go-v2-plugin.md b/docs/book/src/plugins/go-v2-plugin.md
index 152f1e237d9..9854c44f116 100644
--- a/docs/book/src/plugins/go-v2-plugin.md
+++ b/docs/book/src/plugins/go-v2-plugin.md
@@ -1,12 +1,32 @@
-# go/v2 (go.kubebuilder.io/v2)
+# 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.
+
+
+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.
+
+
## When should I use this plugin ?
diff --git a/pkg/config/v2/config.go b/pkg/config/v2/config.go
index 709105ab956..f00e5fa643d 100644
--- a/pkg/config/v2/config.go
+++ b/pkg/config/v2/config.go
@@ -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 (
diff --git a/pkg/config/v2/config_test.go b/pkg/config/v2/config_test.go
index e610da95820..9d36e042f88 100644
--- a/pkg/config/v2/config_test.go
+++ b/pkg/config/v2/config_test.go
@@ -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 (
diff --git a/pkg/plugins/golang/v2/api.go b/pkg/plugins/golang/v2/api.go
index 35676e788e6..88ccd3d188b 100644
--- a/pkg/plugins/golang/v2/api.go
+++ b/pkg/plugins/golang/v2/api.go
@@ -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 (
diff --git a/pkg/plugins/golang/v2/edit.go b/pkg/plugins/golang/v2/edit.go
index bdab9054400..d8e04f39443 100644
--- a/pkg/plugins/golang/v2/edit.go
+++ b/pkg/plugins/golang/v2/edit.go
@@ -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 (
diff --git a/pkg/plugins/golang/v2/init.go b/pkg/plugins/golang/v2/init.go
index 7b85d023c5a..bafe378c359 100644
--- a/pkg/plugins/golang/v2/init.go
+++ b/pkg/plugins/golang/v2/init.go
@@ -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 (
diff --git a/pkg/plugins/golang/v2/plugin.go b/pkg/plugins/golang/v2/plugin.go
index fd1d7779416..c4edaf82e1e 100644
--- a/pkg/plugins/golang/v2/plugin.go
+++ b/pkg/plugins/golang/v2/plugin.go
@@ -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 (
@@ -63,3 +64,11 @@ 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 solutions which uses CRD and/or Webhooks with the v1 version." +
+ "Be aware that v1beta1 API for CRDs and Webhooks were deprecated on Kubernetes 1.16 and are" +
+ "no longer offered since its 1.22 release. Therefore, it is recommended upgrade your project " +
+ "to the latest versions."
+}
diff --git a/pkg/plugins/golang/v2/webhook.go b/pkg/plugins/golang/v2/webhook.go
index d142298850b..02a7ae91eab 100644
--- a/pkg/plugins/golang/v2/webhook.go
+++ b/pkg/plugins/golang/v2/webhook.go
@@ -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 (
diff --git a/test/e2e/v2/e2e_suite_test.go b/test/e2e/v2/e2e_suite_test.go
index fbddd1cb86f..85dfdad1c71 100644
--- a/test/e2e/v2/e2e_suite_test.go
+++ b/test/e2e/v2/e2e_suite_test.go
@@ -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 (
diff --git a/test/e2e/v2/plugin_cluster_test.go b/test/e2e/v2/plugin_cluster_test.go
index 5fd38e871cd..4e6648c2f5f 100644
--- a/test/e2e/v2/plugin_cluster_test.go
+++ b/test/e2e/v2/plugin_cluster_test.go
@@ -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 (
diff --git a/test/e2e/v3/plugin_cluster_test.go b/test/e2e/v3/plugin_cluster_test.go
index 9a1ac102f48..8680e55c5c0 100644
--- a/test/e2e/v3/plugin_cluster_test.go
+++ b/test/e2e/v3/plugin_cluster_test.go
@@ -68,6 +68,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() {