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

Document how to reliably generate CRD code #582

Open
helinwang opened this issue Feb 2, 2018 · 4 comments
Open

Document how to reliably generate CRD code #582

helinwang opened this issue Feb 2, 2018 · 4 comments

Comments

@helinwang
Copy link
Collaborator

helinwang commented Feb 2, 2018

Currently go test $(glide novendor) fails with the output:

ok  	github.com/PaddlePaddle/cloud/go/filemanager/pfsmodules	0.032s
ok  	github.com/PaddlePaddle/cloud/go/filemanager/pfsserver	0.006s
ok  	github.com/PaddlePaddle/cloud/go/utils/config	0.037s
# github.com/PaddlePaddle/cloud/go/pkg/apis/paddlepaddle/v1alpha1
pkg/apis/paddlepaddle/v1alpha1/register.go:25: cannot use TrainingJob literal (type *TrainingJob) as type runtime.Object in argument to scheme.AddKnownTypes:
	*TrainingJob does not implement runtime.Object (missing DeepCopyObject method)
pkg/apis/paddlepaddle/v1alpha1/register.go:26: cannot use TrainingJobList literal (type *TrainingJobList) as type runtime.Object in argument to scheme.AddKnownTypes:
	*TrainingJobList does not implement runtime.Object (missing DeepCopyObject method)
?   	github.com/PaddlePaddle/cloud/go/utils/kubeutil	[no test files]
?   	github.com/PaddlePaddle/cloud/go/utils/pathutil	[no test files]
ok  	github.com/PaddlePaddle/cloud/go/utils/restclient	0.061s
?   	github.com/PaddlePaddle/cloud/go/paddlecloud	[no test files]
?   	github.com/PaddlePaddle/cloud/go/cmd/edl	[no test files]
?   	github.com/PaddlePaddle/cloud/go/cmd/paddlecloud	[no test files]
?   	github.com/PaddlePaddle/cloud/go/cmd/paddlectl	[no test files]
?   	github.com/PaddlePaddle/cloud/go/cmd/pfsserver	[no test files]
?   	github.com/PaddlePaddle/cloud/go/paddlectl	[no test files]
?   	github.com/PaddlePaddle/cloud/go/pkg/apis/paddlepaddle	[no test files]

This is due to the Kubernets CRD need developer to run code generation commands before the code could compile.

I tried to follow the commands in https://github.com/PaddlePaddle/cloud/blob/develop/.travis.yml#L15-L18 but go test $(glide novendor) still failed with:

pkg/client/clientset/versioned/clientset.go:21:2: cannot find package "github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1" in any of:
	/gopath/src/github.com/PaddlePaddle/cloud/go/vendor/github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1 (vendor tree)
	/usr/local/go/src/github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1 (from $GOROOT)
	/gopath/src/github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1 (from $GOPATH)
pkg/client/clientset/versioned/fake/clientset_generated.go:22:2: cannot find package "github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1/fake" in any of:
	/gopath/src/github.com/PaddlePaddle/cloud/go/vendor/github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1/fake (vendor tree)
	/usr/local/go/src/github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1/fake (from $GOROOT)
	/gopath/src/github.com/PaddlePaddle/cloud/go/pkg/client/clientset/versioned/typed/paddlepaddle/v1alpha1/fake (from $GOPATH)

I guess this is due to go get k8s.io/kubernetes used in the generation process is not tagged to a specific version.

Could we document how to reliably generate the required code, so that other developers could test all packages inside go folder without running into error? Thanks!

CC: @m3ngyang : could you take a look? Thanks for contributing!

@helinwang helinwang changed the title Document how to reliably generate CDR code Document how to reliably generate CRD code Feb 2, 2018
@m3ngyang
Copy link
Member

m3ngyang commented Feb 3, 2018

I update related codes in #565 , but maybe the pr is too large to review. And I'll submit several requests to solve the problem.

@m3ngyang
Copy link
Member

m3ngyang commented Feb 3, 2018

An easy to avoid the problem is to skip pkg dir when running go test.

@helinwang
Copy link
Collaborator Author

helinwang commented Feb 5, 2018

@m3ngyang Thanks for your reply! The PR #565 does not contain documentation for how to generate the CRD code. I think we need the documentation for that. It would be great if you can write a documentation for it since you are the one that most familiar with CRD. I will review for you.

In this case we should either have a document about how to generate the CRD code to make go test $(glide nv) pass, or have a document saying why go test $(glide nv) fails and please ignore the failure message for the CRD package. I think the former is the better solution.

@m3ngyang
Copy link
Member

m3ngyang commented Feb 6, 2018

ok, I will submit a pr to describe how to generate codes for crd in this readme doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants