Skip to content

Commit

Permalink
Deprecate 'operator-sdk add crd' cmd
Browse files Browse the repository at this point in the history
Hide `add crd` command and add deprecation message.
  • Loading branch information
varshaprasad96 committed Jun 4, 2020
1 parent 4e3cc47 commit ec06d64
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
18 changes: 16 additions & 2 deletions cmd/operator-sdk/add/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ import (
"github.com/spf13/cobra"
)

const deprecationTemplate = "\033[1;36m%s\033[0m"

// newAddCRDCmd - add crd command
func newAddCRDCmd() *cobra.Command {
crdCmd := &cobra.Command{
Use: "crd",
Short: "Adds a Custom Resource Definition (CRD) and the Custom Resource (CR) files",
Hidden: true,
Use: "crd",
Short: "Adds a Custom Resource Definition (CRD) and the Custom Resource (CR) files",
Long: `The operator-sdk add crd command will create a Custom Resource Definition (CRD)` +
`and the Custom Resource (CR) files for the specified api-version and kind.
Expand Down Expand Up @@ -61,6 +64,17 @@ Generated CR filename: <project-name>/deploy/crds/<full group>_<version>_<kind>
}

func crdFunc(cmd *cobra.Command, args []string) error {
fmt.Printf(deprecationTemplate, `[Deprecation notice] The 'operator-sdk add crd' command is deprecated!
Use 'operaot-sdk add api' command to create a new API definition for a custom resource.
'add api' command will also generate or update CRDs for a particular GVK based on values
provided for '--kind' and '--api-version' flags specified in the command.
Refer 'https://sdk.operatorframework.io/docs/cli/operator-sdk_add_api/' for more details.
`)

projutil.MustInProjectRoot()

cfg := &input.Config{
Expand Down
4 changes: 1 addition & 3 deletions website/content/en/docs/cli/operator-sdk_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ Adds a controller or resource to the project

* [operator-sdk](../operator-sdk) - An SDK for building operators with ease
* [operator-sdk add api](../operator-sdk_add_api) - Adds a new api definition under pkg/apis
* [operator-sdk add controller](../operator-sdk_add_controller) - Adds a new controller pkg
* [operator-sdk add crd](../operator-sdk_add_crd) - Adds a Custom Resource Definition (CRD) and the Custom Resource (CR) files

* [operator-sdk add controller](../operator-sdk_add_controller) - Adds a new controller pkg
3 changes: 0 additions & 3 deletions website/content/en/docs/cli/operator-sdk_add_crd.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
---
title: "operator-sdk add crd"
---
## operator-sdk add crd

Adds a Custom Resource Definition (CRD) and the Custom Resource (CR) files
Expand Down

0 comments on commit ec06d64

Please sign in to comment.