sigs.k8s.io/kubebuilder/v3@v3.14.0/pkg/plugins/golang/v3/plugin.go (about) 1 /* 2 Copyright 2020 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 //go:deprecated This package has been deprecated in favor of v4 18 package v3 19 20 import ( 21 "sigs.k8s.io/kubebuilder/v3/pkg/config" 22 cfgv3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3" 23 "sigs.k8s.io/kubebuilder/v3/pkg/plugin" 24 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang" 25 ) 26 27 const pluginName = "base." + golang.DefaultNameQualifier 28 29 var ( 30 pluginVersion = plugin.Version{Number: 3} 31 supportedProjectVersions = []config.Version{cfgv3.Version} 32 ) 33 34 var _ plugin.Full = Plugin{} 35 36 // Plugin implements the plugin.Full interface 37 type Plugin struct { 38 initSubcommand 39 createAPISubcommand 40 createWebhookSubcommand 41 editSubcommand 42 } 43 44 // Name returns the name of the plugin 45 func (Plugin) Name() string { return pluginName } 46 47 // Version returns the version of the plugin 48 func (Plugin) Version() plugin.Version { return pluginVersion } 49 50 // SupportedProjectVersions returns an array with all project versions supported by the plugin 51 func (Plugin) SupportedProjectVersions() []config.Version { return supportedProjectVersions } 52 53 // GetInitSubcommand will return the subcommand which is responsible for initializing and common scaffolding 54 func (p Plugin) GetInitSubcommand() plugin.InitSubcommand { return &p.initSubcommand } 55 56 // GetCreateAPISubcommand will return the subcommand which is responsible for scaffolding apis 57 func (p Plugin) GetCreateAPISubcommand() plugin.CreateAPISubcommand { return &p.createAPISubcommand } 58 59 // GetCreateWebhookSubcommand will return the subcommand which is responsible for scaffolding webhooks 60 func (p Plugin) GetCreateWebhookSubcommand() plugin.CreateWebhookSubcommand { 61 return &p.createWebhookSubcommand 62 } 63 64 // GetEditSubcommand will return the subcommand which is responsible for editing the scaffold of the project 65 func (p Plugin) GetEditSubcommand() plugin.EditSubcommand { return &p.editSubcommand } 66 67 func (p Plugin) DeprecationWarning() string { 68 return "This version is deprecated." + 69 "The `go/v3` cannot scaffold projects using kustomize versions v4x+" + 70 " and cannot fully support Kubernetes 1.25+." + 71 "It is recommended to upgrade your project to the latest versions available (go/v4)." + 72 "Please, check the migration guide to learn how to upgrade your project" 73 }