Getdeck / getdeck

A CLI that creates reproducible Kubernetes environments for development and testing
https://getdeck.dev
Apache License 2.0
90 stars 2 forks source link

local helm on windows uses incorrect path to values files #122

Open eyammer opened 1 year ago

eyammer commented 1 year ago

What happened?

ran deck get using:

- type: helm 
        ref: ./redis/ 
        releaseName: redis 
        chart: redis 
        namespace: default 
        valueFiles: 
          - ./inf.yaml 

This exited with an error:

ocker.errors.ContainerError: Command 'bash -c "helm dep up ./redis/ && helm template redis /sources/redis/ --include-crds --namespace default --values /sources\redis/inf.yaml --output-dir /output --kube-version 1.24 --api-versions 1.24"' in image 'deck-tooler:0.10.1' returned non-zero exit status 1: b'Error: open /sourcesredis/inf.yaml: no such file or directory\n' 

[CRITICAL] There was an error running deck: Command 'bash -c "helm dep up ./redis/ && helm template redis /sources/redis/ --include-crds --namespace default --values /sources\redis/inf.yaml --output-dir /output --kube-version 1.24 --api-versions 1.24"' in image 'deck-tooler:0.10.1' returned non-zero exit status 1: b'Error: open /sourcesredis/inf.yaml: no such file or directory\n' 

What did you expect to happen?

the deck to start

How can we reproduce it (as minimally and precisely as possible)?

on windows run deck get deck.yaml

What is the content of the Deckfile you are using?

version: "1"

cluster:

provider: beiboot

name: beka

nativeConfig:

timeouts: 

 api: 60  # in seconds, defaults to 30 

 cluster: 720  # in seconds, defaults to 180 

context: arn:aws:eks:us-east-1:236287118453:cluster/crb-devops-devops 

ports: 

  - port: 8080:80 

decks:

OS version

```console # On Linux: $ cat /etc/os-release # paste output here $ uname -a # paste output here # On Windows: C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture # paste output here BuildNumber Caption OSArchitecture Version 17763 Microsoft Windows Server 2019 Datacenter 64-bit 10.0.17763 ```

Anything else we need to know?

full error:

Traceback (most recent call last): 

  File "getdeck.__main__", line 143, in main 

    run_deck( 

  File "getdeck.api.utils", line 10, in wrapper 

    result = func(*args, **kwargs) 

  File "getdeck.api.get", line 75, in run_deck 

    raise e 

  File "getdeck.api.get", line 65, in run_deck 

    generated_deck = prepare_k8s_workload_for_deck( 

  File "getdeck.sources.utils", line 56, in prepare_k8s_workload_for_deck 

    source_files = fetcher_context.fetch_source_files() 

  File "getdeck.sources.fetcher", line 84, in fetch_source_files 

    source_files = self._strategy.fetch() 

  File "getdeck.sources.fetcher", line 43, in fetch 

    return handler(self) 

  File "getdeck.sources.tooler", line 140, in fetch_local 

    self.run_tooler(cmd) 

  File "getdeck.sources.tooler", line 183, in run_tooler 

    tooler.run( 

  File "getdeck.sources.tooler", line 45, in run 

    content = config.DOCKER.containers.run( 

  File "docker.models.containers", line 875, in run 

    raise ContainerError( 

docker.errors.ContainerError: Command 'bash -c "helm dep up ./redis/ && helm template redis /sources/redis/ --include-crds --namespace default --values /sources\redis/inf.yaml --output-dir /output --kube-version 1.24 --api-versions 1.24"' in image 'deck-tooler:0.10.1' returned non-zero exit status 1: b'Error: open /sourcesredis/inf.yaml: no such file or directory\n' 

[CRITICAL] There was an error running deck: Command 'bash -c "helm dep up ./redis/ && helm template redis /sources/redis/ --include-crds --namespace default --values /sources\redis/inf.yaml --output-dir /output --kube-version 1.24 --api-versions 1.24"' in image 'deck-tooler:0.10.1' returned non-zero exit status 1: b'Error: open /sourcesredis/inf.yaml: no such file or directory\n' 
eyammer commented 1 year ago

I upgraded to deck 0.11.1 it still failed, the error was a bit different.

[INFO] Now deleting Beiboot 'beka-eyammercvm-eyammer'. 

Traceback (most recent call last): 

  File "getdeck.__main__", line 159, in main 

    command(args=args) 

  File "getdeck.cli.get", line 182, in get_command 

    run_deck( 

  File "getdeck.cli.utils", line 10, in wrapper 

    result = func(*args, **kwargs) 

  File "getdeck.cli.get", line 77, in run_deck 

    raise e 

  File "getdeck.cli.get", line 69, in run_deck 

    generated_deck = prepare_k8s_workload_for_deck(config, data_aux, deck_name) 

  File "getdeck.sources.utils", line 69, in prepare_k8s_workload_for_deck 

    source_files = resource_generator.render( 

  File "getdeck.sources.generator", line 66, in render 

    source_files = self._render_behavior.render( 

  File "getdeck.sources.tooler", line 147, in render 

    self.run_tooler(cmd) 

  File "getdeck.sources.tooler", line 170, in run_tooler 

    tooler.run( 

  File "getdeck.sources.tooler", line 45, in run 

    content = config.DOCKER.containers.run( 

  File "docker.models.containers", line 876, in run 

    raise ContainerError( 

docker.errors.ContainerError: Command 'bash -c "helm dep up ./redis/ && helm template redis /sources/redis/ --include-crds --namespace default --values /sources\redis/inf.yaml --output-dir /output --kube-version 1.24 --api-versions 1.24"' in image 'deck-tooler:0.11.1' returned non-zero exit status 1: b'Error: could not find redis: stat redis: no such file or directory\n' 

[CRITICAL] There was an error running deck: Command 'bash -c "helm dep up ./redis/ && helm template redis /sources/redis/ --include-crds --namespace default --values /sources\redis/inf.yaml --output-dir /output --kube-version 1.24 --api-versions 1.24"' in image 'deck-tooler:0.11.1' returned non-zero exit status 1: b'Error: could not find redis: stat redis: no such file or directory\n' 
buschNT commented 1 year ago

Hello @eyammer Thanks for reporting this issue. The path in version 10.1 is clearly wrong: b'Error: open /sourcesredis/inf.yaml: no such file or directory\n' This looks like some path parsing/merging errors depending on the operating system. Even if the error message is slightly different in version 11.1, it might still be the underlying cause of this error.

eyammer commented 1 year ago

Makes sense. The workaround was to put the absolute path for the values file using the path it hsould have in the deck container:

valueFiles:
  - /sources/redis/inf.yaml

this fixed the issue however it is less than ideal.