roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.04k stars 566 forks source link

transform fails due to no kustomization.yml #1608

Open jbadeau opened 3 years ago

jbadeau commented 3 years ago

Hello,

I am using

Windows: 7 1.4.2 Helmfile: 0.135.0 Kustomize: 3.8.7 Helm: 3.3.0

I have tried your kustomize transformer inline example and added the following to my release:

    transformers:
    - apiVersion: builtin
      kind: AnnotationsTransformer
      metadata:
        name: notImportantHere
      annotations:
        area: 51
        greeting: take me to your leader
      fieldSpecs:
        - path: metadata/annotations
          create: true

I get the error:

running helm template --debug=false --include-crds --output-dir C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered -f C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\values.yaml -f C:\Users\jbadeau\AppData\Local\Temp\values139161805 --namespace todo-dev sixsense C:\Users\tk
9ax\AppData\Local\Temp\chartify889231816\mongodb
patching files: [C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mongodb/templates/secrets.yaml C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mongodb/templates/pvc.yaml C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mong
odb/templates/svc.yaml C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mongodb/templates/deployment.yaml]
generated and using kustomization.yaml:
kind: ""
apiversion: ""
resources:
- C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mongodb/templates/secrets.yaml
- C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mongodb/templates/pvc.yaml
- C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mongodb/templates/svc.yaml
- C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\helmx.1.rendered\mongodb/templates/deployment.yaml
transformers:
- transformers\transformer.0.yaml

Generating C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\all.patched.yaml
running kustomize build C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb --output C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\all.patched.yaml
Error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory 'C:\Users\jbadeau\AppData\Local\Temp\kustomize-535000131\repo'

in ./helmfile.yaml: [exit status 1

COMMAND:
  kustomize build C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb --output C:\Users\jbadeau\AppData\Local\Temp\chartify889231816\mongodb\all.patched.yaml

OUTPUT:
  Error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory 'C:\Users\jbadeau\AppData\Local\Temp\kustomize-535000131\repo']

The dir C:\Users\jbadeau\AppData\Local\Temp\kustomize-535000131\repo does not exist?

Any ideas?

tomassatka commented 3 years ago

+1

mumoshu commented 3 years ago

Perhaps we don't have the propoer support for Windows there? (It's definitely working on Linux/macOS that I have

jbadeau commented 3 years ago

Ok, I will run it in our pipeline to check that. Do you plan to support windows?

tomassatka commented 3 years ago

Still the issue on v0.138.4 when executing in windows. Can i ask for an update?

tomassatka commented 3 years ago

After quick analysis:

Issue was caused by kustomize version that could not see generated kustomization.yaml in directory that was pointed: kustomize build C:\Users\tk9at\AppData\Local\Temp\1\chartify431156076\TODO-reportportal-5ddc9c6757 even when i could see the file inside the binary required full path including the file name to execute

however after updating to newest kustomize ver: Version:kustomize/v4.0.1 i get following output:

COMMAND:
  kustomize build C:\Users\tk9at\AppData\Local\Temp\1\chartify049311236\TODO-reportportal-6b846cd9c7 --output C:\Users\tk9at\AppData\Local\Temp\1\chartify049311236\TODO-reportportal-6b
846cd9c7\all.patched.yaml

OUTPUT:
  Error: accumulating resources: accumulation err='accumulating resources from 'C:\Users\tk9at\AppData\Local\Temp\1\chartify049311236\TODO-reportportal-6b846cd9c7\helmx.1.rendered\repo
rtportal/templates/postgresql-persistentvolumeclaim.yaml': evalsymlink failure on 'C:\Users\tk9at\AppData\Local\Temp\1\chartify049311236\TODO-reportportal-6b846cd9c7\helmx.1.rendered\r
eportportal/templates/postgresql-persistentvolumeclaim.yaml' : CreateFile C:\Users\tk9at\AppData\Local\Temp\1\chartify049311236\TODO-reportportal-6b846cd9c7\helmx.1.rendered: The syste
m cannot find the file specified.': new root 'C:\Users\tk9at\AppData\Local\Temp\1\chartify049311236\TODO-reportportal-6b846cd9c7\helmx.1.rendered\reportportal/templates/postgresql-pers
istentvolumeclaim.yaml' cannot be absolute]

