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

Omitting --version on api create puts project in broken state #321

Closed
bwarminski opened this issue Jul 20, 2018 · 1 comment
Closed

Omitting --version on api create puts project in broken state #321

bwarminski opened this issue Jul 20, 2018 · 1 comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Milestone

Comments

@bwarminski
Copy link

I made a boo boo when typing but it uncovered a bug:

Steps to reproduce

kubebuilder init --domain localytics.com --license none
kubebuilder create api --group bigthicket --kind EphemeralEnvironment --namespaced false

Output

Create Resource under pkg/apis [y/n]?
y
Create Controller under pkg/controller [y/n]?
y
Writing scaffold for you to edit...
pkg/apis/bigthicket/ephemeralenvironment_types.go
pkg/apis/bigthicket/ephemeralenvironment_types_test.go
/*
.
*/

// NOTE: Boilerplate only.  Ignore this file.

// Package  contains API Schema definitions for the bigthicket  API group
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=github.com/localytics/big-thicket/controller/pkg/apis/bigthicket
// +k8s:defaulter-gen=TypeMeta
// +groupName=bigthicket.localytics.com
package 

import (
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/runtime/scheme"
)

var (
	// SchemeGroupVersion is group version used to register these objects
	SchemeGroupVersion = schema.GroupVersion{Group: "bigthicket.localytics.com", Version: ""}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
)

2018/07/19 20:30:49 pkg/apis/bigthicket/register.go:15:1: expected 'IDENT', found 'import'

Subsequent attempts to do anything, such as re-create the resource with the right flags, end up with:

can't load package: package github.com/localytics/big-thicket/controller/pkg/apis/bigthicket: 
pkg/apis/bigthicket/register.go:1:1: expected 'package', found 'EOF'
W0719 20:31:32.397711   16348 parse.go:239] Ignoring child directory github.com/localytics/big-thicket/controller/pkg/apis/bigthicket: unable to import "github.com/localytics/big-thicket/controller/pkg/apis/bigthicket": /Users/bwarminski/go/src/github.com/localytics/big-thicket/controller/pkg/apis/bigthicket/register.go:1:1: expected 'package', found 'EOF'
make: *** [generate] Error 1
2018/07/19 20:31:32 exit status 2

I think I saw a validation check running around, but maybe it happens too late in the process and empty files were scaffolded. Happy to attempt a fix once I've gotten some comfort with the happy path.

@droot
Copy link
Contributor

droot commented Jul 20, 2018

@bwarminski will take a look. Happy to review the code if you do attempt to fix it.

@droot droot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jul 26, 2018
@droot droot added this to the v1.0.1 milestone Aug 1, 2018
fraenkel added a commit to fraenkel/kubebuilder that referenced this issue Aug 11, 2018
fraenkel added a commit to fraenkel/kubebuilder that referenced this issue Aug 12, 2018
fraenkel added a commit to fraenkel/kubebuilder that referenced this issue Aug 12, 2018
fraenkel added a commit to fraenkel/kubebuilder that referenced this issue Aug 15, 2018
jkevlin pushed a commit to jkevlin/kubebuilder that referenced this issue Aug 22, 2018
# This is the 1st commit message:

Document adding an external type

# This is the commit message kubernetes-sigs#2:

Fix typo in book: flag is --owner, not --owners

# This is the commit message kubernetes-sigs#3:

gitbook: fixed installation instructions

# This is the commit message kubernetes-sigs#4:

Fix domain resource issues in controller

- fix in controller-tools and vendor in kubebuilder
- bind resource for controller based on whether resource is created.

# This is the commit message kubernetes-sigs#5:

improve contributing guide

# This is the commit message kubernetes-sigs#6:

Fix URL for the Gitbook

The URL is .io, not .com
# This is the commit message kubernetes-sigs#7:

Check go version

Fixes kubernetes-sigs#353

# This is the commit message kubernetes-sigs#8:

Validate create api flags

Fixes kubernetes-sigs#321

# This is the commit message kubernetes-sigs#9:

Update stable version in book

Update newest stable version to "1.0.1".

# This is the commit message kubernetes-sigs#10:

thirdparty tools: Dockerfile uses k8s 1.11

# This is the commit message kubernetes-sigs#11:

build: update cloudbuild config for building tools to use k8s 1.11

# This is the commit message kubernetes-sigs#12:

add document for connecting to existing kind

# This is the commit message kubernetes-sigs#13:

add document for connecting to existing kind

# This is the commit message kubernetes-sigs#14:

removed company from doc

# This is the commit message kubernetes-sigs#15:

fixed typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

2 participants