GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
14.8k stars 1.61k forks source link

`skaffold build` should build and push Helm charts #6854

Open briandealwis opened 2 years ago

briandealwis commented 2 years ago

Request from @eshepelyuk on our #skaffold channel: Skaffold should support creating a Helm package (.tgz), and to also push a chart to a registry.

Skaffold already generates a Helm package (a .tgz file) as a side-effect of branding the chart with a version or appVersion, but this is only done on deploy and the package is written out to $TMPDIR. This requires deploying the chart to a cluster, but @eshepelyuk does not actually want to the chart.

Helm 3.7 introduced helm push to push the package to an OCI-compliant registry.


I propose the following:

  1. The skaffold.yaml's deploy.helm.releases.packaged should support two additional fields:
    1. local should specify a local directory (created if necessary) where packages should be saved locally.
    2. repo should specify a remote repository to which to push the packages.
  2. When packages.repo is set and build.local.push = true, then skaffold build (not deploy) should build and save and push Helm packages. This destination should be affected by --default-repo.
  3. Since helm install / helm upgrade is always run locally for the deploy, the Helm package should always be created locally even when the build-environment is set to GCB or a cluster build.
  4. The pushed chart should be recorded in the artifacts.json.
eshepelyuk commented 2 years ago

Great explanation, thank you.

aantn commented 2 years ago

I would love this feature too. We're doing some hacks right now with sed to build Helm charts ourselves with images from skaffold build

tejal29 commented 2 years ago

Removing the traige/discuss label. Right now, the team does not have bandwidth to work on this. Happy to accept contributions or DD.

zarinfam commented 2 years ago

It would be a great feature.

leanrobot commented 2 years ago

+1 I would use this feature as well

aantn commented 2 years ago

If anyone wants a workaround for this, you can see how we're handling it for robusta.dev here:

https://github.com/robusta-dev/robusta/blob/1873bb990ad66aef2d4f5fd0fe22a17cc3ec7114/.github/workflows/release.yaml

Would still love this as skaffold feature of course!

ievgenii-shepeliuk commented 2 years ago

If anyone wants a workaround for this, you can see how we're handling it for robusta.dev here:

https://github.com/robusta-dev/robusta/blob/1873bb990ad66aef2d4f5fd0fe22a17cc3ec7114/.github/workflows/release.yaml

Would still love this as skaffold feature of course!

Do you know that there's no need to patch Chart.yaml ? You can use --version and --app-version flag while calling helm package to set proper versions in the resulting TGZ.

aantn commented 2 years ago

@ievgenii-shepeliuk ah that's cool! Thank you!

MarlonGamez commented 2 years ago

Coming in here to just update and mention that while we don't have the bandwidth on our team to prioritize this right now, anyone is welcome to write up a design for us to review and possibly go forward with. @briandealwis has provided a decent base to work off of in his original comment

ghost commented 1 year ago

Hi @MarlonGamez any movement on this issue? I understand that the team does not have the bandwidth, but just curious to know if this might have been tackled in another duplicate ticket. Thank you for a great tool that helps bridge the gap between devs, tools and ops.

aaron-prindle commented 1 year ago

Adding this as a discussion item for our teams triage meeting next Mon (1/23). Currently adding this feature isn't prioritized for the team or a part of our milestones in the near future. One potential workaround here would be to create a [lifecycle hook] (https://skaffold.dev/docs/pipeline-stages/lifecycle-hooks/) that calls necessary helm package commands