sebastiandaschner news


saturday, may 06, 2023

Hi on that rainy Saturday morning and welcome to newsletter #71!

April brought us a new Quarkus release (version 3.0), some workshops that I could hold on the topic of Quarkus development, as well as and cloud and container technology, and the nicely organized GeeCON conference in Prague. May will be a bit more busy for me, starting next week, where I will speak at the JAX conference in Mainz, Germany, about developer productivity, and Quarkus. I’ll also give a presentation at the CNCF Meetup in Prague about databases in Kubernetes and StackGres, a few company-internal talks, and at the end of May, I’ll attend the Devoxx Poland conference. So, a month full of cool IT content ahead for me :)

 

What’s New

 

Updating Quarkus Projects to Version 3.0

At the end of April, Quarkus version 3.0 has been finalized and with it came the transition to Jakarta EE 10 and its jakarta. namespace. Migrating Quarkus projects to the latest version is thus not as easy as usual, where we mostly just had to update dependency versions.

Luckily, there is some tooling available, that take care of the updating process, including updating the version numbers. You can run one of the following approaches on a Quarkus project that doesn’t have the version 3.0 yet:

quarkus update --stream=3.0

mvn io.quarkus.platform:quarkus-maven-plugin:3.0.1.Final:update -N -Dstream=3.0

gradle -PquarkusPluginVersion=3.0.1.Final quarkusUpdate --stream=3.0

If you use Maven, I’d advise to go with the second, mvn command, since it doesn’t require any additional tooling.

I’ve also recorded a video in which I’m migrating one of my projects and am demontrating this tooling approach:

Updating Quarkus Projects to Version 3.0

 

How to Create a Quarkus Extension

Quarkus has a very active and expanding ecosystem with tons of extensions available. The chances that you’d need to extend what Quarkus provides for a regular enterprise project are rather low, but it’s still very interesting and insightful to see how Quarkus extensions, and the overall Quarkus build works internally.

For this reason, I’ve created a video that walks you through the steps of how to create your own Quarkus extension. The example that I’m showing is to integrate a Quarkus application with a hardware LED blink tool (blink(1)), that will display health information as well as give programmatic access via injectable bean.

I think this example demonstrates quite nicely how extensions allow to add additional beans, as well as custom configuration.

Have a look at the full video: How to Create a Quarkus Extension

Also I’m curious: did you ever have the need (or contemplated) to create your own Quarkus extension? Let me know.

 

Programmatically Listen to Test Results (Incl. Hardware LED)

Maybe you remember newsletter issue #69 in which I showed how to programmatically listen to JUnit test results via TestExecutionListener.

Using the same blink(1) LED hardware tool as in the Quarkus extension post, I’ve created an extreme feedback device example using that LED, which blinks green or red, depending on our test results. This is kind of cool to have for longer running tests so that we get notified about the result.

The code is very similar to what we had in our previous issue, but I think the video is still fun to watch: Programmatically Listen to Test Results (Incl. Hardware LED)

 

Display Kubernetes Secrets in One Command

A kubectl command option (or rather Go template) that I just recently learned about and wanted to share with you is how to retrieve Kubernetes secrets in plaintext. Previously, I would retrieve secret keys as follows:

kubectl get secrets my-secret --output yaml

apiVersion: v1
data:
  some-secret-key: dG9wX3NlY3JldF8xMjM=
kind: Secret
metadata:
  [...]

kubectl get secret my-secret --output yaml | yq '.data["some-secret-key"]'
"dG9wX3NlY3JldF8xMjM="

kubectl get secret my-secret --output yaml | yq -r '.data["some-secret-key"]'
dG9wX3NlY3JldF8xMjM=

kubectl get secret my-secret --output yaml | yq -r '.data["some-secret-key"]' | base64 -d
top_secret_123

You see that I piped the command into the yq and base64 tools.

It’s also possible to combine these into one command using Go templates:

kubectl get secret my-secret --template '{{ (index .data "some-secret-key" | base64decode) }}'
top_secret_123

This can be helpful in environments in which your other command line tooling might not be available.

 

Thanks a lot for reading and see you next time!

 

Did you like the content? You can subscribe to the newsletter for free: