Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kb create api --force option doesn't work #1845

Closed
prafull01 opened this issue Nov 18, 2020 · 1 comment · Fixed by #1847
Closed

kb create api --force option doesn't work #1845

prafull01 opened this issue Nov 18, 2020 · 1 comment · Fixed by #1847
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@prafull01
Copy link
Contributor

Tried to recreate an api with --force option and the command throw the error

I expected it to pass as the --force option to overwrite the existing API

../bin/kubebuilder create api --group ship --version v1beta1 --kind Frigate
Create Resource [y/n]
y
Create Controller [y/n]
y
Writing scaffold for you to edit...
api/v1beta1/frigate_types.go
controllers/frigate_controller.go
Running make:
$ make
/home/prafull/go/src/github.com/prafull01/kubebuilder/proj/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
go build -o bin/manager main.go

../bin/kubebuilder create api --group ship --version v1beta1 --kind Frigate --force
Create Resource [y/n]
y
Create Controller [y/n]
y
Writing scaffold for you to edit...
api/v1beta1/frigate_types.go
Error: failed to create API with "go.kubebuilder.io/v3-alpha": error scaffolding APIs: failed to create api/v1beta1/frigate_types.go: file already exists
Usage:
  kubebuilder create api [flags]

Examples:
  # Create a frigates API with Group: ship, Version: v1beta1 and Kind: Frigate
  kubebuilder create api --group ship --version v1beta1 --kind Frigate

  # Edit the API Scheme
  nano api/v1beta1/frigate_types.go

  # Edit the Controller
  nano controllers/frigate/frigate_controller.go

  # Edit the Controller Test
  nano controllers/frigate/frigate_controller_test.go

  # Install CRDs into the Kubernetes cluster using kubectl apply
  make install

  # Regenerate code and run against the Kubernetes cluster configured by ~/.kube/config
  make run
	

Flags:
      --controller       if set, generate the controller without prompting the user (default true)
      --force            attempt to create resource even if it already exists
      --group string     resource Group
  -h, --help             help for api
      --kind string      resource Kind
      --make             if true, run make after generating files (default true)
      --namespaced       resource is namespaced (default true)
      --resource         if set, generate the resource without prompting the user (default true)
      --version string   resource Version

2020/11/18 11:39:30 failed to create API with "go.kubebuilder.io/v3-alpha": error scaffolding APIs: failed to create api/v1beta1/frigate_types.go: file already exists
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 18, 2020
@prafull01
Copy link
Contributor Author

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants