Skip to content

Commit ecc4b07

Browse files
authored
feat: upgrade to k8s 1.22 and cert-manager 1.54 (#10)
* feat: upgrade to k8s 1.22 and cert-manager 1.54 * feat: add more readme
1 parent ff95876 commit ecc4b07

5 files changed

Lines changed: 55 additions & 11 deletions

File tree

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The name of solver to use is `alidns-solver`. You can create an issuer as below
2525
```
2626
apiVersion: v1
2727
items:
28-
- apiVersion: cert-manager.io/v1alpha2
28+
- apiVersion: cert-manager.io/v1
2929
kind: Issuer
3030
metadata:
3131
name: letsencrypt
@@ -52,12 +52,56 @@ items:
5252
selector:
5353
dnsNames:
5454
- '*.example.com'
55+
```
5556

57+
Or you can create an ClusterIssuer as below :
5658
```
59+
apiVersion: cert-manager.io/v1
60+
kind: ClusterIssuer
61+
metadata:
62+
name: letsencrypt
63+
spec:
64+
acme:
65+
email: contact@example.com
66+
server: https://acme-staging-v02.api.letsencrypt.org/directory
67+
privateKeySecretRef:
68+
name: letsencrypt
69+
solvers:
70+
- dns01:
71+
webhook:
72+
config:
73+
accessTokenSecretRef:
74+
key: access-token
75+
name: alidns-secrets
76+
regionId: cn-beijing
77+
secretKeySecretRef:
78+
key: secret-key
79+
name: alidns-secrets
80+
groupName: example.com
81+
solverName: alidns-solver
82+
```
83+
5784
See cert-manager documentation for more information : https://cert-manager.io/docs/configuration/acme/dns01/
5885

5986
### Create the certification
6087

88+
Create an certification using ClusterIssuer as below :
89+
```
90+
apiVersion: cert-manager.io/v1
91+
kind: Certificate
92+
metadata:
93+
name: example-tls
94+
spec:
95+
secretName: example-com-tls
96+
commonName: example.com
97+
dnsNames:
98+
- example.com
99+
- "*.example.com"
100+
issuerRef:
101+
name: letsencrypt
102+
kind: ClusterIssuer
103+
```
104+
61105
Then create the certificate which will use this issuer : https://cert-manager.io/docs/usage/certificate/
62106

63107
## Tests

charts/alidns-webhook/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ apiVersion: v1
22
appVersion: "0.2.0"
33
description: Deploys alidns webhook for cert-manager.
44
name: alidns-webhook
5-
version: 0.5.0
5+
version: 0.6.0

charts/alidns-webhook/templates/apiservice.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: apiregistration.k8s.io/v1beta1
1+
apiVersion: apiregistration.k8s.io/v1
22
kind: APIService
33
metadata:
44
name: v1alpha1.{{ .Values.groupName }}

charts/alidns-webhook/templates/pki.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# Create a selfsigned Issuer, in order to create a root CA certificate for
33
# signing webhook serving certificates
4-
apiVersion: cert-manager.io/v1alpha2
4+
apiVersion: cert-manager.io/v1
55
kind: Issuer
66
metadata:
77
name: {{ include "alidns-webhook.selfSignedIssuer" . }}
@@ -17,7 +17,7 @@ spec:
1717
---
1818

1919
# Generate a CA Certificate used to sign certificates for the webhook
20-
apiVersion: cert-manager.io/v1alpha2
20+
apiVersion: cert-manager.io/v1
2121
kind: Certificate
2222
metadata:
2323
name: {{ include "alidns-webhook.rootCACertificate" . }}
@@ -38,7 +38,7 @@ spec:
3838
---
3939

4040
# Create an Issuer that uses the above generated CA certificate to issue certs
41-
apiVersion: cert-manager.io/v1alpha2
41+
apiVersion: cert-manager.io/v1
4242
kind: Issuer
4343
metadata:
4444
name: {{ include "alidns-webhook.rootCAIssuer" . }}
@@ -55,7 +55,7 @@ spec:
5555
---
5656

5757
# Finally, generate a serving certificate for the webhook to use
58-
apiVersion: cert-manager.io/v1alpha2
58+
apiVersion: cert-manager.io/v1
5959
kind: Certificate
6060
metadata:
6161
name: {{ include "alidns-webhook.servingCertificate" . }}

charts/alidns-webhook/templates/rbac.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ subjects:
5151
# Grant the webhook permission to read the ConfigMap containing the Kubernetes
5252
# apiserver's requestheader-ca-certificate.
5353
# This ConfigMap is automatically created by the Kubernetes apiserver.
54-
apiVersion: rbac.authorization.k8s.io/v1beta1
54+
apiVersion: rbac.authorization.k8s.io/v1
5555
kind: RoleBinding
5656
metadata:
5757
name: {{ include "alidns-webhook.fullname" . }}:webhook-authentication-reader
@@ -73,7 +73,7 @@ subjects:
7373
---
7474
# apiserver gets the auth-delegator role to delegate auth decisions to
7575
# the core apiserver
76-
apiVersion: rbac.authorization.k8s.io/v1beta1
76+
apiVersion: rbac.authorization.k8s.io/v1
7777
kind: ClusterRoleBinding
7878
metadata:
7979
name: {{ include "alidns-webhook.fullname" . }}:auth-delegator
@@ -93,7 +93,7 @@ subjects:
9393
namespace: {{ .Release.Namespace }}
9494
---
9595
# Grant cert-manager permission to validate using our apiserver
96-
apiVersion: rbac.authorization.k8s.io/v1beta1
96+
apiVersion: rbac.authorization.k8s.io/v1
9797
kind: ClusterRole
9898
metadata:
9999
name: {{ include "alidns-webhook.fullname" . }}:domain-solver
@@ -110,7 +110,7 @@ rules:
110110
verbs:
111111
- 'create'
112112
---
113-
apiVersion: rbac.authorization.k8s.io/v1beta1
113+
apiVersion: rbac.authorization.k8s.io/v1
114114
kind: ClusterRoleBinding
115115
metadata:
116116
name: {{ include "alidns-webhook.fullname" . }}:domain-solver

0 commit comments

Comments
 (0)