Add runner version to status.

This commit is contained in:
Michael Lipp 2025-03-14 16:57:58 +01:00
parent f0ebea5353
commit 3a4404b758
3 changed files with 11 additions and 0 deletions

View file

@ -1470,6 +1470,10 @@ spec:
type: object
default: {}
properties:
runnerVersion:
description: >-
The version string of the runner.
type: string
cpus:
description: >-
Number of CPUs currently in use.

View file

@ -50,6 +50,9 @@ public class Constants {
* Status related constants.
*/
public static class Status {
/** The Constant RUNNER_VERSION. */
public static final String RUNNER_VERSION = "runnerVersion";
/** The Constant CPUS. */
public static final String CPUS = "cpus";

View file

@ -31,6 +31,7 @@ import io.kubernetes.client.openapi.JSON;
import io.kubernetes.client.openapi.models.EventsV1Event;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Optional;
import java.util.logging.Level;
import static org.jdrupes.vmoperator.common.Constants.APP_NAME;
import org.jdrupes.vmoperator.common.Constants.Crd;
@ -124,6 +125,9 @@ public class StatusUpdater extends VmDefUpdater {
observedGeneration = vmDef.getMetadata().getGeneration();
vmStub.updateStatus(from -> {
JsonObject status = from.statusJson();
status.addProperty(Status.RUNNER_VERSION, Optional.ofNullable(
Runner.class.getPackage().getImplementationVersion())
.orElse("(unknown)"));
status.remove(Status.LOGGED_IN_USER);
return status;
});