-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement(k8s): add explicit cluster-init command for remote clusters
This avoids complications relating to differing provider configurations and Garden versions, by removing cluster-wide init from the standard `garden init` flow and making it an explicit plugin command. `local-kubernetes` environments are not affected by this, since they are not shared between users/CI/etc.
- Loading branch information
Showing
10 changed files
with
185 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
garden-service/src/plugins/kubernetes/commands/cluster-init.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2018 Garden Technologies, Inc. <[email protected]> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import { PluginCommand } from "../../../types/plugin/command" | ||
import { prepareSystem, getEnvironmentStatus } from "../init" | ||
import chalk from "chalk" | ||
|
||
export const clusterInit: PluginCommand = { | ||
name: "cluster-init", | ||
description: "Initialize or update cluster-wide Garden services.", | ||
|
||
handler: async ({ ctx, log }) => { | ||
const entry = log.info({ | ||
msg: chalk.bold.magenta( | ||
`Initializing/updating cluster-wide services for ${chalk.white(ctx.environmentName)} environment`, | ||
), | ||
}) | ||
|
||
const status = await getEnvironmentStatus({ ctx, log }) | ||
let result = {} | ||
|
||
if (status.ready) { | ||
entry.info("All services already initialized!") | ||
} else { | ||
result = await prepareSystem({ | ||
ctx, | ||
log: entry, | ||
force: true, | ||
status, | ||
clusterInit: true, | ||
}) | ||
} | ||
|
||
log.info(chalk.green("Done!")) | ||
|
||
return { result } | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.