Skip to content

[v2] Add builtin kpt (Go1.16) #6367

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

Closed
wants to merge 1 commit into from

Conversation

yuwenma
Copy link
Contributor

@yuwenma yuwenma commented Aug 5, 2021

Related: #5673

Description
Some skaffold CMDs (e.g. render, dev, run) requires kpt CLI to hydrate the manifests. In case users do not have kpt or the right kpt version installed, we embed the kpt executable in the skaffold CLI, and installs for users if and only if a kpt executable is required but not found. This gives current skaffold users a smoother experience when switching to v2

The matching kpt OS and Arch will be decided in skaffold build (make install) and copied to pkg/skaffold/render/embed/kpt before building skaffold.

This builtin kpt uses the Go 1.16 "embed" feature

PR is tested manually. No unittests (since it requires different OS and ARC), integration tests are needed.

@yuwenma yuwenma requested a review from a team as a code owner August 5, 2021 18:21
@google-cla
Copy link

google-cla bot commented Aug 5, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Aug 5, 2021
@yuwenma yuwenma changed the title V2 14 embedkpt [v2] Add builtin kpt (Go1.16) Aug 5, 2021
@google-cla google-cla bot added cla: yes and removed cla: no labels Aug 5, 2021
@yuwenma
Copy link
Contributor Author

yuwenma commented Aug 12, 2021

Blocked by docker/golang-cross docker/golang-cross#54 docker/golang-cross#64

@briandealwis
Copy link
Member

Discussed with @yuwenma separately, but embedding kpt (a ~50mb) binary is not really a workable solution. We have a similar request around kompose for skaffold init --compose-file.

We do include a reasonably up-to-date kpt in the gcr.io/k8s-skaffold/skaffold image.

}

func getKptInstallPath() string {
paths := filepath.SplitList(os.Getenv("PATH"))
Copy link
Contributor

Choose a reason for hiding this comment

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

as a user, I'd prefer skaffold not to install something to PATH[0] on my computer. PATH[0] has no significance as far as I know. on my machine it points to /Users/ahmetb/.krew/bin :) and most devs will make similar edits to PATH.


// UseBuiltinKpt guarantees the `kpt` always exists in $PATH/bin. `kpt` is needed in skaffold render.
func UseBuiltinKpt() error {
err := os.WriteFile(getKptInstallPath(), kpt, os.ModePerm)
Copy link
Contributor

@ahmetb ahmetb Aug 18, 2021

Choose a reason for hiding this comment

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

would it be better to

  1. create tmpdir (+defer delete)
  2. write kpt there + chmod
  3. update running process's env via os.Setenv and add tmpdir
  4. now the os/exec should be running kpt via tmpdir?

@aaron-prindle
Copy link
Contributor

Currently this is blocked on - #6790. @briandealwis do we have plans on prioritizing updating skaffold's CI & release process to use go1.16 in an upcoming milestone?

@aaron-prindle aaron-prindle added triage/discuss Items for discussion !! blocked !! this issue/PR is blocked by another issue labels Nov 1, 2021
@briandealwis
Copy link
Member

Turning Skaffold from a 50MB → 100MB+ binary is not a workable solution and needs to be rethought. We can have a skaffold+kpt .tar.gz/.zip bundle.

Copy link

@SSGoku369 SSGoku369 left a comment

Choose a reason for hiding this comment

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

ok

@SSGoku369

This comment was marked as spam.

Copy link

@SSGoku369 SSGoku369 left a comment

Choose a reason for hiding this comment

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

ok

@SSGoku369

This comment was marked as spam.

Copy link

@SSGoku369 SSGoku369 left a comment

Choose a reason for hiding this comment

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

ok

Copy link

@SSGoku369 SSGoku369 left a comment

Choose a reason for hiding this comment

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

ok

@MarlonGamez MarlonGamez removed the triage/discuss Items for discussion label Jan 10, 2022
@tejal29
Copy link
Contributor

tejal29 commented Feb 1, 2022

closing this PR. Lets address this once we decide to distribute kpt via skaffold.

@tejal29 tejal29 closed this Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!! blocked !! this issue/PR is blocked by another issue cla: yes size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants