Merge branch 'feature/vm-info'
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
This commit is contained in:
commit
a3d6db3178
12 changed files with 42 additions and 15 deletions
|
|
@ -1470,6 +1470,10 @@ spec:
|
||||||
type: object
|
type: object
|
||||||
default: {}
|
default: {}
|
||||||
properties:
|
properties:
|
||||||
|
runnerVersion:
|
||||||
|
description: >-
|
||||||
|
The version string of the runner.
|
||||||
|
type: string
|
||||||
cpus:
|
cpus:
|
||||||
description: >-
|
description: >-
|
||||||
Number of CPUs currently in use.
|
Number of CPUs currently in use.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ apiVersion: "vmoperator.jdrupes.org/v1"
|
||||||
kind: VirtualMachine
|
kind: VirtualMachine
|
||||||
metadata:
|
metadata:
|
||||||
namespace: vmop-dev
|
namespace: vmop-dev
|
||||||
name: test-vm<%= ${number} %>
|
name: test-vm<%= $(printf "%02d" ${number}) %>
|
||||||
annotations:
|
annotations:
|
||||||
argocd.argoproj.io/sync-wave: "20"
|
argocd.argoproj.io/sync-wave: "20"
|
||||||
|
|
||||||
|
|
@ -13,6 +13,9 @@ spec:
|
||||||
# source: docker-registry.lan.mnl.de/vmoperator/org.jdrupes.vmoperator.runner.qemu-arch:latest
|
# source: docker-registry.lan.mnl.de/vmoperator/org.jdrupes.vmoperator.runner.qemu-arch:latest
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
|
|
||||||
|
runnerTemplate:
|
||||||
|
update: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
- role: admin
|
- role: admin
|
||||||
may:
|
may:
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ public class Constants {
|
||||||
* Status related constants.
|
* Status related constants.
|
||||||
*/
|
*/
|
||||||
public static class Status {
|
public static class Status {
|
||||||
|
/** The Constant RUNNER_VERSION. */
|
||||||
|
public static final String RUNNER_VERSION = "runnerVersion";
|
||||||
|
|
||||||
/** The Constant CPUS. */
|
/** The Constant CPUS. */
|
||||||
public static final String CPUS = "cpus";
|
public static final String CPUS = "cpus";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,9 @@ public abstract class AbstractMonitor<O extends KubernetesObject,
|
||||||
new K8sObserver<>(objectClass, objectListClass, client,
|
new K8sObserver<>(objectClass, objectListClass, client,
|
||||||
K8s.preferred(context, version), namespace, options)
|
K8s.preferred(context, version), namespace, options)
|
||||||
.handler((c, r) -> {
|
.handler((c, r) -> {
|
||||||
|
logger.fine(() -> "Resource " + context.getKind()
|
||||||
|
+ "/" + r.object.getMetadata().getName() + " "
|
||||||
|
+ r.type);
|
||||||
handleChange(c, r);
|
handleChange(c, r);
|
||||||
}).onTerminated((o, t) -> {
|
}).onTerminated((o, t) -> {
|
||||||
if (observerCounter.decrementAndGet() == 0) {
|
if (observerCounter.decrementAndGet() == 0) {
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create pod. First combine template and data and parse result
|
// Create pod. First combine template and data and parse result
|
||||||
|
logger.fine(() -> "Create/update pod " + podStub.name());
|
||||||
var fmTemplate = fmConfig.getTemplate("runnerPod.ftl.yaml");
|
var fmTemplate = fmConfig.getTemplate("runnerPod.ftl.yaml");
|
||||||
StringWriter out = new StringWriter();
|
StringWriter out = new StringWriter();
|
||||||
fmTemplate.process(model, out);
|
fmTemplate.process(model, out);
|
||||||
|
|
|
||||||
|
|
@ -215,8 +215,6 @@ public class Reconciler extends Component {
|
||||||
throws ApiException, TemplateException, IOException {
|
throws ApiException, TemplateException, IOException {
|
||||||
// Ownership relationships takes care of deletions
|
// Ownership relationships takes care of deletions
|
||||||
if (event.type() == K8sObserver.ResponseType.DELETED) {
|
if (event.type() == K8sObserver.ResponseType.DELETED) {
|
||||||
logger.fine(
|
|
||||||
() -> "VM \"" + event.vmDefinition().name() + "\" deleted");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,13 +205,13 @@ public class VmMonitor extends
|
||||||
= K8sV1PodStub.list(client, namespace(), podSearch);
|
= K8sV1PodStub.list(client, namespace(), podSearch);
|
||||||
for (var podStub : podList) {
|
for (var podStub : podList) {
|
||||||
var nodeName = podStub.model().get().getSpec().getNodeName();
|
var nodeName = podStub.model().get().getSpec().getNodeName();
|
||||||
logger.fine(() -> "Adding node name " + nodeName
|
logger.finer(() -> "Adding node name " + nodeName
|
||||||
+ " to VM info for " + vmDef.name());
|
+ " to VM info for " + vmDef.name());
|
||||||
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
||||||
var addrs = new ArrayList<String>();
|
var addrs = new ArrayList<String>();
|
||||||
podStub.model().get().getStatus().getPodIPs().stream()
|
podStub.model().get().getStatus().getPodIPs().stream()
|
||||||
.map(ip -> ip.getIp()).forEach(addrs::add);
|
.map(ip -> ip.getIp()).forEach(addrs::add);
|
||||||
logger.fine(() -> "Adding node addresses " + addrs
|
logger.finer(() -> "Adding node addresses " + addrs
|
||||||
+ " to VM info for " + vmDef.name());
|
+ " to VM info for " + vmDef.name());
|
||||||
extra.nodeInfo(nodeName, addrs);
|
extra.nodeInfo(nodeName, addrs);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import io.kubernetes.client.openapi.JSON;
|
||||||
import io.kubernetes.client.openapi.models.EventsV1Event;
|
import io.kubernetes.client.openapi.models.EventsV1Event;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import static org.jdrupes.vmoperator.common.Constants.APP_NAME;
|
import static org.jdrupes.vmoperator.common.Constants.APP_NAME;
|
||||||
import org.jdrupes.vmoperator.common.Constants.Crd;
|
import org.jdrupes.vmoperator.common.Constants.Crd;
|
||||||
|
|
@ -124,6 +125,9 @@ public class StatusUpdater extends VmDefUpdater {
|
||||||
observedGeneration = vmDef.getMetadata().getGeneration();
|
observedGeneration = vmDef.getMetadata().getGeneration();
|
||||||
vmStub.updateStatus(from -> {
|
vmStub.updateStatus(from -> {
|
||||||
JsonObject status = from.statusJson();
|
JsonObject status = from.statusJson();
|
||||||
|
status.addProperty(Status.RUNNER_VERSION, Optional.ofNullable(
|
||||||
|
Runner.class.getPackage().getImplementationVersion())
|
||||||
|
.orElse("(unknown)"));
|
||||||
status.remove(Status.LOGGED_IN_USER);
|
status.remove(Status.LOGGED_IN_USER);
|
||||||
return status;
|
return status;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -127,15 +127,16 @@
|
||||||
><span>{{ cic.error }}</span></form></td>
|
><span>{{ cic.error }}</span></form></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table class="table--basic table--basic--autoStriped">
|
<p>
|
||||||
<tr>
|
<template v-if="entry.status?.runnerVersion">
|
||||||
<td colspan="2">{{ entry.status?.osinfo?.["pretty-name"] || "" }}</td>
|
{{ localize("runnerVersion") }}:
|
||||||
</tr>
|
{{ entry.status.runnerVersion }}<br></template>
|
||||||
<tr>
|
<template v-if="entry.status?.osinfo">
|
||||||
<td>{{ localize("usedFrom") }}</td>
|
{{ localize("guestOs") }}:
|
||||||
<td>{{ entry.usedFrom }}</td>
|
{{ entry.status?.osinfo?.["pretty-name"] || "" }}<br></template>
|
||||||
</tr>
|
<template v-if="entry.usedFrom">{{ localize("usedFrom") }}:
|
||||||
</table>
|
{{ entry.usedFrom }}<br></template>
|
||||||
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,14 @@ VMsSummary = VMs (running/total)
|
||||||
assignedTo = Assigned to
|
assignedTo = Assigned to
|
||||||
currentCpus = Current CPUs
|
currentCpus = Current CPUs
|
||||||
currentRam = Current RAM
|
currentRam = Current RAM
|
||||||
|
guestOs = Guest OS
|
||||||
maximumCpus = Maximum CPUs
|
maximumCpus = Maximum CPUs
|
||||||
maximumRam = Maximum RAM
|
maximumRam = Maximum RAM
|
||||||
notInUse = Currently closed
|
notInUse = Currently closed
|
||||||
nodeName = Node
|
nodeName = Node
|
||||||
requestedCpus = Requested CPUs
|
requestedCpus = Requested CPUs
|
||||||
requestedRam = Requested RAM
|
requestedRam = Requested RAM
|
||||||
|
runnerVersion = Runner version
|
||||||
running = Running
|
running = Running
|
||||||
since = Since
|
since = Since
|
||||||
usedBy = Used by
|
usedBy = Used by
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,14 @@ Last\ day = Letzter Tag
|
||||||
assignedTo = Zugewiesen an
|
assignedTo = Zugewiesen an
|
||||||
currentCpus = Aktuelle CPUs
|
currentCpus = Aktuelle CPUs
|
||||||
currentRam = Akuelles RAM
|
currentRam = Akuelles RAM
|
||||||
|
guestOs = Gast BS
|
||||||
maximumCpus = Maximale CPUs
|
maximumCpus = Maximale CPUs
|
||||||
maximumRam = Maximales RAM
|
maximumRam = Maximales RAM
|
||||||
nodeName = Knoten
|
nodeName = Knoten
|
||||||
notInUse = Derzeit geschlossen
|
notInUse = Derzeit geschlossen
|
||||||
requestedCpus = Angeforderte CPUs
|
requestedCpus = Angeforderte CPUs
|
||||||
requestedRam = Angefordertes RAM
|
requestedRam = Angefordertes RAM
|
||||||
|
runnerVersion = Runner-Version
|
||||||
running = Gestartet
|
running = Gestartet
|
||||||
since = Seit
|
since = Seit
|
||||||
usedBy = Benutzt durch
|
usedBy = Benutzt durch
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
|
||||||
table {
|
table {
|
||||||
display: inline;
|
display: inline-block;
|
||||||
|
|
||||||
td:nth-child(2) {
|
td:nth-child(2) {
|
||||||
min-width: 7em;
|
min-width: 7em;
|
||||||
|
|
@ -97,6 +97,12 @@
|
||||||
color: var(--danger);
|
color: var(--danger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0.25rem 0.5rem 0.25rem 0.5rem;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue