refactor provisionK3s
This commit is contained in:
parent
7ca6723b4d
commit
876836f6a3
1 changed files with 33 additions and 26 deletions
|
@ -6,15 +6,26 @@ import org.domaindrivenarchitecture.provs.server.domain.k8s_grafana_agent.provis
|
||||||
import org.domaindrivenarchitecture.provs.server.infrastructure.*
|
import org.domaindrivenarchitecture.provs.server.infrastructure.*
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
/**
|
|
||||||
* Installs a k3s server.
|
|
||||||
*/
|
|
||||||
fun Prov.provisionK3s(cli: K3sCliCommand) = task {
|
fun Prov.provisionK3s(cli: K3sCliCommand) = task {
|
||||||
|
|
||||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
|
||||||
val grafanaConfigResolved: GrafanaAgentConfigResolved? = findK8sGrafanaConfig(cli.configFileName)?.resolveSecret()
|
val grafanaConfigResolved: GrafanaAgentConfigResolved? = findK8sGrafanaConfig(cli.configFileName)?.resolveSecret()
|
||||||
|
|
||||||
if (cli.submodules == null) {
|
if (cli.submodules == null) {
|
||||||
|
// full k3s
|
||||||
|
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
||||||
|
provisionK3s(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
||||||
|
} else {
|
||||||
|
// submodules only
|
||||||
|
provisionMeissaDesktopSubmodules(cli.submodules, grafanaConfigResolved)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs a k3s server.
|
||||||
|
*/
|
||||||
|
fun Prov.provisionK3s(k3sConfig: K3sConfig, grafanaConfigResolved: GrafanaAgentConfigResolved?, applicationFileName: ApplicationFileName?) = task {
|
||||||
provisionNetwork(k3sConfig)
|
provisionNetwork(k3sConfig)
|
||||||
if (k3sConfig.reprovision && testConfigExists()) {
|
if (k3sConfig.reprovision && testConfigExists()) {
|
||||||
deprovisionK3sInfra()
|
deprovisionK3sInfra()
|
||||||
|
@ -34,13 +45,9 @@ fun Prov.provisionK3s(cli: K3sCliCommand) = task {
|
||||||
provisionGrafanaAgent(grafanaConfigResolved)
|
provisionGrafanaAgent(grafanaConfigResolved)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cli.applicationFileName != null) {
|
if (applicationFileName != null) {
|
||||||
provisionK3sApplication(cli.applicationFileName)
|
provisionK3sApplication(applicationFileName)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
provisionMeissaDesktopSubmodules(cli.submodules, grafanaConfigResolved)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Prov.provisionMeissaDesktopSubmodules(submodules: List<String>, grafanaConfigResolved: GrafanaAgentConfigResolved?) = task {
|
private fun Prov.provisionMeissaDesktopSubmodules(submodules: List<String>, grafanaConfigResolved: GrafanaAgentConfigResolved?) = task {
|
||||||
|
|
Loading…
Reference in a new issue