carvel-dev / kapp-controller

Continuous delivery and package management for Kubernetes.
https://carvel.dev/kapp-controller
Apache License 2.0
269 stars 105 forks source link

Parsing error when using '-' as template argument #115

Closed benmoss closed 3 years ago

benmoss commented 3 years ago

What steps did you take: Deployed an app piping from kbld to ytt:

...
 template:
  - kbld:
      paths:
      - config/stuff
  - ytt:
      paths:
      - -
      - config/ytt

What happened: The deploy eventually times out, but the kapp-controller logs this:

reflector.go:153] k8s.io/client-go@v0.17.2/tools/cache/reflector.go:105: Failed to list *v1alpha1.App: v1alpha1.AppList.Items: []v1alpha1.App: v1alpha1.App.Spec: v1alpha1.AppSpec.Template: []v1alpha1.AppTemplate: v1alpha1.AppTemplate.Ytt: v1alpha1.AppTemplateYtt.Paths: []string: ReadString: expects " or n, but found [, error found in #10 byte of ...|"paths":[[null],"con|..., bigger context ...|}},{"ytt":{"ignoreUnknownComments":true,"paths":[[null],"config/ytt"]}}]}}],"kind":"AppList","metada|...

What did you expect: It just works, or at least is documented that you need to quote - as an argument.

Anything else you would like to add: Quoting - fixes the problem.

Environment:

danielhelfand commented 3 years ago

As you mention, the - does need to be quoted because otherwise yaml thinks it is the beginning of new array.

We have noticed a fair amount of places in our docs where we do not promote this where we can update the docs:

A more helpful error would probably help as well.

ewrenn8 commented 3 years ago

There is not much we can do here because it is the yaml parsing that is failing. We may be able to get better error messages through adding schema to the App CRD. I created #130 to capture this work.

aaronshurley commented 3 years ago

As @ewrenn8 mentioned, there isn't much we can do here. #130 captures a potential error message improvement.

Since @danielhelfand already made the docs updates, can we close out this issue?