Getting started with Java Kubernetes Operators.
Java-Operator-Sample is a Kubernetes operator written in Java that automates the management of ConfigMaps. This operator monitors Custom Resources (CR) and dynamically updates a ConfigMap with data specified in the CR. By leveraging the Kubernetes API, Java-Operator-Sample ensures that your configuration data is always in sync, simplifying the management of application configurations within your Kubernetes cluster.
Moreover, several Go projects aim to make the Operator writing process easy:
operator-sdk
and its command line tool help developers get started fasterclient-go
facilitates programmatic interactions with the Kubernetes API serverapimachinery
andcontroller-runtime
offer useful utilities and patterns
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Kubectl Version: v1.29.1
- Kind Version 0.22.0
- Docker Version 25.0.3
- Helm v3.15.2
- Go Version go1.22.4
bootstrap the project :
mvn io.javaoperatorsdk:bootstrapper:[version]:create -DprojectGroupId=org.acme -DprojectArtifactId=getting-started
start the operator in your local cluster:
mvn exec:java -Dexec.mainClass="org.acme.Runner"
For the automated tests, we implemented some unit tests just for the sake of example:
mvn test
You can run this integration test to verify that your operator meets the requirements:
mvn verify
After deploy, you need only to edit the custom resources manifest.
Just run the following command :)
make deploy
- @Malek-Zaag - Idea & Initial work
The project was an extension of java-opertar-sdk.
- Hat tip to anyone whose code was used
- Inspiration
- References