Skaffold: Support `debug` for Helm

Created on 26 Jun 2019  路  5Comments  路  Source: GoogleContainerTools/skaffold

Support debugging applications using Helm. Difficulties here are:

  • Helm charts use Go templating in all its glory: it's difficult to parse and manipulate, and can even result in loops to generate resource objects
  • Helm chart templates can be evaluated on both client- and server-side (by tiller)
  • Helm 3 is purely client-side

With Helm 3, our life is a bit easier as it seems to be entirely client-side templating. So we can treat it like our kustomize deployer.

Helm 2 is a bit more difficult. As I understand it, our current Helm deployer sends off the chart, and then applies changes (labels) to the deployed artifacts. One possibility is to use the same approach: pull down the deployed artifacts, transform, and then re-apply. There is a gap though where the un-transformed artifacts will be running.

Another approach would be to restrict debug to support client-side templating only. So we could attempt to first apply the Helm templates (helm template) and abort if further server-side template-application is required?

aredebug deplohelm kintodo prioritp2

Most helpful comment

Skaffold is great, this feature would be very helpful!

All 5 comments

Issue around general Helm 3 support #2142

@briandealwis - do you have any progress to report on this?

So Helm 3 adds a --post-renderer flag. From the description, it seems to support providing an executable (no arguments) to transform the manifests prior to being sent to the cluster. It provides the rendered k8s manifests on stdin, and expects the result in stdout.

Since this post-renderer executable cannot take any arguments, we could create a script on the fly to invoke skaffold. But it might be be easier to enhance Skaffold to support a special environment variable to pass along a command-line (SKAFFOLD_COMMAND_LINE?). This would then execute a new internal command, say debug-transform, to apply the debug transforms to the provided manifests. Or perhaps it might be more useful to extend render to support debug explicitly (skaffold render -f path/to/skaffold.yaml --debugging --manifests=-?).

debug currently uses the list of built image tags to decide which containers to affect. In this mode, perhaps we just attempt to transform all images. There was some discussion in #2184 about adding a debug --images=tag,... flag to only process certain images. We could use a similar mechanism to pass in the image list from the outer skaffold.

Limiting to client-side templating and helm3 is probably fine if this makes it simpler.

Skaffold is great, this feature would be very helpful!

Was this page helpful?
0 / 5 - 0 ratings