apple tut
This commit is contained in:
parent
c2b36de571
commit
84260b5e3c
5 changed files with 71 additions and 16 deletions
|
@ -14,7 +14,12 @@ import org.domaindrivenarchitecture.provs.server.infrastructure.provisionNetwork
|
|||
* If tlsHost is specified, then tls (if configured) also applies to the specified host.
|
||||
*/
|
||||
fun Prov.provisionK3s() = task {
|
||||
provisionNetwork(loopbackIpv4 = "192.168.5.1", loopbackIpv6 = "fc00::5:1")
|
||||
provisionK3sInfra(tlsName = "statistics.prod.meissa-gmbh.de", nodeIpv4 = "162.55.166.39", nodeIpv6 = "2a01:4f8:c010:622b::1",
|
||||
loopbackIpv4 = "192.168.5.1", loopbackIpv6 = "fc00::5:1")
|
||||
val loopbackIpv4 = "192.168.5.1"
|
||||
val loopbackIpv6 = "fc00::5:1"
|
||||
val nodeIpv4 = "162.55.164.138"
|
||||
val nodeIpv6 = "2a01:4f8:c010:622b::1"
|
||||
|
||||
provisionNetwork(loopbackIpv4 = loopbackIpv4, loopbackIpv6 = loopbackIpv6)
|
||||
provisionK3sInfra(tlsName = "statistics.prod.meissa-gmbh.de", nodeIpv4 = nodeIpv4, nodeIpv6 = nodeIpv6,
|
||||
loopbackIpv4 = loopbackIpv4, loopbackIpv6 = loopbackIpv6, installApple = true)
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import org.domaindrivenarchitecture.provs.framework.core.Prov
|
|||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.*
|
||||
|
||||
// TODO: jem - 2022.01.24 - these are global vars without scope / ns !
|
||||
val k3sConfigFile = "/etc/rancher/k3s/config.yaml"
|
||||
val k3sCalicoFile = "/var/lib/rancher/k3s/server/manifests/calico.yaml"
|
||||
val k3sInstallFile = "/usr/local/bin/k3s-install.sh"
|
||||
val k3sResourcePath = "org/domaindrivenarchitecture/provs/infrastructure/k3s/"
|
||||
private const val k3sConfigFile = "/etc/rancher/k3s/config.yaml"
|
||||
private const val k3sCalicoFile = "/var/lib/rancher/k3s/server/manifests/calico.yaml"
|
||||
private const val k3sAppleFile = "/var/lib/rancher/k3s/server/manifests/apple.yaml"
|
||||
private const val k3sInstallFile = "/usr/local/bin/k3s-install.sh"
|
||||
private const val k3sResourcePath = "org/domaindrivenarchitecture/provs/infrastructure/k3s/"
|
||||
|
||||
fun Prov.testConfigExists(): Boolean {
|
||||
return fileExists(k3sConfigFile)
|
||||
|
@ -26,7 +26,8 @@ fun Prov.deprovisionK3sInfra() = task {
|
|||
* If tlsHost is specified, then tls (if configured) also applies to the specified host.
|
||||
*/
|
||||
fun Prov.provisionK3sInfra(tlsName: String, nodeIpv4: String, loopbackIpv4: String, loopbackIpv6: String,
|
||||
nodeIpv6: String? = null, docker: Boolean = false, tlsHost: String? = null) = task {
|
||||
nodeIpv6: String? = null, docker: Boolean = false, installApple: Boolean = false,
|
||||
tlsHost: String? = null) = task {
|
||||
val isDualStack = nodeIpv6?.isNotEmpty() ?: false
|
||||
if (testConfigExists()) {
|
||||
deprovisionK3sInfra()
|
||||
|
@ -47,7 +48,6 @@ fun Prov.provisionK3sInfra(tlsName: String, nodeIpv4: String, loopbackIpv4: Stri
|
|||
"644",
|
||||
sudo = true
|
||||
)
|
||||
|
||||
*/
|
||||
} else {
|
||||
k3sConfigFileName += ".ipv4"
|
||||
|
@ -67,8 +67,15 @@ fun Prov.provisionK3sInfra(tlsName: String, nodeIpv4: String, loopbackIpv4: Stri
|
|||
"755",
|
||||
sudo = true
|
||||
)
|
||||
// TODO: doeas not work yet cmd("k3s-install.sh")
|
||||
|
||||
// TODO: does not work yet cmd("k3s-install.sh")
|
||||
cmd("sh /root/k3s-install.sh")
|
||||
createFileFromResource(
|
||||
k3sAppleFile,
|
||||
"apple.yaml",
|
||||
k3sResourcePath,
|
||||
"644",
|
||||
sudo = true
|
||||
)
|
||||
/*
|
||||
|
||||
org/domaindrivenarchitecture/provs/infrastructure/k3s/config.yaml.template.template
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
kind: Ingress
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
name: apple-ingress
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "traefik"
|
||||
spec:
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /apple
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: apple-service
|
||||
port:
|
||||
number: 5678
|
||||
---
|
||||
|
||||
kind: Pod
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: apple-app
|
||||
labels:
|
||||
app: apple
|
||||
spec:
|
||||
containers:
|
||||
- name: apple-app
|
||||
image: hashicorp/http-echo
|
||||
args:
|
||||
- "-text=apple"
|
||||
---
|
||||
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: apple-service
|
||||
spec:
|
||||
selector:
|
||||
app: apple
|
||||
ports:
|
||||
- port: 5678 # Default port for image
|
|
@ -1,4 +1,3 @@
|
|||
etcd-disable-snapshots: true
|
||||
default-local-storage-path: /var
|
||||
tls-san: ${tls_name}
|
||||
disable-network-policy: true
|
||||
|
@ -11,4 +10,5 @@ service-cidr:
|
|||
node-ip:
|
||||
- ${node_ipv4}
|
||||
- ${node_ipv6}
|
||||
bind-address: ${loopback_ipv4}
|
||||
bind-address: ${loopback_ipv4}
|
||||
advertise-address: ${loopback_ipv4}
|
|
@ -1,10 +1,11 @@
|
|||
etcd-disable-snapshots: true
|
||||
default-local-storage-path: /var
|
||||
tls-san: ${tls_name}
|
||||
disable-network-policy: true
|
||||
cluster-cidr:
|
||||
- 10.42.0.0/16
|
||||
service-cidr:
|
||||
- 10.43.0.0/16
|
||||
node-ip:
|
||||
- ${node_ipv4}
|
||||
bind-address: ${loopback_ipv4}
|
||||
bind-address: ${loopback_ipv4}
|
||||
advertise-address: ${loopback_ipv4}
|
Loading…
Reference in a new issue