Skip to content

Domain filter on ingress rule, but FQDN template for name generation #2627

@adyanth

Description

@adyanth
STOP -- PLEASE READ!

GitHub is not the right place for support requests.
 > It is the only place I have.
If you're looking for help, check our [docs](https://github.com/kubernetes-sigs/external-dns/tree/HEAD/docs).
 > The docs miss explaining a lot of the concepts that I already tried to understand from the code
You can also post your question on the [Kubernetes Slack #external-dns](https://kubernetes.slack.com/archives/C771MKDKQ).
 > I do not have access to it

Current setup

I am trying a unique configuration due to my split DNS resolver setup.
Here is the external-dns config:

          image: k8s.gcr.io/external-dns/external-dns:v0.10.2
          args:
            - --registry=txt
            - --txt-prefix=external-dns-
            - --txt-owner-id=kratos-cluster
            - --provider=rfc2136
            - --rfc2136-host=10.10.10.3
            - --rfc2136-port=53535
            - --rfc2136-zone=rpz
            - --rfc2136-tsig-secret-alg=hmac-sha256
            - --rfc2136-tsig-keyname=externaldns
            - --rfc2136-tsig-secret=***REDACTED***
            - --rfc2136-tsig-axfr
            - --source=ingress
            - --ignore-ingress-rules-spec
            - --combine-fqdn-annotation
            - --fqdn-template={{.Name}}.adyanth.site.rpz
            - --domain-filter=adyanth.site.rpz
            - --log-level=debug

The target is a bind9 RPZ zone.

What is working

After a day inside the source code, I understood enough of the logic to use combine-fqdn-annotation, fqdn-template and domain-filter (which I feel is redundant right now?). Currently the above config generates FQDNs of the form .adyanth.site.rpz for all ingresses.

What I would like to achieve

I would only want external DNS to work on ingresses where the rules is of the form *.adyanth.site. (I do not want the host to be used for DNS, just for validation). So, if the ingress is test.adyanth.site. it should work as it is right now. But if the ingress is test.adyanth.lan, it should not. Currently both scenarios get a DNS entry.

What I think might work?

Can I use the template with conditions to check the rule? From what I understood, the fqdn template is a standard go template and is passed the Ingress spec for templating. Can I use a complex logic to determine if the hosts in Ingress match *.adyanth.site and then set the .rpz so that the fqdn-filter allows it through only in that case?

Is there a better way to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportCategorizes issue or PR as a support question.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions