Skip to content

Commit

Permalink
Release version 0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mrueg committed Dec 3, 2023
1 parent 4511139 commit cf7cd9c
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 10 deletions.
48 changes: 44 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

External-DNS Webhook Provider to manage Netcup DNS Records

> [!INFO]
> This repository is not affiliated with Netcup.
> [!WARNING]
> Completely untested code. Might eat your DNS records. You have been warned.
Expand Down Expand Up @@ -33,6 +35,39 @@ Then apply one of the following manifests file to deploy external-dns.

[embedmd]:# (example/external-dns.yaml)
```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: external-dns
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: external-dns
rules:
- apiGroups: [""]
resources: ["services","endpoints","pods"]
verbs: ["get","watch","list"]
- apiGroups: ["extensions","networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get","watch","list"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: external-dns-viewer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -48,18 +83,22 @@ spec:
labels:
app: external-dns
spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --log-level=debug
- --source=ingress
- --source=service
- --provider=webhook
- name: external-dns-webhook-provider
image: ghcr.io/mrueg/external-dns-netcup-webhook:main
image: ghcr.io/mrueg/external-dns-netcup-webhook:latest
imagePullPolicy: Always
args:
- --domain-filter="example.com"
- --netcup-customer-id="YOUR_CUSTOMER_ID"
- --log-level=debug
- --domain-filter=YOUR_DOMAIN
- --netcup-customer-id=YOUR_ID
env:
- name: NETCUP_API_KEY
valueFrom:
Expand Down Expand Up @@ -104,7 +143,8 @@ kind: Service
metadata:
name: nginx
annotations:
external-dns.alpha.kubernetes.io/hostname: example.com
external-dns.alpha.kubernetes.io/hostname: test.example.com
external-dns.alpha.kubernetes.io/internal-hostname: internaltest.example.com
spec:
selector:
app: nginx
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.3
0.0.4
43 changes: 40 additions & 3 deletions example/external-dns.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: external-dns
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: external-dns
rules:
- apiGroups: [""]
resources: ["services","endpoints","pods"]
verbs: ["get","watch","list"]
- apiGroups: ["extensions","networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get","watch","list"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: external-dns-viewer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -13,18 +46,22 @@ spec:
labels:
app: external-dns
spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.k8s.io/external-dns/external-dns:v0.14.0
args:
- --log-level=debug
- --source=ingress
- --source=service
- --provider=webhook
- name: external-dns-webhook-provider
image: ghcr.io/mrueg/external-dns-netcup-webhook:main
image: ghcr.io/mrueg/external-dns-netcup-webhook:latest
imagePullPolicy: Always
args:
- --domain-filter="example.com"
- --netcup-customer-id="YOUR_CUSTOMER_ID"
- --log-level=debug
- --domain-filter=YOUR_DOMAIN
- --netcup-customer-id=YOUR_ID
env:
- name: NETCUP_API_KEY
valueFrom:
Expand Down
3 changes: 2 additions & 1 deletion example/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ kind: Service
metadata:
name: nginx
annotations:
external-dns.alpha.kubernetes.io/hostname: example.com
external-dns.alpha.kubernetes.io/hostname: test.example.com
external-dns.alpha.kubernetes.io/internal-hostname: internaltest.example.com
spec:
selector:
app: nginx
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func buildMetricsServer(registry prometheus.Gatherer, logger log.Logger) *http.S
func buildWebhookServer(logger log.Logger) (*http.ServeMux, error) {
mux := http.NewServeMux()

var rootPath = "/"
var healthzPath = "/healthz"
var recordsPath = "/records"
var adjustEndpointsPath = "/adjustendpoints"
Expand All @@ -170,7 +171,7 @@ func buildWebhookServer(logger log.Logger) (*http.ServeMux, error) {
})

// Add negotiatePath
mux.HandleFunc("/", p.NegotiateHandler)
mux.HandleFunc(rootPath, p.NegotiateHandler)
// Add adjustEndpointsPath
mux.HandleFunc(adjustEndpointsPath, p.AdjustEndpointsHandler)
// Add recordsPath
Expand Down

0 comments on commit cf7cd9c

Please sign in to comment.