Skip to content

Commit

Permalink
Fix backup/restore CRDs creation (#1277)
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <[email protected]>
  • Loading branch information
mmorhun authored Jun 4, 2021
1 parent 82957d1 commit e8ca8a8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/tasks/installers/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,31 @@ export class OperatorTasks {
task: async (ctx: any, task: any) => {
const backupCrdExist = await kube.getCrd(this.cheClusterBackupCrd)
const restoreCrdExist = await kube.getCrd(this.cheClusterRestoreCrd)
if (!backupCrdExist || !restoreCrdExist) {
task.title = `${task.title}...skipped.`
if (backupCrdExist && restoreCrdExist) {
task.title = `${task.title}...already exist.`
return
}

let done = false
const [backupCrdFileName, restoreCrdFileName] = await this.getBackupRestoreCrdFilesNames(kube)
const backupCrdPath = path.join(ctx.resourcesPath, 'crds', backupCrdFileName)
if (!backupCrdExist && fs.existsSync(backupCrdPath)) {
await kube.createCrdFromFile(backupCrdPath)
done = true
}

const restoreCrdPath = path.join(ctx.resourcesPath, 'crds', restoreCrdFileName)
if (!restoreCrdExist && fs.existsSync(restoreCrdPath)) {
await kube.createCrdFromFile(restoreCrdPath)
done = true
}

if (done) {
task.title = `${task.title}...done.`
} else {
task.title = `${task.title}...skipped.`
}

task.title = `${task.title}...done.`
}
},
{
Expand Down

0 comments on commit e8ca8a8

Please sign in to comment.