From 1b1e5ffb8c1462073e7f3c878507233d2af27f06 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Fri, 14 Mar 2025 21:16:01 +0100 Subject: [PATCH 1/3] Reduce default logging. --- .../org/jdrupes/vmoperator/manager/logging.properties | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/logging.properties b/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/logging.properties index 9e6d0f5..2a16af6 100644 --- a/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/logging.properties +++ b/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/logging.properties @@ -1,6 +1,6 @@ # # VM-Operator -# Copyright (C) 2023 Michael N. Lipp +# Copyright (C) 2025 Michael N. Lipp # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -19,10 +19,7 @@ handlers=java.util.logging.ConsoleHandler, \ org.jgrapes.webconlet.logviewer.LogViewerHandler -org.jgrapes.level=FINE -org.jgrapes.core.handlerTracking.level=FINER - -org.jdrupes.vmoperator.manager.level=FINE +org.jdrupes.vmoperator.level=FINE java.util.logging.ConsoleHandler.level=ALL java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter From dc228295d177c7f7e2eb0576b593ff352b100ca7 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Sat, 15 Mar 2025 11:25:13 +0100 Subject: [PATCH 2/3] Update. --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e9eeb5e..09fcd25 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,23 @@ ![Latest Manager](https://img.shields.io/github/v/tag/mnlipp/vm-operator?filter=manager*&label=latest) ![Latest Runner](https://img.shields.io/github/v/tag/mnlipp/vm-operator?filter=runner-qemu*&label=latest) -# Run Qemu in Kubernetes Pods +# Run QEMU/KVM in Kubernetes Pods -The goal of this project is to provide simply to use and flexible components -for running Qemu based VMs in Kubernetes pods. +![Overview picture](webpages/index-pic.svg) + +This project provides an easy to use and flexible solution for running +QEMU/KVM based VMs in Kubernetes pods. + +The central component of this solution is the kubernetes operator that +manages "runners". These run in pods and are used to start and manage +the QEMU/KVM process for the VMs (optionally together with a SW-TPM). + +A web GUI for administrators provides an overview of the VMs together +with some basic control over the VMs. A web GUI for users provides an +interface to access and optionally start, stop and reset the VMs. + +Advanced features of the operator include pooling of VMs and automatic +login. See the [project's home page](https://vm-operator.jdrupes.org/) for details. From 5309460fbf6da606a505d7174e9ff285c12b5df9 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Sat, 15 Mar 2025 12:33:20 +0100 Subject: [PATCH 3/3] Prevent update of lastTransitionTime if we have no transition. --- .../vmoperator/runner/qemu/VmDefUpdater.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/VmDefUpdater.java b/org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/VmDefUpdater.java index 4c64ff1..49c9e67 100644 --- a/org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/VmDefUpdater.java +++ b/org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/VmDefUpdater.java @@ -125,16 +125,19 @@ public class VmDefUpdater extends Component { protected JsonObject updateCondition(VmDefinition from, String type, boolean state, String reason, String message) { JsonObject status = from.statusJson(); - // Optimize, as we can get this several times + // Avoid redundant updates, as this may be called several times var current = status.getAsJsonArray("conditions").asList().stream() .map(cond -> (JsonObject) cond) .filter(cond -> type.equals(cond.get("type").getAsString())) .findFirst(); - if (current.isPresent() - && current.map(c -> c.get("status").getAsString()) - .map("True"::equals).map(s -> s == state).orElse(false) + var stateUnchanged = current.map(c -> c.get("status").getAsString()) + .map("True"::equals).map(s -> s == state).orElse(false); + if (stateUnchanged && current.map(c -> c.get("reason").getAsString()) - .map(reason::equals).orElse(false)) { + .map(reason::equals).orElse(false) + && current.map(c -> c.get("observedGeneration").getAsLong()) + .map(from.getMetadata().getGeneration()::equals) + .orElse(false)) { return status; } @@ -143,7 +146,9 @@ public class VmDefUpdater extends Component { "status", state ? "True" : "False", "observedGeneration", from.getMetadata().getGeneration(), "reason", reason, - "lastTransitionTime", Instant.now().toString())); + "lastTransitionTime", stateUnchanged + ? current.get().get("lastTransitionTime").getAsString() + : Instant.now().toString())); if (message != null) { condition.put("message", message); }