-
Notifications
You must be signed in to change notification settings - Fork 161
/
Copy pathdefault_clusterissuers.libsonnet
98 lines (92 loc) · 2.56 KB
/
default_clusterissuers.libsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
withDefaultIssuer(name, kind='ClusterIssuer', group='cert-manager.io'):: {
values+:: {
ingressShim: {
defaultIssuerName: name,
defaultIssuerKind: kind,
defaultIssuerGroup: group,
},
},
},
clusterIssuer:: {
new(name): {
apiVersion: 'cert-manager.io/v1',
kind: 'ClusterIssuer',
metadata: {
name: name,
},
},
withACME(email, server='https://acme-v02.api.letsencrypt.org/directory'): {
local name = super.metadata.name,
spec+: {
acme: {
// You must replace this email address with your own.
// Let's Encrypt will use this to contact you about expiring
// certificates, and issues related to your account.
email: email,
server: server,
privateKeySecretRef: {
// Secret resource used to store the account's private key.
name: '%s-account' % name,
},
},
},
},
reuseAccount(secret_name): {
spec+: {
acme+: {
// re-use an existing account
// https://cert-manager.io/docs/configuration/acme/#reusing-an-acme-account
disableAccountKeyGeneration: true,
privateKeySecretRef: {
// Secret resource used to retrieve the account's private key.
name: secret_name,
},
},
},
},
withACMESolverHttp01(class='nginx'): {
spec+: {
acme+: {
// Add a single challenge solver, HTTP01 using nginx
solvers: [
{
http01: {
ingress: {
class: class,
},
},
},
],
},
},
},
},
// backward compat
values+:: {
ingressShim:
{
defaultIssuerKind: 'ClusterIssuer',
}
+ (
if $._config.default_issuer != null
then { defaultIssuerName: $._config.default_issuer }
else {}
)
+ (
if $._config.default_issuer_group != null
then { defaultIssuerGroup: $._config.default_issuer_group }
else {}
),
},
// backward compat
cluster_issuer_staging:
self.clusterIssuer.new('letsencrypt-staging')
+ self.clusterIssuer.withACME($._config.issuer_email, 'https://acme-staging-v02.api.letsencrypt.org/directory')
+ self.clusterIssuer.withACMESolverHttp01(),
// backward compat
cluster_issuer_prod:
self.clusterIssuer.new('letsencrypt-prod')
+ self.clusterIssuer.withACME($._config.issuer_email)
+ self.clusterIssuer.withACMESolverHttp01(),
}