New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty YAML manifests #178

Closed
viglesiasce opened this Issue Jul 18, 2018 · 1 comment

Comments

Projects
None yet
4 participants
@viglesiasce

viglesiasce commented Jul 18, 2018

When using helm template to generate your base resources, there may be times when a resource is empty due to the way templating works in upstream charts. We should ignore empty manifests. Here is an example:

---
# Only a comment exists in this block
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: ci-jenkins
spec:
  template:
    spec:
      containers:
        - name: ci-jenkins
          image: jenkins/jenkins:lts

The error returned is:

$  kustomize buildError: loadResMapFromBasesAndResources: rawResources failed to read Resources: YAML file [/home/viglesias/git/kustomize-jenkins/charts/stable/my-jenkins/jenkins-base.yaml] encounters a format error.
error unmarshaling JSON: Object 'Kind' is missing in 'null'

For a example:

git clone https://github.com/kubernetes/charts.git
cd charts
helm template stable/jenkins
@zabio3

This comment has been minimized.

Show comment
Hide comment
@zabio3

zabio3 Jul 25, 2018

I was on the same problem.
The problem was solved by deleting "---" unique to yaml. (Perhaps it seems that json parsing can not be done if there is "---".)

zabio3 commented Jul 25, 2018

I was on the same problem.
The problem was solved by deleting "---" unique to yaml. (Perhaps it seems that json parsing can not be done if there is "---".)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment