Skip to content

Commit

Permalink
fix(k8s): attempt to fix issues with helm release upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Oct 8, 2018
1 parent 082964c commit 4ec63b7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions garden-service/src/plugins/kubernetes/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const helmHandlers: Partial<ModuleAndServiceActions<HelmModule>> = {
getServiceStatus,

async deployService(
{ ctx, module, service, logEntry }: DeployServiceParams<HelmModule>,
{ ctx, module, service, logEntry, force }: DeployServiceParams<HelmModule>,
): Promise<ServiceStatus> {
const provider = ctx.provider
const chartPath = await getChartPath(module)
Expand All @@ -147,20 +147,29 @@ export const helmHandlers: Partial<ModuleAndServiceActions<HelmModule>> = {
const releaseStatus = await getReleaseStatus(ctx.provider, releaseName, logEntry)

if (releaseStatus.state === "missing") {
await helm(provider, logEntry,
const installArgs = [
"install", chartPath,
"--name", releaseName,
"--namespace", namespace,
"--values", valuesPath,
"--wait",
)
]
if (force) {
installArgs.push("--replace")
}
await helm(provider, logEntry, ...installArgs)
} else {
await helm(provider, logEntry,
const upgradeArgs = [
"upgrade", releaseName, chartPath,
"--install",
"--namespace", namespace,
"--values", valuesPath,
"--wait",
)
]
if (force) {
upgradeArgs.push("--force")
}
await helm(provider, logEntry, ...upgradeArgs)
}

const objects = await getChartObjects(ctx, service, logEntry)
Expand Down

0 comments on commit 4ec63b7

Please sign in to comment.