[skip-ci] Remove reprovision cli option
This commit is contained in:
parent
05821540fe
commit
7940d29169
3 changed files with 1 additions and 16 deletions
|
@ -35,7 +35,6 @@ class CliArgumentsParser(name: String) : CliTargetParser(name) {
|
||||||
module.configFileName,
|
module.configFileName,
|
||||||
module.applicationFileName,
|
module.applicationFileName,
|
||||||
module.submodules,
|
module.submodules,
|
||||||
module.reprovision
|
|
||||||
)
|
)
|
||||||
else -> return ServerCliCommand(
|
else -> return ServerCliCommand(
|
||||||
ServerType.valueOf(module.name.uppercase()),
|
ServerType.valueOf(module.name.uppercase()),
|
||||||
|
@ -53,7 +52,6 @@ class CliArgumentsParser(name: String) : CliTargetParser(name) {
|
||||||
var configFileName: ConfigFileName? = null
|
var configFileName: ConfigFileName? = null
|
||||||
var applicationFileName: ApplicationFileName? = null
|
var applicationFileName: ApplicationFileName? = null
|
||||||
var submodules: List<String>? = null
|
var submodules: List<String>? = null
|
||||||
var reprovision: Boolean = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class K3s : ServerSubcommand("k3s", "the k3s module") {
|
class K3s : ServerSubcommand("k3s", "the k3s module") {
|
||||||
|
@ -75,17 +73,10 @@ class CliArgumentsParser(name: String) : CliTargetParser(name) {
|
||||||
"o",
|
"o",
|
||||||
"provisions only parts ",
|
"provisions only parts ",
|
||||||
)
|
)
|
||||||
val cliReprovision by option(
|
|
||||||
ArgType.Boolean,
|
|
||||||
"reprovision",
|
|
||||||
"r",
|
|
||||||
"redo provisioning, deletes old config first"
|
|
||||||
)
|
|
||||||
override fun execute() {
|
override fun execute() {
|
||||||
super.configFileName = cliConfigFileName?.let { ConfigFileName(it) }
|
super.configFileName = cliConfigFileName?.let { ConfigFileName(it) }
|
||||||
super.applicationFileName = cliApplicationFileName?.let { ApplicationFileName(it) }
|
super.applicationFileName = cliApplicationFileName?.let { ApplicationFileName(it) }
|
||||||
super.submodules = if (only != null) listOf(only!!.name.lowercase()) else null
|
super.submodules = if (only != null) listOf(only!!.name.lowercase()) else null
|
||||||
super.reprovision = cliReprovision == true
|
|
||||||
super.parsed = true
|
super.parsed = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ class K3sCliCommand(
|
||||||
configFileName: ConfigFileName?,
|
configFileName: ConfigFileName?,
|
||||||
val applicationFileName: ApplicationFileName?,
|
val applicationFileName: ApplicationFileName?,
|
||||||
val submodules: List<String>? = null,
|
val submodules: List<String>? = null,
|
||||||
val reprovision: Reprovision = false
|
|
||||||
) : ServerCliCommand(
|
) : ServerCliCommand(
|
||||||
serverType,
|
serverType,
|
||||||
target,
|
target,
|
||||||
|
|
|
@ -11,18 +11,13 @@ fun Prov.provisionK3s(cli: K3sCliCommand) = task {
|
||||||
|
|
||||||
val grafanaConfigResolved: GrafanaAgentConfigResolved? = findK8sGrafanaConfig(cli.configFileName)?.resolveSecret()
|
val grafanaConfigResolved: GrafanaAgentConfigResolved? = findK8sGrafanaConfig(cli.configFileName)?.resolveSecret()
|
||||||
|
|
||||||
if (cli.submodules == null && !cli.reprovision) {
|
if (cli.submodules == null) {
|
||||||
// full k3s
|
// full k3s
|
||||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
||||||
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
||||||
repo.exists(cli.applicationFileName)
|
repo.exists(cli.applicationFileName)
|
||||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
||||||
}
|
}
|
||||||
else if (cli.reprovision) { // TODO: Add logic that overrides config, when cmd option is set
|
|
||||||
deprovisionK3sInfra()
|
|
||||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
|
||||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// submodules only
|
// submodules only
|
||||||
provisionGrafanaSanitized(cli.submodules, grafanaConfigResolved)
|
provisionGrafanaSanitized(cli.submodules, grafanaConfigResolved)
|
||||||
|
|
Loading…
Reference in a new issue