From ba4b3fe2e7dc6f124ef8856896a1b90a4e0578b8 Mon Sep 17 00:00:00 2001 From: Aviv Turgeman Date: Mon, 16 Sep 2024 13:11:53 +0300 Subject: [PATCH] CNV-47291: public ssh key credential does not get created Signed-off-by: Aviv Turgeman --- .../TemplatesCatalogDrawer/hooks/useCreateDrawerForm.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/views/catalog/templatescatalog/components/TemplatesCatalogDrawer/hooks/useCreateDrawerForm.tsx b/src/views/catalog/templatescatalog/components/TemplatesCatalogDrawer/hooks/useCreateDrawerForm.tsx index 7d1d441bc..074d25f74 100644 --- a/src/views/catalog/templatescatalog/components/TemplatesCatalogDrawer/hooks/useCreateDrawerForm.tsx +++ b/src/views/catalog/templatescatalog/components/TemplatesCatalogDrawer/hooks/useCreateDrawerForm.tsx @@ -13,9 +13,11 @@ import { } from '@kubevirt-ui/kubevirt-api/console'; import VirtualMachineModel from '@kubevirt-ui/kubevirt-api/console/models/VirtualMachineModel'; import { updateCloudInitRHELSubscription } from '@kubevirt-utils/components/CloudinitModal/utils/cloudinit-utils'; +import { SecretSelectionOption } from '@kubevirt-utils/components/SSHSecretModal/utils/types'; import { addSecretToVM, applyCloudDriveCloudInitVolume, + createSSHSecret, } from '@kubevirt-utils/components/SSHSecretModal/utils/utils'; import { logTemplateFlowEvent } from '@kubevirt-utils/extensions/telemetry/telemetry'; import { @@ -154,6 +156,11 @@ const useCreateDrawerForm = ( vm: getTemplateVirtualMachineObject(processedTemplate), }), }); + + if (sshDetails?.secretOption === SecretSelectionOption.addNew) { + await createSSHSecret(sshDetails?.sshPubKey, sshDetails?.sshSecretName, namespace); + } + setIsQuickCreating(false); navigate(getResourceUrl({ model: VirtualMachineModel, resource: quickCreatedVM })); logTemplateFlowEvent(CREATE_VM_SUCCEEDED, templateToProcess);