Skip to content

Failed to transform yaml input stream into object #229

Closed
@Jinchul81

Description

@Jinchul81

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions