operator-sdk: We can't add a new api using operator-sdk 0.0.6 - must run command in project root dir: stat ./build/Dockerfile: no such file or directory
Bug Report
Command issued
operator-sdk add api --api-version=component.k8s.io/v1alpha1 --kind=Export
2018/10/23 17:42:55 must run command in project root dir: stat ./build/Dockerfile: no such file or directory
Tree of the local project
tree -I vendor
.
├── Gopkg.lock
├── Gopkg.toml
├── Makefile
├── README.md
├── cmd
│ ├── component-operator
│ │ └── main.go
│ └── sd
│ └── sd.go
├── config
│ └── config.yaml
├── deploy
│ ├── cr.yaml
│ ├── crd.yaml
│ ├── operator.yaml
│ ├── rbac.yaml
│ └── sa.yaml
├── examples
│ ├── component-crud.yml
│ ├── component-link.yml
│ ├── component-route.yml
│ ├── component-service.yml
│ ├── component-vertx.yml
│ └── component.yml
├── hack
│ ├── k8s-api.sh
│ └── steps.md
├── pkg
│ ├── apis
│ │ └── component
│ │ └── v1alpha1
│ │ ├── doc.go
│ │ ├── register.go
│ │ ├── types.go
│ │ └── zz_generated.deepcopy.go
│ ├── client
│ │ └── cmd
│ │ ├── create.go
│ │ ├── root.go
│ │ └── version.go
│ ├── integration
│ │ ├── enum_test.go
│ │ ├── enum_weekday.go
│ │ └── json_test.go
│ ├── stub
│ │ ├── handler.go
│ │ └── pipeline
│ │ ├── generic
│ │ │ ├── pvc.go
│ │ │ ├── route.go
│ │ │ └── service.go
│ │ ├── innerloop
│ │ │ ├── deploymentconfig.go
│ │ │ ├── images.go
│ │ │ ├── install.go
│ │ │ └── resources.go
│ │ ├── link
│ │ │ └── link.go
│ │ ├── servicecatalog
│ │ │ └── install.go
│ │ └── step.go
│ └── util
│ ├── kubernetes
│ │ ├── config.go
│ │ ├── convert.go
│ │ └── namespace.go
│ ├── oc
│ │ └── oc.go
│ ├── openshift
│ │ └── register.go
│ └── template
│ ├── assets.go
│ ├── assets_vfsdata.go
│ ├── doc.go
│ ├── template.go
│ └── tmpl
│ ├── innerloop
│ │ ├── deploymentconfig
│ │ ├── imagestream
│ │ ├── pvc
│ │ ├── route
│ │ └── service
│ └── servicecatalog
│ ├── servicebinding
│ └── serviceinstance
├── tmp
│ ├── _output
│ │ └── bin
│ │ ├── component-operator
│ │ ├── sb
│ │ ├── sd
│ │ └── spring-boot-operator
│ ├── build
│ │ ├── Dockerfile
│ │ ├── build.sh
│ │ ├── go-test.sh
│ │ └── test-framework
│ │ └── Dockerfile
│ └── codegen
│ ├── boilerplate.go.txt
│ └── update-generated.sh
└── version
└── version.go
Environment
-
operator-sdk version: 0.0.6+git
-
Kubernetes version information:
Insert output of
kubectl version
here -
Kubernetes cluster kind:
oc version
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth
Server https://192.168.99.50:8443
kubernetes v1.11.0+d4cacc0
- Are you writing your operator in ansible or go? go
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (16 by maintainers)
One option would be that we change our logic for how we decide we’re in a project root directory. Right now, we check
./build/Dockerfile
for all operator types, but we could instead just check that we have a valid operator type.Our
GetOperatorType()
function currently assumes we’re in a project root, but there’s no reason it has to. Its logic could be something like:Then
MustInProjectRoot
would look something like:With this type of check, we would no longer need to rely on a single file that’s present in every type of operator for an operation that doesn’t depend on that file.