Fabric8 Kubernetes Client also offers very useful extensions for Istio, Knative, Tekton and Service Catalog. Since then, it has evolved a lot. Today I would be giving a quick overview of Fabric8 Tekton extension.
You can find Tekton Client on Maven Central as usual. You can start using Tekton client by adding it as a dependency in your pom.xml
:
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>tekton-client</artifactId>
<version>${tekton-client.version}</version>
</dependency>
</dependencies>
Most of the usage of Tekton Client is easily understandable and similar to it’s parent Fabric8 Kubernetes Client. This is a very basic top level overview of it’s usage of using v1alpha1
or v1beta1
apiVersions:
try (TektonClient tkn = new DefaultTektonClient()) {
tkn.v1alpha1().* // -> Used for resources in tekton.dev/v1alpha1
tkn.v1beta1().* // -> Used for resources in tekton.dev/v1beta1
}
DSL entrypoints in Fabric8 Tekton Client
Once added as a dependency, you can start using Fabric8 Tekton Client. Let’s start by listing all the Pipeline
objects. Here is how you would do it with Fabric8 Tekton client:
package io.fabric8.demo.tekton;
import io.fabric8.tekton.client.DefaultTektonClient;
import io.fabric8.tekton.client.TektonClient;
public class ListAllPipelines {
public static void main(String[] args) {
try (TektonClient tkn = new DefaultTektonClient()) {
tkn.v1beta1()
.pipelines()
.inNamespace("default")
.list()
.getItems()
.forEach(p -> System.out.println(p.getMetadata().getName()));
}
}
}
#devops #java #fabric8 #tekton #kubernetes