[skip ci] refactoring method names and reprovision logic
This commit is contained in:
parent
70b5dda4a7
commit
db84284f8c
3 changed files with 13 additions and 19 deletions
|
@ -77,6 +77,8 @@ fun Prov.provisionIdeDesktop(submodules: List<String>?) {
|
||||||
installIntelliJ()
|
installIntelliJ()
|
||||||
} else if (submodules.contains(DesktopSubmodule.VERIFY.name.lowercase())) {
|
} else if (submodules.contains(DesktopSubmodule.VERIFY.name.lowercase())) {
|
||||||
verifyIdeSetup()
|
verifyIdeSetup()
|
||||||
|
} else if (submodules.contains(DesktopSubmodule.FIREFOX.name.lowercase())) {
|
||||||
|
installFirefox()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +108,8 @@ fun Prov.provisionOfficeDesktop(submodules: List<String>?) {
|
||||||
aptInstall(SPELLCHECKING_DE)
|
aptInstall(SPELLCHECKING_DE)
|
||||||
} else if (submodules.contains(DesktopSubmodule.VERIFY.name.lowercase())) {
|
} else if (submodules.contains(DesktopSubmodule.VERIFY.name.lowercase())) {
|
||||||
verifyOfficeSetup()
|
verifyOfficeSetup()
|
||||||
|
} else if (submodules.contains(DesktopSubmodule.FIREFOX.name.lowercase())) {
|
||||||
|
installFirefox()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.domaindrivenarchitecture.provs.server.application
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance
|
import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance
|
||||||
import org.domaindrivenarchitecture.provs.server.domain.ServerType
|
import org.domaindrivenarchitecture.provs.server.domain.ServerType
|
||||||
import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand
|
import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand
|
||||||
import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3s
|
import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3sCommand
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,6 +33,6 @@ fun main(args: Array<String>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val prov = createProvInstance(cmd.target)
|
val prov = createProvInstance(cmd.target)
|
||||||
prov.provisionK3s(cmd as K3sCliCommand)
|
prov.provisionK3sCommand(cmd as K3sCliCommand)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,37 +7,27 @@ import org.domaindrivenarchitecture.provs.server.infrastructure.*
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
fun Prov.provisionK3s(cli: K3sCliCommand) = task {
|
fun Prov.provisionK3sCommand(cli: K3sCliCommand) = task {
|
||||||
|
|
||||||
val grafanaConfigResolved: GrafanaAgentConfigResolved? = findK8sGrafanaConfig(cli.configFileName)?.resolveSecret()
|
val grafanaConfigResolved: GrafanaAgentConfigResolved? = findK8sGrafanaConfig(cli.configFileName)?.resolveSecret()
|
||||||
|
|
||||||
if (cli.submodules == null ) {
|
if (cli.submodules == null ) {
|
||||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
||||||
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
DefaultApplicationFileRepository().assertExists(cli.applicationFileName)
|
||||||
repo.assertExists(cli.applicationFileName)
|
|
||||||
|
|
||||||
if (!cli.reprovision && !k3sConfig.reprovision) {
|
if (cli.reprovision || k3sConfig.reprovision) {
|
||||||
// full k3s
|
|
||||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
|
||||||
}
|
|
||||||
if (cli.reprovision && testConfigExists()) {
|
|
||||||
deprovisionK3sInfra()
|
deprovisionK3sInfra()
|
||||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
|
||||||
}
|
|
||||||
if (k3sConfig.reprovision && testConfigExists()) {
|
|
||||||
deprovisionK3sInfra()
|
|
||||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
|
||||||
}
|
}
|
||||||
|
provisionK3s(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
||||||
} else {
|
} else {
|
||||||
// submodules only
|
provisionGrafana(cli.submodules, grafanaConfigResolved)
|
||||||
provisionGrafanaSanitized(cli.submodules, grafanaConfigResolved)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs a k3s server.
|
* Installs a k3s server.
|
||||||
*/
|
*/
|
||||||
fun Prov.provisionK3sWorker(
|
fun Prov.provisionK3s(
|
||||||
k3sConfig: K3sConfig,
|
k3sConfig: K3sConfig,
|
||||||
grafanaConfigResolved: GrafanaAgentConfigResolved? = null,
|
grafanaConfigResolved: GrafanaAgentConfigResolved? = null,
|
||||||
applicationFileName: ApplicationFileName? = null) = task {
|
applicationFileName: ApplicationFileName? = null) = task {
|
||||||
|
@ -65,7 +55,7 @@ fun Prov.provisionK3sWorker(
|
||||||
provisionServerCliConvenience()
|
provisionServerCliConvenience()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Prov.provisionGrafanaSanitized(
|
private fun Prov.provisionGrafana(
|
||||||
submodules: List<String>?,
|
submodules: List<String>?,
|
||||||
grafanaConfigResolved: GrafanaAgentConfigResolved?) = task {
|
grafanaConfigResolved: GrafanaAgentConfigResolved?) = task {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue