Skip to content

Commit 9d6ffdd

Browse files
xm2Eric Stroczynski
andcommitted
Bug fix:'operator-sdk add crd' doesn't work after add kubebuilder tags (#1660)
* fix bug: 'operator-sdk add crd' doesn't work after add kubebuilder tag in _types.go * add fix info to changelog * Update CHANGELOG.md Co-Authored-By: Eric Stroczynski <[email protected]>
1 parent 7b1274b commit 9d6ffdd

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Removed
1010

1111
### Bug Fixes
12+
- Configure the repo path correctly in `operator-sdk add crd` and prevent the command from running outside of an operator project. ([#1660](https://github.com/operator-framework/operator-sdk/pull/1660))
1213

1314
## v0.10.0
1415

cmd/operator-sdk/add/crd.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ Generated CR filename: <project-name>/deploy/crds/<group>_<version>_<kind>_cr.y
5555
}
5656

5757
func crdFunc(cmd *cobra.Command, args []string) error {
58+
projutil.MustInProjectRoot()
59+
5860
cfg := &input.Config{
5961
AbsProjectPath: projutil.MustGetwd(),
62+
Repo: projutil.GetGoPkg(),
6063
}
6164
if len(args) != 0 {
6265
return fmt.Errorf("command %s doesn't accept any arguments", cmd.CommandPath())

0 commit comments

Comments
 (0)