skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

Add support for `helm template` flags

Open davegallant opened this issue 2 years ago • 3 comments

Expected behavior

There does not seem to be a way to pass --no-hooks to helm releases.

Being able to pass this flag to helm template would make renders (and therefore kubectl diff) much more readable.

For example, support for template flags may help:

deploy:
  helm:
    flags:
      template: ["--no-hooks"]

Actual behavior

skaffold render uses helm template and all hooks are displayed.

Information

  • Skaffold version: 2.1.0
  • Operating system: macOS 13.2
  • Installed via: Nix
  • Contents of skaffold.yaml:
apiVersion: skaffold/v3
kind: Config
metadata:
  name: third-party
deploy:
  helm:
    flags:
      upgrade: ["--atomic"]
    releases:
    - name: prometheus
      repo: https://prometheus-community.github.io/helm-charts
      remoteChart: kube-prometheus-stack
      version: 45.0.0
      namespace: monitoring
      createNamespace: true
      wait: true
      upgradeOnChange: true

Steps to reproduce the behavior

  1. Use skaffold.yaml above.
  2. skaffold deploy
  3. skaffold render | kubectl diff -f -
  4. Resources from helm hooks (such as Batch jobs) show up in every diff

davegallant avatar Feb 15 '23 16:02 davegallant

Another use case where the template flag is required is when the helm chart requires a specific minimal kubernetes version. For example Keda 2.10.2 requires at least kubernetes version 1.24.0.

The default kubernetes version for helm 3.11.3 seems to be 1.20.0. This causes the Helm chart to not be rendered but throwing following error:

skaffold deploy -m keda
std out err: %!(EXTRA *errors.errorString=Error: chart requires kubeVersion: >=v1.24.0-0 which is incompatible with Kubernetes v1.20.0

Use --debug flag to render out invalid YAML
)

Skaffold file:

apiVersion: skaffold/v4beta2
kind: Config
metadata:
  name: keda

manifests:
  helm:
    releases:
      - name: keda
        repo: https://kedacore.github.io/charts
        remoteChart: keda
        upgradeOnChange: true
        wait: true
        version: 2.10.2

chronicc avatar May 16 '23 08:05 chronicc

Is there any known workaround for this? Otherwise I could submit a PR for this, it seems like it could be easy to extend the existing HelmDeployFlags that exists in skaffold's schema currently under manifests.helm.flags and deploy.helm.flags, although I don't think a deploy.helm.flags.template would ever make sense anyway

zevisert avatar Nov 24 '23 02:11 zevisert

Another use case for helm template flags could resolve the issues I am facing with skaffold v2 in issues/9488.

With the helm template flag --dry-run=server our use case with the lookup function would work. Simply using the helm commands that skaffold executes with the extra flag seems to resolve our issues.

djcprinse avatar Aug 15 '24 15:08 djcprinse