Skip to content

Commit aa31911

Browse files
authored
Merge pull request #35 from dchudik/master
Added support for DNSv2 API
2 parents 149b66e + ba2543c commit aa31911

File tree

20 files changed

+1079
-1169
lines changed

20 files changed

+1079
-1169
lines changed

.golangci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,18 @@ linters:
88
- gosec
99
- lll
1010
- wsl
11+
- depguard
12+
- testpackage
13+
- exhaustruct
14+
- tagliatelle
15+
# Disbale deprecated linters
16+
- interfacer
17+
- ifshort
18+
- structcheck
19+
- maligned
20+
- scopelint
21+
- deadcode
22+
- nosnakecase
23+
- golint
24+
- varcheck
25+
- exhaustivestruct

README.md

Lines changed: 145 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,151 @@
44

55
Cert-manager ACME DNS webhook provider for Selectel.
66

7-
## Installing
7+
## Contents
88

9-
To install with helm in namespace: cert-manager, run:
9+
* [Issuing certificate in DNS Hosting (actual)](#issuing-certificate-in-dns-hosting-actual)
10+
* [Installing](#installing)
11+
* [Setup credentials](#setup-credentials)
12+
* [Setup issuer](#setup-issuer)
13+
* [Issuing certificate](#issuing-certificate)
14+
* [Issuing certificate in DNS Hosting (legacy)](#issuing-certificate-in-dns-hosting-legacy)
15+
* [Legacy version](#legacy-version)
16+
* [Installing](#installing-legacy)
17+
* [Setup credentials](#setup-credentials-legacy)
18+
* [Setup issuer](#setup-issuer-legacy)
19+
* [Issuing certificate](#issuing-certificate-legacy)
20+
* [Development guide](#development-guide)
21+
* [Running the test suite](#running-the-test-suite)
22+
23+
## Issuing certificate in DNS Hosting (actual)
24+
25+
### Installing
26+
27+
To install with helm from helm-repository, run:
1028

1129
```bash
1230
$ helm repo add selectel https://selectel.github.io/cert-manager-webhook-selectel
1331
$ helm repo update
1432
$ helm install cert-manager-webhook-selectel selectel/cert-manager-webhook-selectel -n cert-manager
1533
```
1634

17-
OR
35+
Or install with helm from git-repository, run:
1836

1937
```bash
2038
$ git clone https://github.com/selectel/cert-manager-webhook-selectel.git
2139
$ cd cert-manager-webhook-selectel/deploy/cert-manager-webhook-selectel
2240
$ helm install cert-manager-webhook-selectel . -n cert-manager
2341
```
2442

25-
<!-- Without helm, run: -->
43+
### Setup credentials
2644

27-
<!-- ```bash
28-
$ make rendered-manifest.yaml
29-
$ kubectl apply -f _out/rendered-manifest.yaml
30-
``` -->
45+
Create secret and fill authentication data.
3146

32-
### Issuer/ClusterIssuer
47+
```yaml
48+
apiVersion: v1
49+
kind: Secret
50+
metadata:
51+
name: selectel-dns-credentials
52+
namespace: cert-manager
53+
type: Opaque
54+
stringData:
55+
username: KEYSTONE_USER
56+
password: KEYSTONE_PASSWORD
57+
account_id: ACCOUNT_ID
58+
project_id: SELECTEL_PROJECT_ID
59+
```
60+
61+
**KEYSTONE_USER** - Name of the service user. To get the name, in the top right corner of the [Control panel](https://my.selectel.ru/profile/users_management/users?type=service), go to the account menu ⟶ **Profile and Settings** ⟶ **User management** ⟶ the **Service users** tab ⟶ copy the name of the required user. Learn more about [Service users](https://docs.selectel.ru/control-panel-actions/users-and-roles/user-types-and-roles/).
62+
63+
**KEYSTONE_PASSWORD** - Password of the service user.
64+
65+
**ACCOUNT_ID** - Selectel account ID. The account ID is in the top right corner of the [Control panel](https://my.selectel.ru/). Learn more about [Registration](https://docs.selectel.ru/control-panel-actions/account/registration/).
66+
67+
**SELECTEL_PROJECT_ID** - Unique identifier of the associated Cloud Platform project. To get the project ID, in the [Control panel](https://my.selectel.ru/vpc/), go to Cloud Platform ⟶ project name ⟶ copy the ID of the required project. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/servers/about/projects/).
68+
69+
### Setup issuer
3370
3471
An example issuer:
3572
73+
```yaml
74+
apiVersion: cert-manager.io/v1
75+
kind: Issuer
76+
metadata:
77+
name: letsencrypt-staging
78+
namespace: cert-manager
79+
spec:
80+
acme:
81+
server: https://acme-staging-v02.api.letsencrypt.org/directory
82+
email: certmaster@selectel.ru
83+
privateKeySecretRef:
84+
name: letsencrypt-staging-account-key
85+
solvers:
86+
- dns01:
87+
webhook:
88+
groupName: acme.selectel.ru
89+
solverName: selectel
90+
config:
91+
dnsSecretRef:
92+
name: selectel-dns-credentials
93+
# Optional config, shown with default values
94+
# all times in seconds
95+
ttl: 120 # Default: 60
96+
timeout: 60 # Default 40
97+
```
98+
99+
### Issuing certificate
100+
101+
Issuing certificate:
102+
103+
```yaml
104+
apiVersion: cert-manager.io/v1
105+
kind: Certificate
106+
metadata:
107+
name: sel-letsencrypt-crt
108+
namespace: cert-manager
109+
spec:
110+
# Setup secret name
111+
secretName: example-com-tls
112+
commonName: example.com
113+
issuerRef:
114+
name: letsencrypt-staging
115+
kind: Issuer
116+
# Setup names of zones
117+
dnsNames:
118+
- example.com
119+
- www.example.com
120+
```
121+
122+
## Issuing certificate in DNS Hosting (legacy)
123+
124+
### Legacy version
125+
126+
Cert-manager webhook provider for Selectel supporting two versions API.
127+
They are not compatible. They utilize different API and work with zones live on different authoritative servers.
128+
Zone created in v2 API not available via v1 api.
129+
130+
### Installing (legacy)
131+
132+
To install with helm from helm-repository, run:
133+
134+
```bash
135+
$ helm repo add selectel https://selectel.github.io/cert-manager-webhook-selectel
136+
$ helm repo update
137+
$ helm install cert-manager-webhook-selectel selectel/cert-manager-webhook-selectel -n cert-manager --version 1.2.5
138+
```
139+
140+
Or install with helm from git-repository, run:
141+
142+
```bash
143+
$ git clone https://github.com/selectel/cert-manager-webhook-selectel.git --branch cert-manager-webhook-selectel-1.2.5
144+
$ cd cert-manager-webhook-selectel/deploy/cert-manager-webhook-selectel
145+
$ helm install cert-manager-webhook-selectel . -n cert-manager
146+
```
147+
148+
### Setup credentials (legacy)
149+
150+
Create secret and fill **APITOKEN_FROM_MY_SELECTEL_RU**.
151+
36152
```yaml
37153
apiVersion: v1
38154
kind: Secret
@@ -42,7 +158,15 @@ metadata:
42158
type: Opaque
43159
stringData:
44160
token: APITOKEN_FROM_MY_SELECTEL_RU
45-
---
161+
```
162+
163+
**APITOKEN_FROM_MY_SELECTEL_RU** - Selectel Token (API Key). For obtain Selectel Token read [here](https://developers.selectel.ru/docs/control-panel/authorization/).
164+
165+
### Setup issuer (legacy)
166+
167+
An example issuer:
168+
169+
```yaml
46170
apiVersion: cert-manager.io/v1
47171
kind: Issuer
48172
metadata:
@@ -72,7 +196,9 @@ spec:
72196
pollingInterval: 2
73197
```
74198
75-
And then you can issue a cert:
199+
### Issuing certificate (legacy)
200+
201+
Issuing certificate:
76202
77203
```yaml
78204
apiVersion: cert-manager.io/v1
@@ -81,27 +207,29 @@ metadata:
81207
name: sel-letsencrypt-crt
82208
namespace: cert-manager
83209
spec:
210+
# Setup secret name
84211
secretName: example-com-tls
85212
commonName: example.com
86213
issuerRef:
87214
name: letsencrypt-staging
88215
kind: Issuer
216+
# Setup names of zones
89217
dnsNames:
90218
- example.com
91219
- www.example.com
92220
```
93221
94-
## Development
222+
## Development guide
95223
96224
### Running the test suite
97225
98226
You can run the test suite with:
99227
100-
1. Go to `https://my.selectel.ru/profile/apikeys`, get one or create new api token.
101-
2. Fill in the appropriate values in `testdata/selectel/apikey.yml` and `testdata/selectel/config.json`.
102-
- Insert token `testdata/selectel/apikey.yml`.
103-
- Check that `metadata.name` in `testdata/selectel/apikey.yml` equals value in `testdata/selectel/config.json` for key `apiKeySecretRef.name`.
104-
- Check that key name in `testdata/selectel/apikey.yml` equals value in `testdata/selectel/config.json` for key `apiKeySecretRef.key`.
228+
1. Go to `https://my.selectel.ru/profile/users_management/users`, get one or create new user.
229+
2. Fill in the appropriate values in `testdata/selectel/dns-credentials.yml` and `testdata/selectel/config.json`.
230+
* Insert values `testdata/selectel/dns-credentials.yml`.
231+
* Check that `metadata.name` in `testdata/selectel/dns-credentials.yml` equals value in `testdata/selectel/config.json` for key `dnsSecretRef.name`.
232+
3. Run tests
105233

106234
```bash
107235
$ TEST_ZONE_NAME=example.com. make test
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
apiVersion: v1
33
name: cert-manager-webhook-selectel
4-
appVersion: "1.2.5"
4+
appVersion: "1.3.0"
55
description: Selectel DNS cert-manager ACME webhook
66
maintainers:
77
- name: andrsp
88
email: izotikov@selectel.ru
99
url: https://github.com/andrsp
10-
version: 1.2.5
10+
version: 1.3.0

deploy/cert-manager-webhook-selectel/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ replicaCount: 1
1616

1717
image:
1818
repository: ghcr.io/selectel/cert-manager-webhook-selectel
19-
tag: v1.2.5
19+
tag: v1.3.0
2020
pullPolicy: Always
2121

2222
nameOverride: ""

0 commit comments

Comments
 (0)