Skip to content
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

Failed to transform yaml input stream into object #229

Closed
Jinchul81 opened this issue Apr 3, 2018 · 3 comments
Closed

Failed to transform yaml input stream into object #229

Jinchul81 opened this issue Apr 3, 2018 · 3 comments

Comments

@Jinchul81
Copy link

My system is built based on Kubernetes v1.9, client-java-parent-1.0.0-beta3
Unexpected exception occurred when loading yaml file which contains 'storage: 1Gi'. The root cause was that Quality class did not have a constructor to take a single string parameter. I was able to resolve the problem by adding the following code snippet. Let me provide a patch and request a PR.

A code snippet into Quantity.java

    public Quantity(final String value) {
        final Quantity quantity = fromString(value);
        this.number = quantity.getNumber();
        this.format = quantity.getFormat();
    }

A code snippet for YAML file loading.

    try {
      V1beta2StatefulSet body = yaml.loadAs(new FileReader(filePath), V1beta2StatefulSet.class);

An example of StatefulSet for YAML file.

  ...
  volumeClaimTemplates:
  - metadata:
      name: www
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
      storageClassName: managed-nfs-storage
@Jinchul81
Copy link
Author

A few questions before sending a PR.

  1. Do you think the solution is promising?
  2. Do I need to add a test? If so, where should I add an unit test?

@karthikkondapally
Copy link
Contributor

I think it has been fixed in #223

@brendandburns
Copy link
Contributor

Yeah, I think this is fixed in #223, I'm going to cut another release, can you either test at head, or wait for the release and validate the fix? Re-open if it still occurs.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants