Skip to content

Commit

Permalink
Use project.id rather than name for PVC
Browse files Browse the repository at this point in the history
This is to stop people reusing the a project name and getting
access to an existing directory before it is deleted
  • Loading branch information
hardillb committed Jun 18, 2024
1 parent ddd6b24 commit 5da30bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kubernetes.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ const createPersistentVolumeClaim = async (project, options) => {
}

pvc.metadata.namespace = namespace
pvc.metadata.name = `${project.safeName}-pvc`
pvc.metadata.name = `${project.id}-pvc`
pvc.metadata.labels = {
name: project.safeName
'ff-project-id': project.id,
'ff-project-name': project.safeName
}
return pvc
}
Expand Down Expand Up @@ -856,7 +857,7 @@ module.exports = {
}
if (this._app.config.driver.options?.storage?.enabled) {
try {
await this._k8sApi.deleteNamespacedPersistentVolumeClaim(`${project.safeName}-pvc`, this._namespace)
await this._k8sApi.deleteNamespacedPersistentVolumeClaim(`${project.id}-pvc`, this._namespace)
} catch (err) {
this._app.log.error(`[k8s] Instance ${project.id} - error deleting PVC: ${err.toString()} ${err.statusCode}`)
// console.log(err)
Expand Down

0 comments on commit 5da30bc

Please sign in to comment.