my transformations are currently empty so not sure what the error means. Any ideas?

tomassatka commented 3 years ago

So another step.

Logs says: patching files: [C:\Users\tk9at\AppData\Local\Temp\1\chartify172352812\TODO-reportportal-5f6bfd4f6b\helmx.1.rendered\reportportal/templates/uat-service.yaml

then generated kustomization.yaml has entries:

kind: ""
apiversion: ""
resources:
- C:\Users\tk9at\AppData\Local\Temp\1\chartify172352812\TODO-reportportal-5f6bfd4f6b\helmx.1.rendered\reportportal/templates/uat-service.yaml
transformers:
- transformers\transformer.0.yaml

but directory helmx.1.rendered is not existing hence the kustomize is looking for non existing files hence the error.

$ ls -la
total 30
drwx------+ 1 user Domain Users     0 Feb 24 23:08 .
drwx------+ 1 user Domain Users     0 Feb 24 23:08 ..
-rwx------+ 1 user Domain Users    43 Feb 24 23:08 .gitignore
-rwx------+ 1 user Domain Users   322 Feb 24 23:08 Chart.yaml
-rwx------+ 1 user Domain Users  1472 Feb 24 23:08 README.md
-rwx------+ 1 user Domain Users   898 Feb 24 23:08 codefresh.yml
-rwx------+ 1 user Domain Users  4095 Feb 24 23:08 kustomization.yaml
drwx------+ 1 user Domain Users     0 Feb 24 23:08 transformers
-rwx------+ 1 user Domain Users 10180 Feb 24 23:08 values.yaml

so not sure what "patching files" should do but i dont see the files at all. That could be the clue to the issue

tomassatka commented 3 years ago

Further analysis shows:

Running:

helm template --debug=true --include-crds --output-dir C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96
\helmx.1.rendered -f C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\values.yaml --namespace TODO reportportal C:\Users\tk9at\AppData\Local\Temp\1\ch
artify747295644\TODO-reportportal-6c5cbb4c96
install.go:172: [debug] Original chart version: ""
install.go:189: [debug] CHART PATH: C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96

but using Chart.yaml from helm directory works.

C:\develop\projects\helm-reportportal\helmfile>helm template --debug=true --include-crds --output-dir C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96
\helmx.1.rendered -f C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\values.yaml --namespace TODO reportportal ../helm
install.go:172: [debug] Original chart version: ""
install.go:189: [debug] CHART PATH: C:\develop\projects\helm-reportportal\helm

wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/rabbitmq-secret.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/nginx-configmap.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/postgresql-configmap.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/rabbitmq-configmap.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/elasticsearch-persistentvolumeclaim.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/postgresql-persistentvolumeclaim.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/analyzer-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/api-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/elasticsearch-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/index-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/nginx-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/postgresql-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/rabbitmq-service-discovery.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/rabbitmq-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/uat-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/ui-service.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/api-deployment.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/index-deployment.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/nginx-deployment.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/uat-deployment.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/ui-deployment.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/analyzer-statefulset.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/elasticsearch-statefulset.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/postgresql-statefulset.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/rabbitmq-statefulset.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/migrations-job.yaml
wrote C:\Users\tk9at\AppData\Local\Temp\1\chartify747295644\TODO-reportportal-6c5cbb4c96\helmx.1.rendered\reportportal/templates/nginx-route.yaml

even when i replace the Chart.yaml in temp directory with the one from helm directory the behavior is the same. Must be something deep in helm binary itself....

Helm version: C:\develop\projects\helm-reportportal\helmfile>helm version version.BuildInfo{Version:"v3.4.1", GitCommit:"c4e74854886b2efe3321e185578e6db9be0a6e29", GitTreeState:"clean", GoVersion:"go1.14.11"}

tomassatka commented 3 years ago

Linked to helm issue #9414