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

third_party/ko: Add ko as third party tools #415

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

heylongdacoder
Copy link
Contributor

Add Install, BuildLocal and GetLocalImage functions.

What type of PR is this?

/kind feature

What this PR does / why we need it:

Already explained in #343

Which issue(s) this PR fixes:

Partially addresses #343

Special notes for your reviewer:

N/A

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., Usage docs, etc.:

N/A

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 11, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @heylongdacoder. 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-sigs/prow 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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels May 11, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 11, 2024
@heylongdacoder
Copy link
Contributor Author

Hi @vladimirvivien, I just realized you were suggesting the BuildLocal function should build and publish to a local Docker. This PR is about ko and a KinD cluster. Since KinD is a popular way to test controllers and operators, I think this PR might be helpful. If so, maybe we can merge this PR first and then create another follow-up PR for the BuildLocal (Docker) and BuildRemote (Docker) functions. WDYT? 😄

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@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 May 12, 2024
@heylongdacoder heylongdacoder force-pushed the third-party-ko branch 2 times, most recently from 1dbbbcd to 4ac0687 Compare May 13, 2024 15:40
Add Install, BuildLocal and GetLocalImage functions.

Signed-off-by: Wen Long <[email protected]>
@vladimirvivien
Copy link
Contributor

@heylongdacoder this is great.
So, does this PR allow local build of images and deploy images into a running Kind cluster?

@harshanarayana cc

@cpanato
Copy link
Member

cpanato commented May 22, 2024

it looks great, just one question why not use ko as lib instead need to have that installed and use via shell?

@vladimirvivien
Copy link
Contributor

+1 on @cpanato question.

@heylongdacoder
Copy link
Contributor Author

heylongdacoder commented May 23, 2024

does this PR allow local build of images and deploy images into a running Kind cluster?

@vladimirvivien yes, you are right 😄

why not use ko as lib

@cpanato @vladimirvivien , I never thought about this because other tools were installed and use via shell. But if we want to use ko as lib, do we need to ensure ko maintainers agree to maintain those functions signature?

@harshanarayana
Copy link
Contributor

harshanarayana commented May 28, 2024

+1 from me too. I like the idea of integrating this as a lib instead of the CLI.

I have been using ko as a lib for my work related item for a while in dev mode. They even have a doc around it. https://ko.build/advanced/go-packages/

With this in place, I suppose there is going to be some guarantee on backward compatibility.

That being said, Only concern I have is all the dependencies that will come along with ko into e2e-framework (framework has very little dependency outside of the k/* repo right now). Direct/transient. Do we see it leading to some issue in the future ? with the bin approach, we don't have to worry about that complication

@harshanarayana
Copy link
Contributor

So, does this PR allow local build of images and deploy images into a running Kind cluster?

We should be able to chain the build call to the kind providers load image to get this working. Right ? @vladimirvivien

@tsl409
Copy link

tsl409 commented May 28, 2024

+1 definitely nice to have!

@cpanato
Copy link
Member

cpanato commented May 28, 2024

I think, for now, we can keep it as is. We have other tools that follow this approach.
and as a follow up, we can migrate to use as a lib

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/approve

/hold for @harshanarayana @vladimirvivien

@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 May 30, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 30, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, heylongdacoder

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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 30, 2024
Copy link
Contributor

@harshanarayana harshanarayana left a comment

Choose a reason for hiding this comment

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

/lgtm

@vladimirvivien
Copy link
Contributor

Thanks @heylongdacoder this is great.

All good points raised here. Brining ko Go dependency could be overkill and since Kind uses OS commands, I think this is Ok as well.

As @harshanarayana mentioned, I think it a user should be able to load the docker image in Kind. Maybe an example to show the whole cycle of build and load would be useful.

@heylongdacoder
Copy link
Contributor Author

Maybe an example to show the whole cycle of build and load would be useful.

https://github.com/kubernetes-sigs/e2e-framework/pull/415/files#diff-5e974e6375efb2beaa1644b28e57ba8e5c006b9dab1b47620b4edc24cd50d042R40, it is actually here. The KinD cluster is created in main_test.go. Then, the ko BuildLocal function is used to build the testdata/example_goapp and load it into the KinD cluster using its name. Do you all think this is good enough? 😄

Copy link
Contributor

@vladimirvivien vladimirvivien left a comment

Choose a reason for hiding this comment

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

LGTM
@harshanarayana i think this can go in.

@cpanato
Copy link
Member

cpanato commented Jun 25, 2024

/unhold

@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 Jun 25, 2024
@k8s-ci-robot k8s-ci-robot merged commit c1ac086 into kubernetes-sigs:main Jun 25, 2024
4 checks passed
@heylongdacoder
Copy link
Contributor Author

thanks for all the review!

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. kind/feature Categorizes issue or PR as related to a new feature. 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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

6 participants