fix issuer url & tests
This commit is contained in:
parent
4928d94e95
commit
988339323f
6 changed files with 35 additions and 7 deletions
|
@ -1,5 +1,12 @@
|
|||
package org.domaindrivenarchitecture.provs.server.domain
|
||||
|
||||
enum class CertmanagerEndpoint {
|
||||
staging, prod
|
||||
staging, prod;
|
||||
|
||||
fun endpointUri(): String {
|
||||
return if (this == staging)
|
||||
"https://acme-staging-v02.api.letsencrypt.org/directory"
|
||||
else
|
||||
"https://acme-v02.api.letsencrypt.org/directory"
|
||||
}
|
||||
}
|
|
@ -103,7 +103,8 @@ fun Prov.provisionK3sCertManager(certmanager: Certmanager) = task {
|
|||
"le-issuer.template.yaml",
|
||||
k3sResourcePath,
|
||||
mapOf(
|
||||
"endpoint" to certmanager.letsencryptEndpoint.name.lowercase(),
|
||||
"endpoint" to certmanager.letsencryptEndpoint.endpointUri(),
|
||||
"name" to certmanager.letsencryptEndpoint.name.lowercase(),
|
||||
"email" to certmanager.email
|
||||
),
|
||||
"644",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
apiVersion: cert-manager.io/v1
|
||||
kind: ClusterIssuer
|
||||
metadata:
|
||||
name: ${endpoint}
|
||||
name: ${name}
|
||||
spec:
|
||||
acme:
|
||||
email: ${email}
|
||||
server: https://acme-${endpoint}-v02.api.letsencrypt.org/directory
|
||||
server: ${endpoint}
|
||||
privateKeySecretRef:
|
||||
name: ${endpoint}
|
||||
name: ${name}
|
||||
solvers:
|
||||
- http01:
|
||||
ingress:
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.domaindrivenarchitecture.provs.server.domain
|
||||
|
||||
import org.domaindrivenarchitecture.provs.server.domain.ServerType
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
|
||||
internal class CertmanagerEndpointTest {
|
||||
|
||||
@Test
|
||||
fun shouldResultCorrectEndpoint() {
|
||||
// given
|
||||
val cut = CertmanagerEndpoint.prod
|
||||
|
||||
// when
|
||||
val result = cut.endpointUri()
|
||||
|
||||
// then
|
||||
assertEquals("https://acme-v02.api.letsencrypt.org/directory", result)
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ internal class NetworkKtTest {
|
|||
loopback = Loopback("192.168.5.1", "fc00::5:1"),
|
||||
certmanager = Certmanager(
|
||||
email = "admin@meissa-gmbh.de",
|
||||
letsencryptEndpoint = CertmanagerEndpoint.PROD
|
||||
letsencryptEndpoint = CertmanagerEndpoint.prod
|
||||
),
|
||||
apple = true,
|
||||
reprovision = true
|
||||
|
|
|
@ -27,7 +27,7 @@ internal class ConfigRepositoryTest {
|
|||
loopback = Loopback("192.168.5.1", "fc00::5:1"),
|
||||
certmanager = Certmanager(
|
||||
email = "admin@meissa-gmbh.de",
|
||||
letsencryptEndpoint = CertmanagerEndpoint.PROD
|
||||
letsencryptEndpoint = CertmanagerEndpoint.prod
|
||||
),
|
||||
apple = true,
|
||||
reprovision = true
|
||||
|
|
Loading…
Reference in a new issue