remove unsafe-operators
This commit is contained in:
parent
836dc3ca2a
commit
1d42089ca3
2 changed files with 14 additions and 7 deletions
|
@ -22,8 +22,8 @@ private const val k3sResourceDir = "org/domaindrivenarchitecture/provs/server/in
|
||||||
|
|
||||||
// ----------------------------------- files --------------------------------
|
// ----------------------------------- files --------------------------------
|
||||||
|
|
||||||
private val k3sInstallScript = File( "/usr/local/bin/k3s-install.sh")
|
private val k3sInstallScript = File("/usr/local/bin/k3s-install.sh")
|
||||||
private val k3sConfigFile = File( "/etc/rancher/k3s/config.yaml")
|
private val k3sConfigFile = File("/etc/rancher/k3s/config.yaml")
|
||||||
private val k3sKubeConfig = File("/etc/rancher/k3s/k3s.yaml")
|
private val k3sKubeConfig = File("/etc/rancher/k3s/k3s.yaml")
|
||||||
|
|
||||||
private val k3sTraefikWorkaround = File(k3sManualManifestsDir, "traefik.yaml")
|
private val k3sTraefikWorkaround = File(k3sManualManifestsDir, "traefik.yaml")
|
||||||
|
@ -75,14 +75,20 @@ fun Prov.installK3s(k3sConfig: K3sConfig): ProvResult {
|
||||||
if (k3sConfig.isDualStack()) {
|
if (k3sConfig.isDualStack()) {
|
||||||
k3sConfigResourceFileName += ".dual.template.yaml"
|
k3sConfigResourceFileName += ".dual.template.yaml"
|
||||||
metallbConfigResourceFileName += ".dual.template.yaml"
|
metallbConfigResourceFileName += ".dual.template.yaml"
|
||||||
k3sConfigMap = k3sConfigMap.plus("node_ipv6" to k3sConfig.node.ipv6!!)
|
require(k3sConfig.node.ipv6 != null && k3sConfig.loopback.ipv6 != null)
|
||||||
.plus("loopback_ipv6" to k3sConfig.loopback.ipv6!!)
|
k3sConfigMap = k3sConfigMap
|
||||||
|
.plus("node_ipv6" to k3sConfig.node.ipv6)
|
||||||
|
.plus("loopback_ipv6" to k3sConfig.loopback.ipv6)
|
||||||
} else {
|
} else {
|
||||||
k3sConfigResourceFileName += ".ipv4.template.yaml"
|
k3sConfigResourceFileName += ".ipv4.template.yaml"
|
||||||
metallbConfigResourceFileName += ".ipv4.template.yaml"
|
metallbConfigResourceFileName += ".ipv4.template.yaml"
|
||||||
}
|
}
|
||||||
|
|
||||||
createK3sFileFromResourceTemplate(k3sConfigFile, k3sConfigMap, alternativeResourceTemplate = File(k3sConfigResourceFileName))
|
createK3sFileFromResourceTemplate(
|
||||||
|
k3sConfigFile,
|
||||||
|
k3sConfigMap,
|
||||||
|
alternativeResourceTemplate = File(k3sConfigResourceFileName)
|
||||||
|
)
|
||||||
createK3sFileFromResource(k3sInstallScript, posixFilePermission = "755")
|
createK3sFileFromResource(k3sInstallScript, posixFilePermission = "755")
|
||||||
cmd("INSTALL_K3S_VERSION=$K3S_VERSION k3s-install.sh")
|
cmd("INSTALL_K3S_VERSION=$K3S_VERSION k3s-install.sh")
|
||||||
|
|
||||||
|
@ -217,5 +223,5 @@ private fun File.templateName(): String {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Prov.configureShellAliases() = task {
|
internal fun Prov.configureShellAliases() = task {
|
||||||
addTextToFile( "\nalias k=\"sudo kubectl\"\n", File(".bash_aliases",))
|
addTextToFile("\nalias k=\"sudo kubectl\"\n", File(".bash_aliases"))
|
||||||
}
|
}
|
|
@ -16,11 +16,12 @@ fun Prov.testNetworkExists(): Boolean {
|
||||||
fun Prov.provisionNetwork(k3sConfig: K3sConfig) = task {
|
fun Prov.provisionNetwork(k3sConfig: K3sConfig) = task {
|
||||||
if(!testNetworkExists()) {
|
if(!testNetworkExists()) {
|
||||||
if(k3sConfig.isDualStack()) {
|
if(k3sConfig.isDualStack()) {
|
||||||
|
require(k3sConfig.loopback.ipv6 != null)
|
||||||
createFileFromResourceTemplate(
|
createFileFromResourceTemplate(
|
||||||
loopbackFile,
|
loopbackFile,
|
||||||
"99-loopback.dual.template.yaml",
|
"99-loopback.dual.template.yaml",
|
||||||
resourcePathNetwork,
|
resourcePathNetwork,
|
||||||
mapOf("loopback_ipv4" to k3sConfig.loopback.ipv4, "loopback_ipv6" to k3sConfig.loopback.ipv6!!),
|
mapOf("loopback_ipv4" to k3sConfig.loopback.ipv4, "loopback_ipv6" to k3sConfig.loopback.ipv6),
|
||||||
"644",
|
"644",
|
||||||
sudo = true
|
sudo = true
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue