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

fixed gopkg.toml for Kubebuilder and generated project #122

Merged
merged 1 commit into from
May 4, 2018

Conversation

droot
Copy link
Contributor

@droot droot commented May 2, 2018

Highlights:

  • Removed self dependency in Gopkg.toml for Kubebuilder project
  • Update the Gopkg.toml file correctly for generated project
  • Added dep ensure test in test.sh
  • Update Travis config to add 'dep install'

Note: This also brings us one step closer to the goal of "not shipping vendors dir" in KB build. I will make a separate PR for that.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 2, 2018
@droot droot requested a review from pwittrock May 2, 2018 20:52
test.sh Outdated
@@ -221,4 +240,6 @@ prepare_testdir_under_gopath

generate_crd_resources
test_generated_controller
run_dep_ensure
test_generated_controller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't expect test_generated_controller to be called twice. Maybe you only need it after run_dep_ensure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep the tests as close as possible to the end user's workflow. users or we don't invoke dep ensure currently, so wanted to test controller tests before and after dep ensure.

I will add a comment explaining that. We will eventually have test controller when we start running dep ensure in project setup itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an interesting angle I hadn't thought of! That makes a lot more sense now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment in script explaining the reasoning.

test.sh Outdated
# like `dep ensure`.
#
# $ KB_VERSION=0.1.7 test.sh
KB_VERSION=${KB_VERSION:-unknown}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Travis testing, do we want to test this against one kb_version or multiple?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm...to cover version scenario, we should have an additional tests (preferably a unit test). Running travis with another version may turn out to be an over-kill and can bloat these tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also clarified the semantics for this version and renamed it to reflect its functionality.

// updateDepConfig updates the Dep config Gopkg.toml to include Kubebuilder
// project dependency. It uses the Kubebuilder version to determine whether
// to include branch or version in the contraint stanza.
func updateDepConfig() error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What usage does the generated project make of kubebuilder as a vendored dep? Does it depend on kubebuilder/pkg?

I have been wondering about this, still as a relative newcomer without a lot of hands on experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. The generated project uses controller libs from kubebuilder/pkg. Godoc link --> https://godoc.org/github.com/kubernetes-sigs/kubebuilder

Highlights:
 - Removed self dependency in Gopkg.toml for Kubebuilder project
 - Update the Gopkg.toml file correctly for generated project
 - Added `dep ensure` test in test.sh
 - Update Travis config to add 'dep install'
@droot
Copy link
Contributor Author

droot commented May 3, 2018

Addressed review comments. PTAL.

Copy link
Contributor

@Liujingfang1 Liujingfang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@fanzhangio
Copy link

fanzhangio commented May 3, 2018

I am thinking if it could be better to remove constraints of below in Gopkg.toml

github.com/pkg/errors
github.com/markbates/inflect
k8s.io/apiserver
k8s.io/kube-aggregator

It is because that the listed constraints are not used in client side generated project. Run dep in client side will cause IneffectiveConstraint error message:

$ dep ensure
Warning: the following project(s) have [[constraint]] stanzas in Gopkg.toml:

  ✗  github.com/markbates/inflect
  ✗  github.com/pkg/errors
  ✗  k8s.io/apiserver
  ✗  k8s.io/kube-aggregator

#27

@droot
Copy link
Contributor Author

droot commented May 4, 2018

@fanzhangio The reason I did not remove those constraints is because we share Gopkg.toml/lock file for kubebuilder project and the generated projects. Current Gopkg.toml file is good for Kubebuilder project but has extra pkgs for generated packages.

I am working on a PR which decouples these files, so "dep ensure" warnings for generated project will get addressed in that PR.

@droot droot merged commit 436988b into kubernetes-sigs:master May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants