Updating date for blog post (#17816)
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
69c5c7945e
commit
f9a08761ee
+26
-27
@@ -2,31 +2,31 @@
|
|||||||
---
|
---
|
||||||
layout: blog
|
layout: blog
|
||||||
title: "Develop a Kubernetes controller in Java"
|
title: "Develop a Kubernetes controller in Java"
|
||||||
date: 2019-08-28
|
date: 2019-11-26
|
||||||
slug: Develop-A-Kubernetes-Controller-in-Java
|
slug: Develop-A-Kubernetes-Controller-in-Java
|
||||||
---
|
---
|
||||||
|
|
||||||
**Authors:** Min Kim (Ant Financial), Tony Ado (Ant Financial)
|
**Authors:** Min Kim (Ant Financial), Tony Ado (Ant Financial)
|
||||||
|
|
||||||
The official [Kubernetes Java SDK](https://github.com/kubernetes-client/java) project
|
The official [Kubernetes Java SDK](https://github.com/kubernetes-client/java) project
|
||||||
recently released their latest work on providing the Java Kubernetes developers
|
recently released their latest work on providing the Java Kubernetes developers
|
||||||
a handy Kubernetes controller-builder SDK which is helpful for easily developing
|
a handy Kubernetes controller-builder SDK which is helpful for easily developing
|
||||||
advanced workloads or systems.
|
advanced workloads or systems.
|
||||||
|
|
||||||
## Overall
|
## Overall
|
||||||
|
|
||||||
Java is no doubt one of the most popular programming languages in the world but
|
Java is no doubt one of the most popular programming languages in the world but
|
||||||
it's been difficult for a period time for those non-Golang developers to build up
|
it's been difficult for a period time for those non-Golang developers to build up
|
||||||
their customized controller/operator due to the lack of library resources in the
|
their customized controller/operator due to the lack of library resources in the
|
||||||
community. In the world of Golang, there're already some excellent controller
|
community. In the world of Golang, there're already some excellent controller
|
||||||
frameworks, for example, [controller runtime](https://github.com/kubernetes-sigs/controller-runtime),
|
frameworks, for example, [controller runtime](https://github.com/kubernetes-sigs/controller-runtime),
|
||||||
[operator SDK](https://github.com/operator-framework/operator-sdk). These
|
[operator SDK](https://github.com/operator-framework/operator-sdk). These
|
||||||
existing Golang frameworks are relying on the various utilities from the
|
existing Golang frameworks are relying on the various utilities from the
|
||||||
[Kubernetes Golang SDK](https://github.com/kubernetes/client-go) proven to
|
[Kubernetes Golang SDK](https://github.com/kubernetes/client-go) proven to
|
||||||
be stable over years. Driven by the emerging need of further integration into
|
be stable over years. Driven by the emerging need of further integration into
|
||||||
the platform of Kubernetes, we not only ported many essential toolings from the Golang
|
the platform of Kubernetes, we not only ported many essential toolings from the Golang
|
||||||
SDK into the kubernetes Java SDK including informers, work-queues, leader-elections,
|
SDK into the kubernetes Java SDK including informers, work-queues, leader-elections,
|
||||||
etc. but also developed a controller-builder SDK which wires up everything into
|
etc. but also developed a controller-builder SDK which wires up everything into
|
||||||
a runnable controller without hiccups.
|
a runnable controller without hiccups.
|
||||||
|
|
||||||
|
|
||||||
@@ -34,19 +34,19 @@ a runnable controller without hiccups.
|
|||||||
|
|
||||||
Why use Java to implement Kubernetes tooling? You might pick Java for:
|
Why use Java to implement Kubernetes tooling? You might pick Java for:
|
||||||
|
|
||||||
- __Integrating legacy enterprise Java systems__: Many companies have their legacy
|
- __Integrating legacy enterprise Java systems__: Many companies have their legacy
|
||||||
systems or frameworks written in Java in favor of stability. We are not able to
|
systems or frameworks written in Java in favor of stability. We are not able to
|
||||||
move everything to Golang easily.
|
move everything to Golang easily.
|
||||||
|
|
||||||
- __More open-source community resources__: Java is mature and has accumulated abundant open-source
|
- __More open-source community resources__: Java is mature and has accumulated abundant open-source
|
||||||
libraries over decades, even though Golang is getting more and more fancy and
|
libraries over decades, even though Golang is getting more and more fancy and
|
||||||
popular for developers. Additionally, nowadays developers are able to develop
|
popular for developers. Additionally, nowadays developers are able to develop
|
||||||
their aggregated-apiservers over SQL-storage and Java has way better support on SQLs.
|
their aggregated-apiservers over SQL-storage and Java has way better support on SQLs.
|
||||||
|
|
||||||
|
|
||||||
## How to use?
|
## How to use?
|
||||||
|
|
||||||
Take maven project as example, adding the following dependencies into your dependencies:
|
Take maven project as example, adding the following dependencies into your dependencies:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -56,8 +56,8 @@ Take maven project as example, adding the following dependencies into your depen
|
|||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
Then we can make use of the provided builder libraries to write your own controller.
|
Then we can make use of the provided builder libraries to write your own controller.
|
||||||
For example, the following one is a simple controller prints out node information
|
For example, the following one is a simple controller prints out node information
|
||||||
on watch notification, see complete example [here](https://github.com/kubernetes-client/java/blob/master/examples/src/main/java/io/kubernetes/client/examples/ControllerExample.java):
|
on watch notification, see complete example [here](https://github.com/kubernetes-client/java/blob/master/examples/src/main/java/io/kubernetes/client/examples/ControllerExample.java):
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@@ -81,14 +81,14 @@ on watch notification, see complete example [here](https://github.com/kubernetes
|
|||||||
.build();
|
.build();
|
||||||
```
|
```
|
||||||
|
|
||||||
If you notice, the new Java controller framework learnt a lot from the design of
|
If you notice, the new Java controller framework learnt a lot from the design of
|
||||||
[controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) which
|
[controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) which
|
||||||
successfully encapsulates the complex components inside controller into several
|
successfully encapsulates the complex components inside controller into several
|
||||||
clean interfaces. With the help of Java Generics, we even move on a bit and simply
|
clean interfaces. With the help of Java Generics, we even move on a bit and simply
|
||||||
the encapsulation in a better way.
|
the encapsulation in a better way.
|
||||||
|
|
||||||
As for more advanced usage, we can wrap multiple controllers into a controller-manager
|
As for more advanced usage, we can wrap multiple controllers into a controller-manager
|
||||||
or a leader-electing controller which helps deploying in HA setup. In a word, we can
|
or a leader-electing controller which helps deploying in HA setup. In a word, we can
|
||||||
basically find most of the equivalence implementations here from Golang SDK and
|
basically find most of the equivalence implementations here from Golang SDK and
|
||||||
more advanced features are under active development by us.
|
more advanced features are under active development by us.
|
||||||
|
|
||||||
@@ -96,7 +96,6 @@ more advanced features are under active development by us.
|
|||||||
|
|
||||||
The community behind the official Kubernetes Java SDK project will be focusing on
|
The community behind the official Kubernetes Java SDK project will be focusing on
|
||||||
providing more useful utilities for developers who hope to program cloud native
|
providing more useful utilities for developers who hope to program cloud native
|
||||||
Java applications to extend Kubernetes. If you are interested in more details,
|
Java applications to extend Kubernetes. If you are interested in more details,
|
||||||
please look at our repo [kubernetes-client/java](https://github.com/kubernetes-client/java).
|
please look at our repo [kubernetes-client/java](https://github.com/kubernetes-client/java).
|
||||||
Feel free to share also your feedback with us, through Issues or [Slack](http://kubernetes.slack.com/messages/kubernetes-client/).
|
Feel free to share also your feedback with us, through Issues or [Slack](http://kubernetes.slack.com/messages/kubernetes-client/).
|
||||||
|
|
||||||
Reference in New Issue
Block a user