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

Expose ko features as a third-party Envfunc #343

Open
vladimirvivien opened this issue Oct 27, 2023 · 10 comments
Open

Expose ko features as a third-party Envfunc #343

vladimirvivien opened this issue Oct 27, 2023 · 10 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@vladimirvivien
Copy link
Contributor

vladimirvivien commented Oct 27, 2023

What do you want to see?

ko is a tool that automates the build and publication of Go code as container images. I think it would be useful to be able to create and deploy (locally or even remotely) container images during testing. This is especially true if building/testing Kubernetes controller/operators.

For instance, the following provides an idea of how that could work :

import(
    "sigs.k8s.io/e2e-framework/third_party/ko"
...
)

var testEnv env.Environment

func TestMain(m *testing.M) {
    testEnv.Setup(
        func(ctx context.Context, cfg *envconf.Config) (context.Context, error) {
            kotool = ko.Install("@latest")
            kotool.SetConfig("some-conf-file")
            kootool.RepoLogin("TOKEN_ENV")
            kotool.BuildLocal(ctx, "package-path") // builds/publishes in local docker, saves image name in ctx
            kotool.BuildRemote(ctx, "repo-path", "package-path")
            return ctx, nil
        }
    )

    testEnv.Finish(
        func(ctx context.Context, cfg *envconf.Config) (context.Context, error) {
            ko.RemoveLocalmage(ctx) // removes all built images from names saved in ctx
        }
}

Extra Labels

No response

@vladimirvivien vladimirvivien added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 27, 2023
@heylongdacoder
Copy link
Contributor

Hello, if no one is working on this yet, may I give it a try? 😄

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 10, 2024
@vladimirvivien
Copy link
Contributor Author

@heylongdacoder Still interested in working on this ?

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 16, 2024
@heylongdacoder
Copy link
Contributor

Hey @vladimirvivien, I have finished part of it with test cases. I will probably commit the code for review this weekend. But if I am blocking the progress, please feel free to take this! Many thanks!

@vladimirvivien
Copy link
Contributor Author

Hi @heylongdacoder were you able to start PR?

@heylongdacoder
Copy link
Contributor

@vladimirvivien sorry for the delay, I am working on it now.

@vladimirvivien
Copy link
Contributor Author

@heylongdacoder no worries at all.

@heylongdacoder
Copy link
Contributor

hey @vladimirvivien I would like to continue on this and confirm a few things.

  1. Are BuildDockerLocal and BuildDockerRemote still relevant?
  2. If point 1 is still relevant, for RemoveLocalImage, we would need the docker binary since ko does not have the functionality to remove images from Docker. Do you think that is ok?
  3. RemoveLocalImage, if we want to remove the images that were uploaded to KinD, currently I got no idea on how to implement this, since KinD does not provide the functionality to remove the images. Let me know if you have idea about this.

Thanks!

@vladimirvivien
Copy link
Contributor Author

Hi @heylongdacoder when I wrote the issue, I was giving an example of what could work.
You are free to implement whatever works best for the feature.

Thanks agai.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants