Merge branch 'main' into testing

This commit is contained in:
Michael Lipp 2024-11-15 09:59:18 +01:00
commit d8132de6c2
2 changed files with 17 additions and 14 deletions

View file

@ -180,19 +180,7 @@ public class DisplaySecretMonitor
@SuppressWarnings("PMD.StringInstantiation") @SuppressWarnings("PMD.StringInstantiation")
public void onGetDisplaySecrets(GetDisplayPassword event, VmChannel channel) public void onGetDisplaySecrets(GetDisplayPassword event, VmChannel channel)
throws ApiException { throws ApiException {
ListOptions options = new ListOptions(); // Update console user in status
options.setLabelSelector("app.kubernetes.io/name=" + APP_NAME + ","
+ "app.kubernetes.io/component=" + COMP_DISPLAY_SECRET + ","
+ "app.kubernetes.io/instance="
+ event.vmDefinition().metadata().getName());
var stubs = K8sV1SecretStub.list(client(),
event.vmDefinition().namespace(), options);
if (stubs.isEmpty()) {
return;
}
var stub = stubs.iterator().next();
// Valid request, update console user in status
var vmStub = VmDefinitionStub.get(client(), var vmStub = VmDefinitionStub.get(client(),
new GroupVersionKind(VM_OP_GROUP, "", VM_OP_KIND_VM), new GroupVersionKind(VM_OP_GROUP, "", VM_OP_KIND_VM),
event.vmDefinition().namespace(), event.vmDefinition().name()); event.vmDefinition().namespace(), event.vmDefinition().name());
@ -202,6 +190,20 @@ public class DisplaySecretMonitor
return status; return status;
}); });
// Look for secret
ListOptions options = new ListOptions();
options.setLabelSelector("app.kubernetes.io/name=" + APP_NAME + ","
+ "app.kubernetes.io/component=" + COMP_DISPLAY_SECRET + ","
+ "app.kubernetes.io/instance="
+ event.vmDefinition().metadata().getName());
var stubs = K8sV1SecretStub.list(client(),
event.vmDefinition().namespace(), options);
if (stubs.isEmpty()) {
// No secret means no password for this VM wanted
return;
}
var stub = stubs.iterator().next();
// Check validity // Check validity
var model = stub.model().get(); var model = stub.model().get();
@SuppressWarnings("PMD.StringInstantiation") @SuppressWarnings("PMD.StringInstantiation")
@ -209,6 +211,7 @@ public class DisplaySecretMonitor
.get(DATA_PASSWORD_EXPIRY)).map(b -> new String(b)).orElse(null); .get(DATA_PASSWORD_EXPIRY)).map(b -> new String(b)).orElse(null);
if (model.getData().get(DATA_DISPLAY_PASSWORD) != null if (model.getData().get(DATA_DISPLAY_PASSWORD) != null
&& stillValid(expiry)) { && stillValid(expiry)) {
// Fixed secret, don't touch
event.setResult( event.setResult(
new String(model.getData().get(DATA_DISPLAY_PASSWORD))); new String(model.getData().get(DATA_DISPLAY_PASSWORD)));
return; return;

View file

@ -68,7 +68,7 @@
</tr> </tr>
<tr :id="scopedId(rowIndex)" v-if="$aash.isDisclosed(scopedId(rowIndex))" <tr :id="scopedId(rowIndex)" v-if="$aash.isDisclosed(scopedId(rowIndex))"
:class="[(rowIndex % 2) ? 'odd' : 'even']"> :class="[(rowIndex % 2) ? 'odd' : 'even']">
<td colspan="6" class="details"> <td colspan="8" class="details">
<table class="table--basic table--basic--autoStriped"> <table class="table--basic table--basic--autoStriped">
<tr> <tr>
<td>{{ localize("maximumCpus") }}</td> <td>{{ localize("maximumCpus") }}</td>