From e80dc6dd60643908e1049ca0fe7587422397099a Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Sat, 18 Jul 2026 22:27:22 -0700 Subject: [PATCH] Harden service and volume naming migration --- src/datastore/AppsDataStore.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/datastore/AppsDataStore.ts b/src/datastore/AppsDataStore.ts index 654c03a..6351fee 100644 --- a/src/datastore/AppsDataStore.ts +++ b/src/datastore/AppsDataStore.ts @@ -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(function (resolve, reject) {