Refactor reprovisioning options
Moved config reprovision check to provisionK3s as it does not influence the provisionNetwork() function. Reprovisioning from CLI now overrides reprovisioning from config.
This commit is contained in:
parent
411003f04a
commit
8e83cf11d0
1 changed files with 15 additions and 14 deletions
|
@ -11,17 +11,22 @@ fun Prov.provisionK3s(cli: K3sCliCommand) = task {
|
|||
|
||||
val grafanaConfigResolved: GrafanaAgentConfigResolved? = findK8sGrafanaConfig(cli.configFileName)?.resolveSecret()
|
||||
|
||||
if (cli.submodules == null && !cli.reprovision) {
|
||||
if (cli.submodules == null ) {
|
||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
||||
|
||||
if (!cli.reprovision && !k3sConfig.reprovision) {
|
||||
// full k3s
|
||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
||||
}
|
||||
else if (cli.reprovision) {
|
||||
if (cli.reprovision && testConfigExists()) {
|
||||
deprovisionK3sInfra()
|
||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
||||
}
|
||||
else {
|
||||
if (k3sConfig.reprovision && testConfigExists()) {
|
||||
deprovisionK3sInfra()
|
||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
||||
}
|
||||
} else {
|
||||
// submodules only
|
||||
provisionGrafanaSanitized(cli.submodules, grafanaConfigResolved)
|
||||
}
|
||||
|
@ -37,10 +42,6 @@ fun Prov.provisionK3sWorker(
|
|||
|
||||
provisionNetwork(k3sConfig)
|
||||
|
||||
if (k3sConfig.reprovision && testConfigExists()) {
|
||||
deprovisionK3sInfra()
|
||||
}
|
||||
|
||||
installK3s(k3sConfig)
|
||||
|
||||
if (k3sConfig.certmanager != null) {
|
||||
|
|
Loading…
Reference in a new issue