You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
943 B
Kotlin
28 lines
943 B
Kotlin
2 years ago
|
package org.domaindrivenarchitecture.provs.server.application
|
||
3 years ago
|
|
||
2 years ago
|
import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance
|
||
2 years ago
|
import org.domaindrivenarchitecture.provs.server.domain.installK3sAsContainers
|
||
2 years ago
|
import kotlin.system.exitProcess
|
||
3 years ago
|
|
||
|
|
||
2 years ago
|
/**
|
||
|
* Provisions a k3s server, either locally or on a remote machine depending on the given arguments.
|
||
2 years ago
|
* Depending on the cli parameter "type" it will install the k3s server as standalone or as a container.
|
||
2 years ago
|
*
|
||
|
* Get help with option -h
|
||
|
*/
|
||
|
fun main(args: Array<String>) {
|
||
3 years ago
|
|
||
2 years ago
|
val cmd = parseServerArguments("java -jar provs-server.jar", args)
|
||
|
if (!cmd.isValid()) {
|
||
|
println("Arguments are not valid, pls try -h for help.")
|
||
|
exitProcess(1)
|
||
|
}
|
||
|
val prov = createProvInstance(cmd.target)
|
||
|
|
||
|
when (cmd.type()) {
|
||
|
CliK3sArgumentsParser.K3sType.K3S -> prov.provisionK3s()
|
||
|
CliK3sArgumentsParser.K3sType.K3D -> prov.installK3sAsContainers()
|
||
|
}
|
||
2 years ago
|
}
|