Skip to content

Commit ce20d5c

Browse files
Wulf ThimmWulf Thimm
Wulf Thimm
authored and
Wulf Thimm
committed
fixed clean-slate-deployment of VMs
1 parent d2913ae commit ce20d5c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.werft/jobs/build/prepare.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ function configureCoreDevAccess() {
6363
}
6464

6565
function decideHarvesterVMCreation(werft: Werft, config: JobConfig) {
66-
if (config.withVM && !VM.vmExists({ name: config.previewEnvironment.destname })) {
66+
const namespace = "preview-" + config.previewEnvironment.destname
67+
if (config.withVM && !VM.vmExists({ name: namespace })) {
6768
prepareVM(werft, config)
6869
} else {
6970
werft.currentPhaseSpan.setAttribute("werft.harvester.created_vm", false)
@@ -76,6 +77,7 @@ function prepareVM(werft: Werft, config: JobConfig) {
7677
werft.log(prepareSlices.BOOT_VM, "Cleaning previously created VM")
7778
VM.deleteVM({ name: config.previewEnvironment.destname })
7879
}
80+
werft.log(prepareSlices.BOOT_VM, "Creating VM")
7981
createVM(werft, config, prepareSlices.BOOT_VM)
8082
}
8183

.werft/vm/vm.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ export function startVM(options: { name: string }) {
114114
* @returns true if the VM already exists
115115
*/
116116
export function vmExists(options: { name: string }) {
117-
const namespace = `preview-${options.name}`
118-
const status = exec(`kubectl --kubeconfig ${KUBECONFIG_PATH} -n ${namespace} get vmi ${options.name}`, { dontCheckRc: true, silent: true })
117+
const status = exec(`kubectl --kubeconfig ${KUBECONFIG_PATH} -n preview-${options.name} get vmi ${options.name}`, { dontCheckRc: true, silent: true })
119118
return status.code == 0
120119
}
121120

0 commit comments

Comments
 (0)