Fabric8 Kubernetes Client 6.7 is now available!
On behalf of the Fabric8 team and everyone who has contributed, I'm happy to announce that the Fabric8 Kubernetes Client 6.7.2
has been released and is now available from Maven Central 🎉.
Thanks to all of you who have contributed with issue reports, pull requests, feedback, and spreading the word with blogs, videos, comments, and so on. We really appreciate your help, keep it up!
What's new?
Without further ado, let's have a look at the most significant updates:
- Java Generator Gradle Plugin
- Tekton model types updated to the latest versions
- Support for SOCKS proxies via proxy URLs
- 🐛 Many other bug fixes and minor improvements
You can find the full changelog for this version in our GitHub release page.
Java Generator Gradle Plugin
You can now generate Java classes from Kubernetes CRDs using Fabric8 Kubernetes Client Java Generator for your Gradle projects by leveraging the new java-generator
Gradle plugin. In previous versions, we already provided a CLI tool and a Maven plugin. The new Gradle plugin completes the toolset and will improve the developer experience for those dealing with Gradle.
The following snippet contains a sample build.gradle
project file with the new java-generator
Gradle plugin. The project is configured to generate Java classes with builders for the ActiveMQ Artemis Operator CRD.
plugins {
id 'java-library'
id 'io.fabric8.java-generator' version '6.7.2'
}
repositories {
mavenCentral()
mavenLocal()
}
sourceCompatibility = '17'
sourceSets {
main {
java {
srcDirs "$buildDir/generated/sources"
}
}
}
dependencies {
compileOnly 'io.sundr:builder-annotations:0.95.0'
annotationProcessor 'io.sundr:builder-annotations:0.95.0'
compileOnly 'org.projectlombok:lombok:1.18.28'
annotationProcessor 'org.projectlombok:lombok:1.18.28'
api 'io.fabric8:kubernetes-client:6.7.2'
api 'io.fabric8:generator-annotations:6.7.2'
}
javaGen {
urls = [
'https://raw.githubusercontent.com/rh-messaging/activemq-artemis-operator/amq-broker-7.11.0.OPR.3.CR1/bundle/manifests/broker.amq.io_activemqartemises.yaml'
]
extraAnnotations = true
}
We start by declaring the new plugin requirement in the first lines:
id 'io.fabric8.java-generator' version '6.7.2'
Next, we define an additional source set to include the generated Java classes in the project:
sourceSets {
main {
java {
srcDirs "$buildDir/generated/sources"
}
}
}
Note that in the dependency section we include dependencies for the Fabric8 Kubernetes Client and also the annotation processors from Lombok and Sundr.io to generate the Java classes with builders.
The last part contains the configuration for the Java Generator javaGen
. In this case, we're configuring it to download the CRD from the remote URL and to generate the builders by specifying theextraAnnotations=true
option.
javaGen {
urls = [
'https://raw.githubusercontent.com/rh-messaging/activemq-artemis-operator/amq-broker-7.11.0.OPR.3.CR1/bundle/manifests/broker.amq.io_activemqartemises.yaml'
]
extraAnnotations = true
}
Now that we have a complete build.gradle
project file, we can proceed to generate the Java classes by running the following command:
gradle crd2Java
Using this release
If your project is based on Maven, you just need to add the Fabric8 Kubernetes Client to your Maven dependencies:
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<version>6.7.2</version>
</dependency>
If your project is based on Gradle, you just need to add the Fabric8 Kubernetes Client to your Gradle dependencies:
dependencies {
api "io.fabric8:kubernetes-client:6.7.2"
}
Once your project is ready, you can create a new instance of the client to perform operations. In the following code snippet, I show you how to instantiate the client and retrieve a list of Pods:
try (KubernetesClient client = new KubernetesClientBuilder().build()) {
client.pods().list().getItems().forEach(p -> System.out.println(p.getMetadata().getName()));
}
How can you help?
If you're interested in helping out and are a first-time contributor, check out the "good first issue" tag in the issue repository. We've tagged extremely easy issues so that you can get started contributing to Open Source.
We're also excited to read articles and posts mentioning our project and sharing the user experience. Giving a star to the project, and spreading the word in general, helps us reach more users and broaden the feedback. Feedback is the only way to improve.
Project Page | Issues | Discussions | Gitter | Stack Overflow