helmfile / chartify

Convert K8s manifests/Kustomization into Helm Chart
Apache License 2.0
79 stars 29 forks source link

helmfile destroy not working #11

Closed tomassatka closed 3 years ago

tomassatka commented 3 years ago

Hi

While using helmfile destroy i observed following error:

Executing command: helmfile -f ./helmfile/helmfile.yaml -n namespace destroy                                          
using requirements.yaml:                                                                                                   
dependencies:                                                                                                              
    - name: postgresql                                                                                                     
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: postgresql.installdep.enable                                                                              
      version: 8.6.2                  
    - name: rabbitmq                                                                                                       
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: rabbitmq.installdep.enable                                                                                
      version: 7.5.6                                                                                                       
    - name: elasticsearch                                                                                                  
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: elasticsearch.installdep.enable                                                                           
      version: 7.6.1                                                                                                       
    - name: minio                                                                                                          
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: minio.installdep.enable                                                                                   
      version: 5.0.33                                                                                                      

Skipping `helm dependency up` on release reportportal's chart due to that you've set SkipDeps=true.                        
This may result in outdated chart dependencies.                                                      
options: {false [/tmp/helmfile734628079/namespace-reportportal-values-8dc575594] [] namespace true}             
running helm template --debug=false --include-crds --output-dir /tmp/chartify563159426/namespace-reportportal-5bf78b5f
f9/helmx.1.rendered -f /tmp/chartify563159426/namespace-reportportal-5bf78b5ff9/values.yaml -f /tmp/helmfile734628079/
namespace-reportportal-values-8dc575594 --namespace namespace reportportal /tmp/chartify563159426/namespace-
reportportal-5bf78b5ff9                                     
Error: found in Chart.yaml, but missing in charts/ directory: postgresql, rabbitmq, elasticsearch, minio                   

in helmfile/helmfile.yaml: [exit status 1                                                                                  

COMMAND:                                                                                                                   
  helm template --debug=false --include-crds --output-dir /tmp/chartify563159426/namespace-reportportal-5bf78b5ff9/hel
mx.1.rendered -f /tmp/chartify563159426/namespace-reportportal-5bf78b5ff9/values.yaml -f /tmp/helmfile734628079/namespace-reportportal-values-8dc575594 --namespace namespace reportportal /tmp/chartify563159426/namespace-report
portal-5bf78b5ff9   

Basically i can install but cant uninstall with destroy since it says that SkipDeps=true.

using image: roboll/helmfile:helm3-v0.138.7

Offering my help again.

mumoshu commented 3 years ago

@tomassatka Hey! This one seems to be due to a potential bug in Helmfile. Helmfile should probably pass SkipDeps: false to chartify on destroy in this case, but apparently it doesn't.

Helmfile's calling Chartify function defined in this package and I thought it set SkipDeps there. It would be great if you could take a look into helmfile code and submit a PR for the fix. Otherwise give me some time to work on it.

mumoshu commented 3 years ago

@tomassatka Out of curiosity, are you using adhoc dependencies in your helmfile.yaml? Or is it just that you do a fresh clone of your git repo containing helmfile.yaml and your local chart before you run helmfile destroy, and your local chart doesn't have dependencies committed to the repo?

mumoshu commented 3 years ago

Well, I was able to reproduce it with adhod dependencies as follows, anyway.

releases:
- name: foo
  chart: incubator/raw
  kubeContext: ctx1
  forceNamespace: foo-system
  values:
  - resources:
    - metadata:
        name: bar
      apiVersion: v1
      kind: ConfigMap
- name: bar
  chart: incubator/raw
  kubeContext: ctx2
  forceNamespace: bar-system
  dependencies:
  - chart: stable/envoy
  values:
  - resources:
    - metadata:
        name: bar
      apiVersion: v1
      kind: ConfigMap
$ ./helmfile destroy
in ./helmfile.yaml: [exit status 1

COMMAND:
  helm template --debug=false --output-dir=/tmp/chartify291800095/ctx2/bar/raw/helmx.1.rendered --include-crds bar /tmp/chartify291800095/ctx2/bar/raw -f /tmp/chartify291800095/ctx2/bar/raw/values.yaml -f /tmp/helmfile400073381/bar-values-78c97785f

OUTPUT:
  WARNING: This chart is deprecated
  Error: found in Chart.yaml, but missing in charts/ directory: envoy]
mumoshu commented 3 years ago

Please see https://github.com/roboll/helmfile/issues/1800