Skip to content

Commit

Permalink
feat(k8s): allow specifying namespace to deploy to
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Aug 8, 2018
1 parent 49f83e4 commit 0aebc2b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion garden-cli/src/plugins/kubernetes/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
ProviderConfig,
providerConfigBase,
} from "../../types/project"

import {
configureEnvironment,
deleteConfig,
Expand Down Expand Up @@ -48,6 +47,7 @@ export interface KubernetesConfig extends ProviderConfig {
ingressPort: number
ingressClass: string
forceSsl: boolean
namespace?: string
defaultUsername?: string
}

Expand All @@ -64,6 +64,11 @@ const kubernetesConfigBase = providerConfigBase
.description("The external hostname of the cluster's ingress controller."),
defaultUsername: joiIdentifier()
.description("Set a default username (used for namespacing within a cluster)."),
namespace: Joi.string()
.description(
"Specify which namespace to deploy services to (auto-generated by default). " +
"Note that the framework generates other namespaces as well with this name as a prefix.",
),
})

const configSchema = kubernetesConfigBase
Expand Down
4 changes: 2 additions & 2 deletions garden-cli/src/plugins/kubernetes/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export async function ensureNamespace(context: string, namespace: string) {
export async function getNamespace(ctx: PluginContext, provider: KubernetesProvider, suffix?: string) {
let namespace

if (isSystemGarden(provider)) {
namespace = GARDEN_SYSTEM_NAMESPACE
if (provider.config.namespace) {
namespace = provider.config.namespace
} else {
const localConfig = await ctx.localConfigStore.get()
const k8sConfig = localConfig.kubernetes || {}
Expand Down
1 change: 1 addition & 0 deletions garden-cli/src/plugins/kubernetes/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export async function getSystemGarden(provider: KubernetesProvider): Promise<Gar
{
name: "local-kubernetes",
context: provider.config.context,
namespace: GARDEN_SYSTEM_NAMESPACE,
_system: systemSymbol,
},
],
Expand Down

0 comments on commit 0aebc2b

Please sign in to comment.