Moved traefik middleware

This commit is contained in:
Michael Jerger 2022-07-29 14:35:33 +00:00
parent a36d25e02d
commit c2237c8721
5 changed files with 29 additions and 3 deletions

View file

@ -5,10 +5,9 @@ import kotlinx.serialization.Serializable
@Serializable @Serializable
class DesktopConfig( data class DesktopConfig(
val ssh: KeyPairSource? = null, val ssh: KeyPairSource? = null,
val gpg: KeyPairSource? = null, val gpg: KeyPairSource? = null,
val gitUserName: String? = null, val gitUserName: String? = null,
val gitEmail: String? = null, val gitEmail: String? = null,
) )

View file

@ -37,7 +37,6 @@ internal fun Prov.provisionDesktop(
gitEmail: String? = null, gitEmail: String? = null,
submodules: List<String>? submodules: List<String>?
) = task { ) = task {
validatePrecondition() validatePrecondition()
provisionBasicDesktop(gpg, ssh, gitUserName, gitEmail, submodules) provisionBasicDesktop(gpg, ssh, gitUserName, gitEmail, submodules)

View file

@ -30,6 +30,7 @@ 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")
private val k3sMiddleWareHttpsRedirect = File(k3sManualManifestsDir, "middleware.yaml")
private val certManagerDeployment = File(k3sManualManifestsDir, "cert-manager.yaml") private val certManagerDeployment = File(k3sManualManifestsDir, "cert-manager.yaml")
private val certManagerIssuer = File(k3sManualManifestsDir, "le-issuer.yaml") private val certManagerIssuer = File(k3sManualManifestsDir, "le-issuer.yaml")
@ -105,6 +106,10 @@ fun Prov.installK3s(k3sConfig: K3sConfig): ProvResult {
ProvResult(true) ProvResult(true)
} }
repeatTaskUntilSuccess(6, 20) {
applyK3sFileFromResource(k3sMiddleWareHttpsRedirect)
}
applyK3sFileFromResource(localPathProvisionerConfig) applyK3sFileFromResource(localPathProvisionerConfig)
cmd("kubectl set env deployment -n kube-system local-path-provisioner DEPLOY_DATE=\"$(date)\"") cmd("kubectl set env deployment -n kube-system local-path-provisioner DEPLOY_DATE=\"$(date)\"")

View file

@ -0,0 +1,8 @@
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirect-https
spec:
redirectScheme:
scheme: https
permanent: true

View file

@ -0,0 +1,15 @@
package org.domaindrivenarchitecture.provs.desktop.domain
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
internal class DesktopConfigTest {
@Test
fun equals_should_work_for_value_objects() {
val config1 = DesktopConfig(gitEmail = "dummy")
assertNotEquals(config1, DesktopConfig());
assertEquals(config1, DesktopConfig(gitEmail = "dummy"));
}
}