Skip to content

Commit

Permalink
fix: use default namespace for cluster setup
Browse files Browse the repository at this point in the history
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
  • Loading branch information
leninmehedy committed Jan 22, 2024
1 parent b663d57 commit 214daba
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions fullstack-network-manager/src/commands/cluster.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class ClusterCommand extends BaseCommand {

// extract config values
const clusterName = self.configManager.getFlag(flags.clusterName)
const namespace = 'default' // we always install the shared component in default namespace
const namespace = argv.namespace || constants.DEFAULT_NAMESPACE
const chartDir = self.configManager.getFlag(flags.chartDirectory)
const deployPrometheusStack = self.configManager.getFlag(flags.deployPrometheusStack)
const deployMinio = self.configManager.getFlag(flags.deployMinio)
Expand Down Expand Up @@ -151,7 +151,7 @@ export class ClusterCommand extends BaseCommand {
task: async (ctx, task) => {
self.configManager.load(argv)
const clusterName = self.configManager.getFlag(flags.clusterName)
const namespace = self.configManager.getFlag(flags.namespace)
const namespace = argv.namespace || constants.DEFAULT_NAMESPACE

ctx.config = {
clusterName,
Expand Down
2 changes: 1 addition & 1 deletion fullstack-network-manager/src/commands/flags.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const namespace = {
name: 'namespace',
definition: {
describe: 'Namespace',
default: '',
default: constants.DEFAULT_NAMESPACE,
alias: 'n',
type: 'string'
}
Expand Down
18 changes: 15 additions & 3 deletions fullstack-network-manager/src/commands/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ export async function promptNamespaceArg (task, input) {
})
}

return input.replace('namespace/', '')
if (!input) {
throw new FullstackTestingError('namespace cannot be empty')
}

return input
} catch (e) {
throw new FullstackTestingError(`input failed: ${flags.namespace.name}`, e)
throw new FullstackTestingError(`input failed: ${flags.namespace.name}: ${e.message}`, e)
}
}

Expand All @@ -32,12 +36,16 @@ export async function promptSelectNamespaceArg (task, input, choices = []) {
choices: helpers.cloneArray(choices)
})

if (!input) {
throw new FullstackTestingError('namespace cannot be empty')
}

return input
}

return input
} catch (e) {
throw new FullstackTestingError(`input failed: ${flags.namespace.name}`, e)
throw new FullstackTestingError(`input failed: ${flags.namespace.name}: ${e.message}`, e)
}
}

Expand Down Expand Up @@ -78,6 +86,10 @@ export async function promptReleaseTag (task, input) {
})
}

if (!input) {
throw new FullstackTestingError('release-tag cannot be empty')
}

return input
} catch (e) {
throw new FullstackTestingError(`input failed: ${flags.releaseTag.name}`, e)
Expand Down
1 change: 1 addition & 0 deletions fullstack-network-manager/src/core/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const FST_LOGS_DIR = `${FST_HOME_DIR}/logs`
export const FST_CACHE_DIR = `${FST_HOME_DIR}/cache`
export const CLUSTER_NAME = 'kind-fst' // since by default we use kind to create cluster we use 'kind-' prefix
export const CONTEXT_NAME = CLUSTER_NAME // since by default we use kind to create cluster we use 'kind-' prefix
export const DEFAULT_NAMESPACE = 'default'
export const RELEASE_NAME = 'fst'
export const NAMESPACE_NAME = `fst-${USER_SANITIZED}`

Expand Down

0 comments on commit 214daba

Please sign in to comment.