kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

fabric8 generator cli and maven plugin returning different java method names

Open fhalde opened this issue 10 months ago • 4 comments

Describe the bug

We are trying to generate Java classes for the following CRD https://github.com/strimzi/strimzi-kafka-operator/blob/affc1968742a8ab1121d23a64c9247ca5c477a32/install/cluster-operator/041-Crd-kafkaconnect.yaml

We set extraAnnotations configuration to generate the fluent builder pattern. Here is what we are noticing

This CRD has a template field. With the CLI, the builder has correct withTemplate & endTemplate methods However, with the maven plugin, the builder seems to have withTemplate & endKafkaconnectspecTemplate method

What could be the reason?

Fabric8 Kubernetes Client version

6.12.1

Steps to reproduce

Generate the java sources using both the cli and maven fabric8 generator plugin e.g. cli

jbang io.fabric8:java-generator-cli:6.12.1 --target="." -add-extra-annotations -always-preserve-unknown --source=kafkaconnects.yaml

Expected behavior

We expected the plugin & the cli to work the same way

Runtime

minikube

Kubernetes API Server version

1.25.3@latest

Environment

Linux, macOS

Fabric8 Kubernetes Client Logs

No response

Additional context

No response

fhalde avatar Apr 25 '24 13:04 fhalde

endKafkaconnectspecTemplate

That is a sundrio bug. We'll need to pickup another release to correct that.

shawkins avatar Apr 25 '24 13:04 shawkins

thanks, why would it work fine with the cli though which is also making use of sundrio?

fhalde avatar Apr 25 '24 14:04 fhalde

You must be picking up a different version of sundio that way.

shawkins avatar Apr 25 '24 14:04 shawkins

I'm not able to reproduce this using the maven plugin. Check which version of sundrio you're using.

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1</version>
  <properties>
    <kubernetes-client.version>6.12.1</kubernetes-client.version>
    <sundrio.version>0.103.1</sundrio.version>
    <lombok.version>1.18.32</lombok.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>kubernetes-client</artifactId>
      <version>${kubernetes-client.version}</version>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>generator-annotations</artifactId>
      <version>${kubernetes-client.version}</version>
    </dependency>
    <!-- extraAnnotations requires these additional dependencies -->
    <dependency>
      <groupId>io.sundr</groupId>
      <artifactId>builder-annotations</artifactId>
      <version>${sundrio.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>java-generator-maven-plugin</artifactId>
        <version>${kubernetes-client.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <source>041-Crd-kafkaconnect.yaml</source>
          <alwaysPreserveUnknown>true</alwaysPreserveUnknown>
          <extraAnnotations>true</extraAnnotations>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

matteriben avatar Apr 25 '24 20:04 matteriben

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

stale[bot] avatar Aug 03 '24 02:08 stale[bot]