diff --git a/core/src/plugins/kubernetes/helm/config.ts b/core/src/plugins/kubernetes/helm/config.ts index 09b37f8db4..d066860ba1 100644 --- a/core/src/plugins/kubernetes/helm/config.ts +++ b/core/src/plugins/kubernetes/helm/config.ts @@ -22,7 +22,7 @@ import type { DeployAction, DeployActionConfig } from "../../../actions/deploy.j import { dedent, deline } from "../../../util/string.js" import type { KubernetesLocalModeSpec } from "../local-mode.js" import { kubernetesLocalModeSchema } from "../local-mode.js" -import type { RunActionConfig, RunAction } from "../../../actions/run.js" +import type { RunAction, RunActionConfig } from "../../../actions/run.js" import type { TestAction, TestActionConfig } from "../../../actions/test.js" import type { ObjectSchema } from "@hapi/joi" import type { KubernetesRunOutputs } from "../kubernetes-type/config.js" @@ -165,17 +165,15 @@ const helmChartSpecSchema = () => ` ) +export const defaultHelmAtomicFlag = false +export const defaultHelmAtomicFlagDesc = `Whether to set the --atomic flag during installs and upgrades. Set to true if you'd like the changes applied to be reverted on failure. Set to false if e.g. you want to see more information about failures and then manually roll back, instead of having Helm do it automatically on failure.` + export const helmDeploySchema = () => joi .object() .keys({ ...helmCommonSchemaKeys(), - atomic: joi - .boolean() - .default(false) - .description( - "Whether to set the --atomic flag during installs and upgrades. Set to true if you'd like the changes applied to be reverted on failure." - ), + atomic: joi.boolean().default(defaultHelmAtomicFlag).description(defaultHelmAtomicFlagDesc), chart: helmChartSpecSchema(), defaultTarget: defaultTargetSchema(), sync: kubernetesDeploySyncSchema(), diff --git a/core/src/plugins/kubernetes/helm/module-config.ts b/core/src/plugins/kubernetes/helm/module-config.ts index bd7c2b3be4..1db3adf57f 100644 --- a/core/src/plugins/kubernetes/helm/module-config.ts +++ b/core/src/plugins/kubernetes/helm/module-config.ts @@ -34,8 +34,16 @@ import { runPodSpecIncludeFields } from "../run.js" import { omit } from "lodash-es" import type { KubernetesModuleDevModeSpec } from "../sync.js" import { kubernetesModuleSyncSchema } from "../sync.js" -import { helmChartNameSchema, helmChartRepoSchema, helmChartVersionSchema, helmCommonSchemaKeys } from "./config.js" +import { + defaultHelmAtomicFlag, + defaultHelmAtomicFlagDesc, + helmChartNameSchema, + helmChartRepoSchema, + helmChartVersionSchema, + helmCommonSchemaKeys, +} from "./config.js" import fsExtra from "fs-extra" + const { pathExists } = fsExtra import { helmChartYamlFilename } from "./common.js" import type { KubernetesLocalModeSpec } from "../local-mode.js" @@ -128,12 +136,7 @@ export const helmModuleSpecSchema = () => .object() .keys({ ...helmCommonSchemaKeys(), - atomicInstall: joi - .boolean() - .default(true) - .description( - "Whether to set the --atomic flag during installs and upgrades. Set to false if e.g. you want to see more information about failures and then manually roll back, instead of having Helm do it automatically on failure." - ), + atomicInstall: joi.boolean().default(defaultHelmAtomicFlag).description(defaultHelmAtomicFlagDesc), base: joiUserIdentifier() .description( deline`The name of another \`helm\` module to use as a base for this one. Use this to re-use a Helm chart across diff --git a/core/test/integ/src/plugins/kubernetes/helm/config.ts b/core/test/integ/src/plugins/kubernetes/helm/config.ts index 7ff947bc63..73f67105f6 100644 --- a/core/test/integ/src/plugins/kubernetes/helm/config.ts +++ b/core/test/integ/src/plugins/kubernetes/helm/config.ts @@ -26,6 +26,7 @@ import { GardenApiVersion, } from "../../../../../../src/constants.js" import { ValidateCommand } from "../../../../../../src/commands/validate.js" +import { defaultHelmAtomicFlag } from "../../../../../../src/plugins/kubernetes/helm/config.js" describe("configureHelmModule", () => { let garden: TestGarden @@ -52,11 +53,10 @@ describe("configureHelmModule", () => { const module = await garden.resolveModule("api-module") const graph = await garden.getConfigGraph({ log: garden.log, emit: false }) const imageModule = graph.getModule("api-image") - const imageVersion = imageModule.version.versionString - const spec = { - atomicInstall: true, + const expectedSpec = { + atomicInstall: defaultHelmAtomicFlag, build: { dependencies: [], timeout: DEFAULT_BUILD_TIMEOUT_SEC, @@ -115,7 +115,7 @@ describe("configureHelmModule", () => { name: "api-module", path: resolve(ctx.projectRoot, "api"), repositoryUrl: undefined, - buildConfig: omit(spec, ["atomicInstall", "serviceResource", "skipDeploy", "tasks", "tests"]), + buildConfig: omit(expectedSpec, ["atomicInstall", "serviceResource", "skipDeploy", "tasks", "tests"]), serviceConfigs: [ { name: "api-module", @@ -123,10 +123,10 @@ describe("configureHelmModule", () => { disabled: false, sourceModuleName: "api-image", timeout: DEFAULT_DEPLOY_TIMEOUT_SEC, - spec, + spec: expectedSpec, }, ], - spec, + spec: expectedSpec, testConfigs: [], type: "helm", taskConfigs: [], diff --git a/docs/reference/action-types/Deploy/helm.md b/docs/reference/action-types/Deploy/helm.md index 6cf7984fa4..c86c50df6e 100644 --- a/docs/reference/action-types/Deploy/helm.md +++ b/docs/reference/action-types/Deploy/helm.md @@ -363,7 +363,7 @@ this action config's directory. [spec](#spec) > atomic -Whether to set the --atomic flag during installs and upgrades. Set to true if you'd like the changes applied to be reverted on failure. +Whether to set the --atomic flag during installs and upgrades. Set to true if you'd like the changes applied to be reverted on failure. Set to false if e.g. you want to see more information about failures and then manually roll back, instead of having Helm do it automatically on failure. | Type | Default | Required | | --------- | ------- | -------- | diff --git a/docs/reference/module-types/helm.md b/docs/reference/module-types/helm.md index 752c7e65c3..8b6621726c 100644 --- a/docs/reference/module-types/helm.md +++ b/docs/reference/module-types/helm.md @@ -219,9 +219,10 @@ values: {} # this action config's directory. valueFiles: [] -# Whether to set the --atomic flag during installs and upgrades. Set to false if e.g. you want to see more information -# about failures and then manually roll back, instead of having Helm do it automatically on failure. -atomicInstall: true +# Whether to set the --atomic flag during installs and upgrades. Set to true if you'd like the changes applied to be +# reverted on failure. Set to false if e.g. you want to see more information about failures and then manually roll +# back, instead of having Helm do it automatically on failure. +atomicInstall: false # The name of another `helm` module to use as a base for this one. Use this to re-use a Helm chart across multiple # services. For example, you might have an organization-wide base chart for certain types of services. @@ -1037,11 +1038,11 @@ this action config's directory. ### `atomicInstall` -Whether to set the --atomic flag during installs and upgrades. Set to false if e.g. you want to see more information about failures and then manually roll back, instead of having Helm do it automatically on failure. +Whether to set the --atomic flag during installs and upgrades. Set to true if you'd like the changes applied to be reverted on failure. Set to false if e.g. you want to see more information about failures and then manually roll back, instead of having Helm do it automatically on failure. | Type | Default | Required | | --------- | ------- | -------- | -| `boolean` | `true` | No | +| `boolean` | `false` | No | ### `base`