Skip to content

Commit 965cbae

Browse files
committed
1 parent 060dd7e commit 965cbae

11 files changed

Lines changed: 244 additions & 187 deletions

File tree

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use nix

.github/workflows/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
uses: docker/metadata-action@v5
2727
with:
2828
images: |
29-
zmejg/cert-manager-webhook-hetzner
30-
ghcr.io/vadimkim/cert-manager-webhook-hetzner
29+
ghcr.io/sshine/cert-manager-webhook-hetzner
3130
tags: |
3231
type=ref,event=branch
3332
type=ref,event=pr

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
kubebuilder
33
.vscode/
44
.idea/
5+
.direnv/
56
# Binaries for programs and plugins
67
*.exe
78
*.exe~

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ RUN CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o webhook -ldflags '-w -extldflag
2121

2222
# ---- Final runtime image ----
2323
FROM alpine:3.22
24-
LABEL maintainer="vadimkim <vadim@ant.ee>"
25-
LABEL org.opencontainers.image.source="https://github.com/vadimkim/cert-manager-webhook-hetzner"
24+
LABEL org.opencontainers.image.source="https://github.com/sshine/cert-manager-webhook-hetzner"
2625

2726
# Install minimal runtime
2827
RUN apk add --no-cache ca-certificates \
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
apiVersion: v2
22
name: cert-manager-webhook-hetzner
3-
version: 1.4.2
4-
appVersion: "1.4.2"
3+
version: 1.6.0
4+
appVersion: "1.6.0"
55
kubeVersion: ">= 1.22.0-0"
6-
description: Allow cert-manager to solve DNS challenges using Hetzner DNS API
7-
home: https://github.com/vadimkim/cert-manager-webhook-hetzner
6+
description: cert-manager webhook for Hetzner Cloud DNS API
7+
home: https://github.com/sshine/cert-manager-webhook-hetzner
88
icon: https://raw.githubusercontent.com/cert-manager/cert-manager/master/logo/logo-small.png
99
keywords:
1010
- cert-manager
1111
- hetzner
12-
- kube-lego
13-
- letsencrypt
12+
- dns
13+
- acme
1414
- tls
1515
sources:
16-
- https://github.com/vadimkim/cert-manager-webhook-hetzner
17-
maintainers:
18-
- name: vadimkim
19-
email: vadim@ant.ee
16+
- https://github.com/sshine/cert-manager-webhook-hetzner
17+
mainters:
18+
- name: sshine
2019
annotations:
2120
artifacthub.io/license: Apache-2.0

deploy/cert-manager-webhook-hetzner/templates/pki.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
duration: 43800h0m0s # 5y
3333
issuerRef:
3434
name: {{ include "cert-manager-webhook-hetzner.selfSignedIssuer" . }}
35-
commonName: "ca.cert-manager-webhook-hetzner.cert-manager"
35+
commonName: "ca.{{ include "cert-manager-webhook-hetzner.fullname" . }}.cert-manager"
3636
isCA: true
3737

3838
---

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

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
# The kubernetes api group under which the webhook will be exposed. There is no need to
2-
# modify this value unless you are facing a collision in your api services.
3-
groupName: hetzner.cert-mananger-webhook.noshoes.xyz
1+
groupName: acme.yourdomain.tld
42

53
certManager:
64
namespace: cert-manager
75
serviceAccountName: cert-manager
86

97
image:
108
registry: ghcr.io
11-
repository: vadimkim/cert-manager-webhook-hetzner
12-
# Overrides the image tag whose default is {{ printf "v%s" .Chart.AppVersion }}
9+
repository: sshine/cert-manager-webhook-hetzner
1310
tag: ""
1411
pullPolicy: IfNotPresent
1512

13+
replicaCount: 1
14+
1615
nameOverride: ""
1716
fullnameOverride: ""
1817

@@ -24,28 +23,13 @@ secretName:
2423
- hetzner-secret
2524

2625
resources: {}
27-
# We usually recommend not to specify default resources and to leave this as a conscious
28-
# choice for the user. This also increases chances charts run on environments with little
29-
# resources, such as Minikube. If you do want to specify resources, uncomment the following
30-
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
31-
# limits:
32-
# cpu: 100m
33-
# memory: 128Mi
34-
# requests:
35-
# cpu: 100m
36-
# memory: 128Mi
3726

3827
nodeSelector: {}
3928

4029
tolerations: []
4130

4231
affinity: {}
4332

