From cf7cd9cde0edbb9f192227e3b3a41d56ae46e77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Sun, 3 Dec 2023 20:18:16 +0100 Subject: [PATCH] Release version 0.0.4 --- README.md | 48 +++++++++++++++++++++++++++++++++++---- VERSION | 2 +- example/external-dns.yaml | 43 ++++++++++++++++++++++++++++++++--- example/nginx.yaml | 3 ++- main.go | 3 ++- 5 files changed, 89 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4a930b9..84f2a4e 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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: @@ -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: @@ -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 diff --git a/VERSION b/VERSION index bcab45a..81340c7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.3 +0.0.4 diff --git a/example/external-dns.yaml b/example/external-dns.yaml index 53f671e..db559fe 100644 --- a/example/external-dns.yaml +++ b/example/external-dns.yaml @@ -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: @@ -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: diff --git a/example/nginx.yaml b/example/nginx.yaml index daba11e..4371c85 100644 --- a/example/nginx.yaml +++ b/example/nginx.yaml @@ -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 diff --git a/main.go b/main.go index 928c581..34d3660 100644 --- a/main.go +++ b/main.go @@ -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" @@ -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