Harden service and volume naming migration

This commit is contained in:
Kasra Bigdeli
2026-07-18 22:27:22 -07:00
parent 7c7d2b33e2
commit e80dc6dd60
+14 -2
View File
@@ -26,7 +26,7 @@ import isValidPath = require('is-valid-path')
const APP_DEFINITIONS = 'appDefinitions'
function isNameAllowed(name: string) {
export function isNameAllowed(name: string) {
const isNameFormattingOk =
!!name &&
name.length < 50 &&
@@ -34,7 +34,11 @@ function isNameAllowed(name: string) {
/[a-z0-9]$/.test(name) &&
/^[a-z0-9\-]+$/.test(name) &&
name.indexOf('--') < 0
return isNameFormattingOk && ['captain', 'registry'].indexOf(name) < 0
return (
isNameFormattingOk &&
['captain', 'registry'].indexOf(name) < 0 &&
!name.startsWith('captain-')
)
}
/**
@@ -302,6 +306,14 @@ class AppsDataStore {
return `${appName}`
}
getVolumeName(volumeName: string, isLegacyVolumeName: boolean) {
if (isLegacyVolumeName) {
return `${this.namepace}--${volumeName}`
}
return volumeName
}
getAppDefinitions() {
const self = this
return new Promise<IAllAppDefinitions>(function (resolve, reject) {