Skip to content

Commit

Permalink
Deprecate v1 projects
Browse files Browse the repository at this point in the history
  • Loading branch information
hypnoglow committed Nov 7, 2019
1 parent 5cfe667 commit 9ceebf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/init_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ func (o *projectOptions) initializeProject() {
log.Fatal(err)
}

if o.project.Version == project.Version1 {
printV1DeprecationWarning()
}

if err := o.scaffolder.Scaffold(); err != nil {
log.Fatalf("error scaffolding project: %v", err)
}
Expand Down
13 changes: 12 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ import (

"sigs.k8s.io/kubebuilder/cmd/version"
"sigs.k8s.io/kubebuilder/pkg/scaffold"
"sigs.k8s.io/kubebuilder/pkg/scaffold/project"
)

const (
NoticeColor = "\033[1;36m%s\033[0m"
)

// module and goMod arg just enough of the output of `go mod edit -json` for our purposes
Expand Down Expand Up @@ -112,7 +117,9 @@ func main() {
)

foundProject, version := getProjectVersion()
if foundProject && version == "1" {
if foundProject && version == project.Version1 {
printV1DeprecationWarning()

rootCmd.AddCommand(
newAlphaCommand(),
newVendorUpdateCmd(),
Expand Down Expand Up @@ -188,3 +195,7 @@ func getProjectVersion() (bool, string) {
}
return true, projectInfo.Version
}

func printV1DeprecationWarning() {
fmt.Printf(NoticeColor, "[Deprecation Notice] The v1 projects are deprecated and will not be supported beyond Feb 1, 2020.\nSee how to upgrade your project to v2: https://book.kubebuilder.io/migration/guide.html\n")
}

0 comments on commit 9ceebf0

Please sign in to comment.