diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopConfig.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopConfig.kt index 792e006..9a7347d 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopConfig.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopConfig.kt @@ -5,10 +5,9 @@ import kotlinx.serialization.Serializable @Serializable -class DesktopConfig( +data class DesktopConfig( val ssh: KeyPairSource? = null, val gpg: KeyPairSource? = null, val gitUserName: String? = null, val gitEmail: String? = null, ) - diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt index ce6dbf0..7328dee 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt @@ -37,7 +37,6 @@ internal fun Prov.provisionDesktop( gitEmail: String? = null, submodules: List? ) = task { - validatePrecondition() provisionBasicDesktop(gpg, ssh, gitUserName, gitEmail, submodules) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt index f27b07f..9dff975 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt @@ -30,6 +30,7 @@ private val k3sConfigFile = File( "/etc/rancher/k3s/config.yaml") private val k3sKubeConfig = File("/etc/rancher/k3s/k3s.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 certManagerIssuer = File(k3sManualManifestsDir, "le-issuer.yaml") @@ -105,6 +106,10 @@ fun Prov.installK3s(k3sConfig: K3sConfig): ProvResult { ProvResult(true) } + repeatTaskUntilSuccess(6, 20) { + applyK3sFileFromResource(k3sMiddleWareHttpsRedirect) + } + applyK3sFileFromResource(localPathProvisionerConfig) cmd("kubectl set env deployment -n kube-system local-path-provisioner DEPLOY_DATE=\"$(date)\"") diff --git a/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/middleware.yaml b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/middleware.yaml new file mode 100644 index 0000000..a327dba --- /dev/null +++ b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/middleware.yaml @@ -0,0 +1,8 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: redirect-https +spec: + redirectScheme: + scheme: https + permanent: true \ No newline at end of file diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopConfigTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopConfigTest.kt new file mode 100644 index 0000000..ac84fdc --- /dev/null +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopConfigTest.kt @@ -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")); + } +} \ No newline at end of file