skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

skaffold cannot deploy local packaged helm chart

Open ondrej-ivanko opened this issue 2 years ago • 4 comments

Expected behavior

  • should deploy without accident with helm and local packaged chart according the documentation

Actual behavior

returns Error: only unpacked charts can be updated

Information

  • Skaffold version: 1.37.1
  • Operating system: Artix Linux 5.18.14-artix1-1
  • Installed via: skaffold run -p <profile>
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta15
kind: Config

profiles:
  - name: deploy
    deploy:
      helm:
        releases:
          - name: "{{.SITE}}"
            chartPath: starship-block.tgz
            namespace: "{{.SITE}}"
            createNamespace: true
            valuesFiles:
              - "siteconfig/{{.SITE}}.yaml"
            upgradeOnChange: true

Steps to reproduce the behavior

  1. get a packaged helm chart and try to deploy it with this skaffold.yaml profile

Last few lines of skaffold ... -vdebug:

time="2022-07-29T13:01:18Z" level=debug msg="Running command: [helm --kube-context uhurablock-office-test get all --namespace uhurablock-office-test uhurablock-office-test]" subtask=0 task=Deploy
time="2022-07-29T13:01:18Z" level=info msg="Building helm dependencies..." subtask=0 task=Deploy
time="2022-07-29T13:01:18Z" level=debug msg="Running command: [helm --kube-context uhurablock-office-test dep build starship-block.tgz]" subtask=0 task=Deploy
Error: only unpacked charts can be updated
time="2022-07-29T13:01:18Z" level=debug msg="Running command: [tput colors]" subtask=-1 task=DevLoop
time="2022-07-29T13:01:18Z" level=debug msg="error checking for color support: checking terminal colors: running [tput colors]\n - stdout: \"\"\n - stderr: \"tput: No value for $TERM and no -T specified\\n\"\n - cause: exit status 2" subtask=-1 task=DevLoop

ondrej-ivanko avatar Jul 29 '22 13:07 ondrej-ivanko

i reailzed it's default behaviour of helm to return this error with helm dependency build chart.tgz, but why does documentation mention, that chart can also be packaged?

ondrej-ivanko avatar Jul 29 '22 13:07 ondrej-ivanko

Skaffold and helm works if the chart is local (chartPath: './micro-svc-helm-chart/'). It replaces the image consistently. But when using remote chart repo (remoteChart: sonal-ms-github-helm-repo/micro-svc-helm-chart) then it does not replaces the image. I am using Skaffold version : v1.39.1 and minikube version: v1.26.0 on MAC M1 (12.2.1)


This works nicely with chartPath

apiVersion: skaffold/v2beta29
kind: Config
metadata:
  name: m-svc-2
build:
  artifacts:
  - image: m-svc-2-image
    docker:
      dockerfile: Dockerfile
deploy:
  # kubectl:
  #   manifests:
  #   - ./k8s/deployment.yaml
  helm:
    releases:
    - name: m-svc-2
      #remoteChart: sonal-ms-github-helm-repo/micro-svc-helm-chart
      #version: 0.6.0
      chartPath: './micro-svc-helm-chart/'
      valuesFiles:
      - '../skaffold-k8s-state/helm-values/m-svc-2/local/values.yaml'
      artifactOverrides:
        container.image: m-svc-2-image
      imageStrategy:
        fqn: {}


Logs

Build [m-svc-2-image] succeeded
Tags used in deployment:
 - m-svc-2-image -> m-svc-2-image:a9b64bcf91998cea29f3e5454830255691641c6df3989479d60b7e107c4e3763
Starting deploy...
Release "m-svc-2" has been upgraded. Happy Helming!
NAME: m-svc-2
LAST DEPLOYED: Fri Jul 29 15:21:45 2022
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None
Waiting for deployments to stabilize...
 - deployment/m-svc-2 is ready.
Deployments stabilized in 2.065 seconds

This does not work with Remote Helm Chart Repo Repo

apiVersion: skaffold/v2beta29
kind: Config
metadata:
  name: m-svc-2
build:
  artifacts:
  - image: m-svc-2-image
    docker:
      dockerfile: Dockerfile
deploy:
  # kubectl:
  #   manifests:
  #   - ./k8s/deployment.yaml
  helm:
    releases:
    - name: m-svc-2
      remoteChart: sonal-ms-github-helm-repo/micro-svc-helm-chart
      version: 0.6.0
      #chartPath: './micro-svc-helm-chart/'
      valuesFiles:
      - '../skaffold-k8s-state/helm-values/m-svc-2/local/values.yaml'
      artifactOverrides:
        container.image: m-svc-2-image
      imageStrategy:
        fqn: {}


Logs

 => => naming to docker.io/library/m-svc-2-image:f51bba0-dirty                                                                                                               0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Build [m-svc-2-image] succeeded
Tags used in deployment:
 - m-svc-2-image -> m-svc-2-image:556789fca8ab8a7ee1b39cc2572d447c3b26323c7944d43c0e05b2209c05cce5
Starting deploy...
WARN[0130] image [m-svc-2-image:556789fca8ab8a7ee1b39cc2572d447c3b26323c7944d43c0e05b2209c05cce5] is not used.  subtask=-1 task=DevLoop
WARN[0130] See helm documentation on how to replace image names with their actual tags: https://skaffold.dev/docs/pipeline-stages/deployers/helm/#image-configuration  subtask=-1 task=DevLoop
Waiting for deployments to stabilize...
 - deployment/m-svc-2 is ready.
Deployments stabilized in 1.067 second

sinhasonalkumar avatar Jul 29 '22 21:07 sinhasonalkumar

I managed to deploy using local unpacked chart using this skaffold.yaml:

apiVersion: skaffold/v2beta15
kind: Config

profiles:
  - name: deploy
    deploy:
      helm:
        releases:
          - name: "{{.SITE}}"
            # https://github.com/helm/helm/issues/9599 - don't use repo key until fixed
            chartPath: starship-block
            skipBuildDependencies: true
            namespace: "{{.SITE}}"
            createNamespace: true
            valuesFiles:
              - "siteconfig/{{.SITE}}.yaml"
            upgradeOnChange: true

I would say the key is the skipBuildDependencies: true - I was using highly customized umbrella chart, that contains several other charts. It was always failing in the process of building depencies (helm dep build...) so I skipped it and now it works. When it comes to single chart, I don't think building depencies would be an issue with a single chart, but in our case, when we had 15 charts in one umbrella chart, it was problematic I believe.

I never managed to deploy packaged chart.

ondrej-ivanko avatar Aug 03 '22 15:08 ondrej-ivanko

@tejal29 do you have any idea about this helm related issue? Is deploying packaged charts just not supported?

gsquared94 avatar Aug 14 '22 15:08 gsquared94