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

Install kustomize if not present #1430

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

toonsevrin
Copy link
Contributor

@toonsevrin toonsevrin commented Mar 12, 2020

Resolves #1426

As long as the kustomize binary is already present in the PATH, the makefile behavior will be identical to before this patch (See the which statement). In my opinion this is perfect backwards compatibility and this patch should be included in v2.

Note that the test continuous-integration/travis-ci/pr will fail due to the Makefile being changed.

Notes:

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 12, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @toonsevrin. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 12, 2020
@toonsevrin
Copy link
Contributor Author

toonsevrin commented Mar 12, 2020

I am now testing this in a virtual machine.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 12, 2020
@toonsevrin
Copy link
Contributor Author

✔️ I've tested this on fresh ubuntu vms. It seems to work as expected.

I tested creating and installing an API with and without kustomize in the PATH. Without kustomize in the path, "go get kustomize" is ran, with kustomize nothing is ran.

Please confirm (and perhaps test some more paths) and merge.

@toonsevrin
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 12, 2020
Copy link
Contributor

@Adirio Adirio left a comment

Choose a reason for hiding this comment

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

The approach is the same as the one used for controller-gen currently. In that sense it looks ok.

golden_script.sh needs to be run to update the Makefiles under the testdata directory in order to pass the Travis check.

@mengqiy @DirectXMan12 what do you think of this?

@toonsevrin
Copy link
Contributor Author

All right I'll run goldenscript and squash.

@toonsevrin
Copy link
Contributor Author

toonsevrin commented Mar 12, 2020

@Adirio can you or someone else generate the golden_script for me? I receive the following error during the test:

go test ./pkg/... ./cmd/... -coverprofile cover.out
...
2020/03/12 17:33:22 failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
...

Not sure where it gets the idea that I have a /usr/local/kubebuilder folder :P

EDIT: I'm installing the latest etcd and the kubernetes api binaries in this directory just to get this to work quickly...
EDIT 2: Five hours later: fatal error: runtime: out of memory goddamnit

@Adirio
Copy link
Contributor

Adirio commented Mar 12, 2020

Sorry it is generate_golden.sh.

I can't run it because I'm on Windows.

@toonsevrin
Copy link
Contributor Author

@Adirio no worries, I've started a new vm with 4 times the RAM. Should complete this time.

As I'm on 1Mbps expect this to take a while 😆

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 12, 2020
@toonsevrin
Copy link
Contributor Author

toonsevrin commented Mar 12, 2020

@Adirio looks like an unexpected exception with the test occured, are you able to restart it?
/test all

@k8s-ci-robot
Copy link
Contributor

@toonsevrin: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

@Adirio looks like the test froze, are you able to restart it?
/test all

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Adirio
Copy link
Contributor

Adirio commented Mar 12, 2020

@Adirio looks like an unexpected exception with the test occured, are you able to restart it?

Close the PR and reopen it.

@Adirio
Copy link
Contributor

Adirio commented Mar 12, 2020

/ok-to-test
This will trigger the rest of the tests, but you still have to reopen for Travis

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 12, 2020
@toonsevrin toonsevrin closed this Mar 12, 2020
@toonsevrin toonsevrin reopened this Mar 12, 2020
@camilamacedo86
Copy link
Member

camilamacedo86 commented Mar 14, 2020

Hi @toonsevrin,

(For the next times)
Instead of run the golden script manually I'd recommend use the make generate. Note that it will ensure that the script will be executed with the correct versions required and is easier as well.

c/c @Adirio

@camilamacedo86
Copy link
Member

camilamacedo86 commented Mar 14, 2020

Hi @toonsevrin,

Great contribution. Your solution for me make totally sense and you are following the current design/approach that is already applied for another dependence.

You just need squash the commits for we are able to do it. Could you please check it?

HI @Adirio,

It does not change the design and etc. Do you see any objection/reason for we not move forward here?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 14, 2020
@camilamacedo86
Copy link
Member

/lgtm cancel

Reason: Missing squash the commits.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 14, 2020
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Just missing squash the commits.
Otherwise, I do not see any reason we do not move forward with this solution. All shows fine.

@Adirio
Copy link
Contributor

Adirio commented Mar 14, 2020

#1371 suggested to check for the dependency instead of installing it. One of the approaches should be followed by I'm not sure which of them feels better. Will keep the discussion over there.

@Adirio
Copy link
Contributor

Adirio commented Mar 14, 2020

/hold until #1371 discussion is settled

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 14, 2020
@toonsevrin
Copy link
Contributor Author

@camilamacedo86 squashed 🎉

@Adirio Imo the kustomize dependency should automatically be installed just like any other internal dependency (kustomize is no longer used by developers as they can apply -k). In an ideal world, it is installed in a path that is not accessible externally to the makefile (that way the external environment is not influenced). But as that is a bit perfectionistic (and is not done with controller-gen), I think my PR is superior to a simple check (and once we integrate checksums it will be safer as well, as users can trust us to peer-review the dependency)

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

It shows great for me.
Tested locally well.
Well done 👍

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 14, 2020
@Adirio
Copy link
Contributor

Adirio commented Mar 15, 2020

Let's see what do the owners think and we can remove the hold label.

@toonsevrin
Copy link
Contributor Author

toonsevrin commented Mar 31, 2020

@mengqiy
Copy link
Member

mengqiy commented Apr 14, 2020

/lgtm
/approve
/hold cancel
IMO this improvement is fine, since 1) it doesn't break any backward compatibility. 2) it respects it if users have already installed the kustomize binary. 3) it doesn't mess up go.mod, since it's done in a tmp dir 4) It deterministic what version of kustomize is installed if the installation is triggered.

Sorry for the delay.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 14, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 14, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, mengqiy, toonsevrin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [camilamacedo86,mengqiy]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove external kustomize dependency
5 participants