fabric8io / kubernetes-client

Java client for Kubernetes & OpenShift
http://fabric8.io
Apache License 2.0
3.35k stars 1.45k forks source link

The copyInstance method in the Fluent generated by the Java code generator is missing the class field. #6067

Open dcais opened 2 weeks ago

dcais commented 2 weeks ago

Describe the bug

The copyInstance method in the Fluent generated by the Java code generator is missing the class field.

CRD is like below.

...
                  storage:
                    description: Storage configuration (disk). Cannot be updated.
                    properties:
                      class:
                        description: The storage class to use for dynamic volume allocation.
                        type: string
                      deleteClaim:
                        description: Specifies if the persistent volume claim has
                          to be deleted when the cluster is un-deployed.
                        type: boolean
                      id:
                        description: Storage identification number. It is mandatory
                          only for storage volumes defined in a storage of type 'jbod'.
                        minimum: 0
                        type: integer
                      overrides:
  ...
public class VolumesFluent<A extends VolumesFluent<A>> extends BaseFluent<A>{
  public VolumesFluent() {
  }

  public VolumesFluent(Volumes instance) {
    this.copyInstance(instance);
  }
  private Boolean deleteClaim;
  private Long id;
  private ArrayList<OverridesBuilder> overrides;
  private SelectorBuilder selector;
  private String size;
  private String sizeLimit;
  private Volumes.Type type;
  private Map<String,Object> additionalProperties;

  protected void copyInstance(Volumes instance) {
    instance = (instance != null ? instance : new Volumes());
    if (instance != null) {
          this.withDeleteClaim(instance.getDeleteClaim());
          this.withId(instance.getId());
          // class setting is missing 
          this.withOverrides(instance.getOverrides());
          this.withSelector(instance.getSelector());
          this.withSize(instance.getSize());
          this.withSizeLimit(instance.getSizeLimit());
          this.withType(instance.getType());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }

Fabric8 Kubernetes Client version

6.13.0

Steps to reproduce

just generator the java code from CRD

Expected behavior

generate the right class field setting method

Runtime

other (please specify in additional context)

Kubernetes API Server version

other (please specify in additional context)

Environment

macOS

Fabric8 Kubernetes Client Logs

no need

Additional context

no need

shawkins commented 2 weeks ago

@dcais this appears to be a CRD java generator issue, not a sundrio / fluent issue - the snippet you are showing does not have a "class" field at all.

We have re-written the CRD generator for the upcoming 7.0 release. More than likely this case will work with that version.