mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-07-20 12:51:43 -04:00
Feature request: Kubernetes API & external-dns as a provider #96
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MOZGIII on GitHub (Feb 2, 2021).
Originally assigned to: @qdm12 on GitHub.
Teach
ddns-updaterto update the external-dns records in the Kubernetes API (via CRDs).To do. Just posting the idea here for now, will get back to it and fill it in if there are enough 👍 .
@fredericrous commented on GitHub (Feb 7, 2021):
Hi @MOZGIII, could you expand on this and explain the use case?
@MOZGIII commented on GitHub (Feb 8, 2021):
I have a Kubernetes cluster at home that can manage the DNS via an external DNS provider.
I'd like my cluster to also be in charge of updating the dynamic IP address through the same pipeline. There is a number of benefits to this: Kubernetes can be made aware of the IP address of its gateway, enabling some more advanced workflows.
Given it some thought, I am realizing that full-featured Kubernetes integration is probably not a good fit for this codebase - it has other concerns that should remain primary. However, it is possible to build a separate app to manage the Kubernetes state, that would accept simple HTTP requests from the
ddns-updater, and take care of theexternal-dnsstate and other Kubernetes-related maintenance.So, the initial flow I had in mind was
ddns-updater(with direct support) ->kube-apiserver->external-dns, but now I'm thinking aboutddns-updater(as is) ->dynamic-dns-operator(a new thing) ->kube-apiserver->external-dns.@fredericrous commented on GitHub (Feb 8, 2021):
Is there an api endpoint that can be used to update the IP or do we have to generate a Kubernetes spec to do that? Looking at the doc, an endpoint might exist, but Kubernetes doc is a real labyrinth, I didn't find this info.
If the solution relies on just calling an API, no need to create an external package. If the solution is to generate a spec, indeed creating a micro program, that communicates with ddns-updater, makes sense.
@MOZGIII commented on GitHub (Feb 8, 2021):
Since this project uses Go, I don't think generating a spec is a way to talk to Kubernetes, but rather using its own client.
Take a look here for the CRD type: https://github.com/kubernetes-sigs/external-dns/blob/master/endpoint/endpoint.go
We can also implement the connector source: https://github.com/kubernetes-sigs/external-dns/blob/master/source/connector.go
@fredericrous commented on GitHub (Feb 9, 2021):
taking inspiration on external-dns might be the optimal path indeed. But it might be simpler to use the go client instead. There is an example here https://github.com/kubernetes/client-go/blob/master/examples/in-cluster-client-configuration/main.go
And there is a Open API spec: https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json The endpoint to set the IP seems to be io.k8s.api.core.v1.ServiceSpec
@MOZGIII commented on GitHub (Feb 9, 2021):
I don't think you'd actually want to alter
Services (I wouldn't in my use case). I'm using a custom CRD provided by theexternal-dnsproject - the one that actually manages the DNS records at the remote DNS provider.Servicehas some IPs we can set too, but they're not a good fit for these kinds of updates.