quarkiverse / quarkus-operator-sdk

Quarkus Extension to create Kubernetes Operators in Java using the Java Operator SDK (https://github.com/java-operator-sdk/java-operator-sdk) project
Apache License 2.0
124 stars 51 forks source link
kubernetes operator quarkus-extension sdk

A Quarkus extension to write operators in Java

All Contributors

This extension integrates the Java Operator SDK project (JOSDK) with Quarkus, making it even easier to use both. We often refer to this extension as QOSDK for Quarkus extension for the java Operator SDK.

Getting started with QOSDK

Bootstrapping a project

The easiest way to get started with QOSDK is to use the quarkus CLI:

quarkus create app org.acme:qosdk-test -x='qosdk'
cd qosdk-test

Alternatively, you can use the Quarkus Maven plugin to bootstrap a project using the extension.

mvn io.quarkus.platform:quarkus-maven-plugin:3.9.4:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=qosdk-test \
    -Dextensions='qosdk'
cd qoskd-test

If you also want to use the OLM bundle generation extension, you can add the olm extension to the extension list as in:

quarkus create app org.acme:qosdk-test -x='qosdk,olm'

For reference, please refer to the Quarkus getting started guide.

Interactive operator development

The easiest way to iterate faster on developing your operator is to use the Quarkus Dev Mode to write your operator as it's running.

Start the dev mode (quarkus dev or mvn quarkus:dev). Once the QOSDK extension is installed for a project, you get access to dev mode commands provided by QOSDK to help you in moving faster. In the dev mode console, press : (column), you'll get a terminal prompt. If you then press tab, you'll see a list of available commands, among which should be one named qosdk, which, in turn, provides several sub-commands (versions and api at this time).

You can type qosdk api --help or qosdk versions --help to get more information about these commands.

The qosdk api command helps you quickly add a custom resource (an API in Kubernetes parlance) along with associated spec, status and reconciler classes while your operator is running.

Documentation

To go deeper on what you can accomplish with QOSDK and JOSDK, please read the blog series that we wrote on how to write operators in Java with Quarkus. Note, however, that some information might be outdated since this series was written a while ago. It should still provide a good idea of what can be achieved.

Please also refer to the JOSDK documentation for more details.

You can also take a look at the samples to get quickly started using examples.

QOSDK Documentation

Maintaining the documentation

The documentation for this extension should be maintained as part of this repository and it is stored in the docs/ directory.

The layout should follow the Antora's Standard File and Directory Set .

Once the docs are ready to be published, please open a PR including this repository in the Quarkiverse Docs Antora playbook . See an example here.

Releasing

Follow the Quarkiverse release process.

Snapshots

A snapshot is generated each time the main or next branches are changed. To be able to use the snapshots, please add the following repository definition to your POM file (in the repositories section) or, preferably, to your settings.xml file:


<repositories>
    ...
    <repository>
        <id>s01.oss.sonatype</id>
        <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Chris Laprun

💻 🚧

Sébastien CROCQUESEL

💻

Jose Carvajal

💻 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!