K3s provision does work without security
This commit is contained in:
parent
1defd46c97
commit
e6bb2ee550
7 changed files with 69 additions and 11 deletions
34
build.gradle
34
build.gradle
|
@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
|
|
||||||
group = 'org.domaindrivenarchitecture.provs'
|
group = 'org.domaindrivenarchitecture.provs'
|
||||||
version = '0.8.37-SNAPSHOT'
|
version = '0.9.0-SNAPSHOT'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -99,10 +99,10 @@ task fatJarLatest(type: Jar) {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Implementation-Title': 'Fatjar of provs',
|
attributes 'Implementation-Title': 'Fatjar of provs',
|
||||||
'Implementation-Version': project.version,
|
'Implementation-Version': project.version,
|
||||||
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliWorkplaceKt'
|
'Main-Class': 'org.domaindrivenarchitecture.provs.desktop.application.CliWorkplaceKt'
|
||||||
}
|
}
|
||||||
with jar
|
with jar
|
||||||
archiveFileName = 'provs.jar'
|
archiveFileName = 'provs-desktop.jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
task fatJarK3s(type: Jar) {
|
task fatJarK3s(type: Jar) {
|
||||||
|
@ -116,13 +116,13 @@ task fatJarK3s(type: Jar) {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Implementation-Title': 'Fatjar of provs k3s',
|
attributes 'Implementation-Title': 'Fatjar of provs k3s',
|
||||||
'Implementation-Version': project.version,
|
'Implementation-Version': project.version,
|
||||||
'Main-Class': 'org.domaindrivenarchitecture.provs.extensions.server_software.k3s.application.CliKt'
|
'Main-Class': 'org.domaindrivenarchitecture.provs.server.application.ApplicationKt'
|
||||||
}
|
}
|
||||||
with jar
|
with jar
|
||||||
archiveFileName = 'provs-server.jar'
|
archiveFileName = 'provs-server.jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
task uberjarWorkplace(type: Jar) {
|
task uberjarDesktop(type: Jar) {
|
||||||
|
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
|
|
||||||
|
@ -137,9 +137,29 @@ task uberjarWorkplace(type: Jar) {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Implementation-Title': 'Uberjar of provs',
|
attributes 'Implementation-Title': 'Uberjar of provs',
|
||||||
'Implementation-Version': project.version,
|
'Implementation-Version': project.version,
|
||||||
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
'Main-Class': 'org.domaindrivenarchitecture.provs.desktop.application.CliKt'
|
||||||
}
|
}
|
||||||
archiveFileName = 'provs-workplace.jar'
|
archiveFileName = 'provs-desktop.jar'
|
||||||
|
}
|
||||||
|
|
||||||
|
task uberjarServer(type: Jar) {
|
||||||
|
|
||||||
|
from sourceSets.main.output
|
||||||
|
|
||||||
|
dependsOn configurations.runtimeClasspath
|
||||||
|
from {
|
||||||
|
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
|
||||||
|
} {
|
||||||
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||||
|
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
|
||||||
|
}
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes 'Implementation-Title': 'Uberjar of provs',
|
||||||
|
'Implementation-Version': project.version,
|
||||||
|
'Main-Class': 'org.domaindrivenarchitecture.provs.server.application.ApplicationKt'
|
||||||
|
}
|
||||||
|
archiveFileName = 'provs-server.jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
task uberjarEntry(type: Jar) {
|
task uberjarEntry(type: Jar) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ package org.domaindrivenarchitecture.provs.framework.core.entry
|
||||||
* @param args[1] (optional) static method of the class with a vararg parameter of type String; if not specified, the "main" method is used
|
* @param args[1] (optional) static method of the class with a vararg parameter of type String; if not specified, the "main" method is used
|
||||||
* @param args[2...] (optional) String parameters that are passed to the method; can be only used if method name (args[1]) is provided
|
* @param args[2...] (optional) String parameters that are passed to the method; can be only used if method name (args[1]) is provided
|
||||||
*/
|
*/
|
||||||
|
// TODO: jem - 2022.01.21 - do we need this way or can this be removed?
|
||||||
fun main(vararg args: String) {
|
fun main(vararg args: String) {
|
||||||
|
|
||||||
if (args.isNotEmpty()) {
|
if (args.isNotEmpty()) {
|
||||||
|
|
|
@ -4,8 +4,6 @@ import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.remote
|
import org.domaindrivenarchitecture.provs.framework.core.remote
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.repeatTaskUntilSuccess
|
import org.domaindrivenarchitecture.provs.framework.core.repeatTaskUntilSuccess
|
||||||
import org.domaindrivenarchitecture.provs.server.domain.applyK3sConfig
|
|
||||||
import org.domaindrivenarchitecture.provs.server.domain.installK3sServer
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,8 +78,8 @@ fun main() {
|
||||||
val host = "123.34.56.78"
|
val host = "123.34.56.78"
|
||||||
|
|
||||||
remote(host, "root").task {
|
remote(host, "root").task {
|
||||||
installK3sServer(tlsHost = host)
|
//installK3sServer(tlsHost = host)
|
||||||
applyK3sConfig(appleConfig())
|
//applyK3sConfig(appleConfig())
|
||||||
|
|
||||||
// optional check
|
// optional check
|
||||||
checkAppleService(host)
|
checkAppleService(host)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.echoCommandForText
|
import org.domaindrivenarchitecture.provs.framework.core.echoCommandForText
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||||||
import org.domaindrivenarchitecture.provs.server.infrastructure.provisionK3sInfra
|
import org.domaindrivenarchitecture.provs.server.infrastructure.provisionK3sInfra
|
||||||
|
import org.domaindrivenarchitecture.provs.server.infrastructure.provisionNetwork
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,5 +14,6 @@ import org.domaindrivenarchitecture.provs.server.infrastructure.provisionK3sInfr
|
||||||
* If tlsHost is specified, then tls (if configured) also applies to the specified host.
|
* If tlsHost is specified, then tls (if configured) also applies to the specified host.
|
||||||
*/
|
*/
|
||||||
fun Prov.provisionK3s() = task {
|
fun Prov.provisionK3s() = task {
|
||||||
|
provisionNetwork()
|
||||||
provisionK3sInfra()
|
provisionK3sInfra()
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.domaindrivenarchitecture.provs.server.infrastructure
|
||||||
|
|
||||||
|
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||||||
|
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||||
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFileFromResource
|
||||||
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileExists
|
||||||
|
|
||||||
|
val loopbackFile = "/etc/netplan/99-loopback.yaml"
|
||||||
|
val resourcePath = "org/domaindrivenarchitecture/provs/infrastructure/network/"
|
||||||
|
|
||||||
|
fun Prov.testNetworkExists(): Boolean {
|
||||||
|
return fileExists(loopbackFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Prov.provisionNetwork() = task {
|
||||||
|
if(!testNetworkExists()) {
|
||||||
|
createFileFromResource(
|
||||||
|
loopbackFile,
|
||||||
|
"99-loopback.yaml.template",
|
||||||
|
resourcePath,
|
||||||
|
"644",
|
||||||
|
sudo = true
|
||||||
|
)
|
||||||
|
cmd("netplan apply", sudo = true)
|
||||||
|
} else {
|
||||||
|
ProvResult(true)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
network:
|
||||||
|
version: 2
|
||||||
|
ethernets:
|
||||||
|
lo:
|
||||||
|
renderer: networkd
|
||||||
|
match:
|
||||||
|
name: lo
|
||||||
|
addresses:
|
||||||
|
- 192.168.5.1/32
|
Loading…
Reference in a new issue