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
|
package org.domaindrivenarchitecture.provs.server.domain
|
||||||
|
|
||||||
enum class CertmanagerEndpoint {
|
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",
|
"le-issuer.template.yaml",
|
||||||
k3sResourcePath,
|
k3sResourcePath,
|
||||||
mapOf(
|
mapOf(
|
||||||
"endpoint" to certmanager.letsencryptEndpoint.name.lowercase(),
|
"endpoint" to certmanager.letsencryptEndpoint.endpointUri(),
|
||||||
|
"name" to certmanager.letsencryptEndpoint.name.lowercase(),
|
||||||
"email" to certmanager.email
|
"email" to certmanager.email
|
||||||
),
|
),
|
||||||
"644",
|
"644",
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
apiVersion: cert-manager.io/v1
|
apiVersion: cert-manager.io/v1
|
||||||
kind: ClusterIssuer
|
kind: ClusterIssuer
|
||||||
metadata:
|
metadata:
|
||||||
name: ${endpoint}
|
name: ${name}
|
||||||
spec:
|
spec:
|
||||||
acme:
|
acme:
|
||||||
email: ${email}
|
email: ${email}
|
||||||
server: https://acme-${endpoint}-v02.api.letsencrypt.org/directory
|
server: ${endpoint}
|
||||||
privateKeySecretRef:
|
privateKeySecretRef:
|
||||||
name: ${endpoint}
|
name: ${name}
|
||||||
solvers:
|
solvers:
|
||||||
- http01:
|
- http01:
|
||||||
ingress:
|
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"),
|
loopback = Loopback("192.168.5.1", "fc00::5:1"),
|
||||||
certmanager = Certmanager(
|
certmanager = Certmanager(
|
||||||
email = "admin@meissa-gmbh.de",
|
email = "admin@meissa-gmbh.de",
|
||||||
letsencryptEndpoint = CertmanagerEndpoint.PROD
|
letsencryptEndpoint = CertmanagerEndpoint.prod
|
||||||
),
|
),
|
||||||
apple = true,
|
apple = true,
|
||||||
reprovision = true
|
reprovision = true
|
||||||
|
|
|
@ -27,7 +27,7 @@ internal class ConfigRepositoryTest {
|
||||||
loopback = Loopback("192.168.5.1", "fc00::5:1"),
|
loopback = Loopback("192.168.5.1", "fc00::5:1"),
|
||||||
certmanager = Certmanager(
|
certmanager = Certmanager(
|
||||||
email = "admin@meissa-gmbh.de",
|
email = "admin@meissa-gmbh.de",
|
||||||
letsencryptEndpoint = CertmanagerEndpoint.PROD
|
letsencryptEndpoint = CertmanagerEndpoint.prod
|
||||||
),
|
),
|
||||||
apple = true,
|
apple = true,
|
||||||
reprovision = true
|
reprovision = true
|
||||||
|
|
Loading…
Reference in a new issue