44-
# Use these variables to configure the HTTP_PROXY environment variables
45-
# http_proxy: "http://proxy:8080"
46-
# https_proxy: "https://proxy:8080"
47-
# no_proxy: 127.0.0.1,localhost
48-
4933
securityContext:
5034
allowPrivilegeEscalation: false
5135
capabilities:

internal/hetzner.go

Lines changed: 66 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,83 @@
11
package internal
22

3+
import "strconv"
4+
5+
const (
6+
DefaultApiUrl = "https://api.hetzner.cloud/v1"
7+
DefaultSecretKey = "api-token"
8+
DefaultTxtTTL = 120
9+
)
10+
311
type Config struct {
4-
ApiKey, ZoneName, ApiUrl string
12+
ApiKey string
13+
ZoneName string
14+
ZoneId int64
15+
ApiUrl string
16+
SecretKey string
517
}
618

7-
type RecordResponse struct {
8-
Records []Record `json:"records"`
9-
Meta Meta `json:"meta"`
19+
func (c *Config) ZoneIdStr() string {
20+
return strconv.FormatInt(c.ZoneId, 10)
1021
}
1122

12-
type ZoneResponse struct {
23+
type ZoneListResponse struct {
1324
Zones []Zone `json:"zones"`
14-
Meta Meta `json:"meta"`
1525
}
1626

17-
type Meta struct {
18-
Pagination Pagination `json:"pagination"`
27+
type ZoneResponse struct {
28+
Zone Zone `json:"zone"`
29+
}
30+
31+
type Zone struct {
32+
Id int64 `json:"id"`
33+
Name string `json:"name"`
34+
TTL int `json:"ttl"`
35+
RecordCount int `json:"record_count"`
1936
}
2037

21-
type Pagination struct {
22-
Page int `json:"page"`
23-
PerPage int `json:"per_page"`
24-
LastPage int `json:"last_page"`
25-
TotalEntries int `json:"total_entries"`
38+
type RRSetListResponse struct {
39+
RRSets []RRSet `json:"rrsets"`
2640
}
2741

28-
type Record struct {
29-
Type string `json:"type"`
30-
Id string `json:"id"`
31-
Created string `json:"created"`
32-
Modified string `json:"modified"`
33-
ZoneId string `json:"zone_id"`
34-
Name string `json:"name"`
35-
Value string `json:"value"`
36-
Ttl int `json:"ttl"`
42+
type RRSetResponse struct {
43+
RRSet RRSet `json:"rrset"`
3744
}
3845

39-
type Zone struct {
40-
Id string `json:"id"`
41-
Created string `json:"created"`
42-
Modified string `json:"modified"`
43-
LegacyDnsHost string `json:"legacy_dns_host"`
44-
LegacyNs []string `json:"legacy_ns"`
45-
Name string `json:"name"`
46-
Ns []string `json:"ns"`
47-
Owner string `json:"owner"`
48-
Paused bool `json:"paused"`
49-
Permission string `json:"permission"`
50-
Project string `json:"project"`
51-
Registrar string `json:"registrar"`
52-
Status string `json:"status"`
53-
Ttl int `json:"ttl"`
54-
Verified string `json:"verified"`
55-
RecordsCount int `json:"records_count"`
56-
IsSecondaryDns bool `json:"is_secondary_dns"`
57-
TxtVerification Verification `json:"txt_verification"`
58-
}
59-
60-
type Verification struct {
61-
Name string `json:"name"`
62-
Token string `json:"token"`
46+
type RRSet struct {
47+
Id string `json:"id"`
48+
Name string `json:"name"`
49+
Type string `json:"type"`
50+
TTL *int `json:"ttl"`
51+
Records []RRSetRecord `json:"records"`
52+
Zone int64 `json:"zone"`
53+
}
54+
55+
type RRSetRecord struct {
56+
Value string `json:"value"`
57+
Comment string `json:"comment,omitempty"`
58+
}
59+
60+
type RRSetCreateRequest struct {
61+
Name string `json:"name"`
62+
Type string `json:"type"`
63+
TTL *int `json:"ttl,omitempty"`
64+
Records []RRSetRecord `json:"records"`
65+
}
66+
67+
type RRSetAddRecordsRequest struct {
68+
Records []RRSetRecord `json:"records"`
69+
TTL *int `json:"ttl,omitempty"`
70+
}
71+
72+
type RRSetRemoveRecordsRequest struct {
73+
Records []RRSetRecord `json:"records"`
74+
}
75+
76+
type ErrorResponse struct {
77+
Error ErrorDetail `json:"error"`
78+
}
79+
80+
type ErrorDetail struct {
81+
Code string `json:"code"`
82+
Message string `json:"message"`
6383
}

0 commit comments

Comments
 (0)