Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(k8s): don't require username input when namespace is set #649

Merged
merged 1 commit into from
Mar 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions garden-service/src/plugins/kubernetes/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ async function prepareNamespaces({ ctx }: GetEnvironmentStatusParams) {
}

export async function getRemoteEnvironmentStatus({ ctx, log }: GetEnvironmentStatusParams) {
const k8sCtx = <KubernetesPluginContext>ctx
const loggedIn = await getLoginStatus({ ctx: k8sCtx, log })
const provider = <KubernetesProvider>ctx.provider
const loggedIn = await getLoginStatus({ ctx, log })

if (!loggedIn) {
if (!loggedIn && !provider.config.namespace) {
return {
ready: false,
needUserInput: true,
}
}

await prepareNamespaces({ ctx: k8sCtx, log })
await prepareNamespaces({ ctx, log })

const ready = (await checkTillerStatus(k8sCtx, k8sCtx.provider, log)) === "ready"
const ready = (await checkTillerStatus(ctx, provider, log)) === "ready"

// Note: We don't need the system namespaces for remote k8s for now

Expand Down Expand Up @@ -177,15 +177,13 @@ export async function getLocalEnvironmentStatus({ ctx, log }: GetEnvironmentStat
}

export async function prepareRemoteEnvironment({ ctx, log }: PrepareEnvironmentParams) {
const k8sCtx = <KubernetesPluginContext>ctx
const loggedIn = await getLoginStatus({ ctx: k8sCtx, log })
const provider = <KubernetesProvider>ctx.provider
const loggedIn = await getLoginStatus({ ctx, log })

if (!loggedIn) {
await login({ ctx: k8sCtx, log })
if (!loggedIn && !provider.config.namespace) {
await login({ ctx, log })
}

const provider = k8sCtx.provider

// Note: We don't need the system namespaces for remote k8s for now

// const api = new KubeApi(provider.config.context)
Expand All @@ -194,7 +192,7 @@ export async function prepareRemoteEnvironment({ ctx, log }: PrepareEnvironmentP
// await recreateSystemNamespaces(api, log)
// }

await installTiller(k8sCtx, provider, log)
await installTiller(ctx, provider, log)

return {}
}
Expand Down