nigoroll / libvmod-dynamic

The Varnish dns/named director continued
BSD 2-Clause "Simplified" License
95 stars 34 forks source link

Help wanted: configure dynamic backend via SRV Records #120

Closed am4rth closed 2 weeks ago

am4rth commented 2 weeks ago

Hello,

i'm currently tring to get varnish running with dynamic backend servers provied via SRV DNS Records.

Resolving the domains via host is no problem, the following data is returned:

# host -t SRV service.namespace.local
service.namespace.localhas SRV record 1 1 32768 995a7bee76fa40b194e2b761b9dfb90a.service.namespace.local.

This is my varnish config:

backend default none;

sub vcl_init {
  new r = dynamic.resolver();
  new d = dynamic.director(
          resolver = r.use(),
  );
}

sub vcl_recv {
    set req.backend_hint = d.service("service.namespace.local");

    # more config to come
}

When ever I try to perform a request, the resolution via getdns seems to fail:

0 Timestamp      - vmod-dynamic boot.d(srv service.namespace.local) Lookup: 1724930480.177774 0.000000 0.000000
0 Timestamp      - vmod-dynamic boot.d(srv service.namespace.local) Results: 1724930480.177919 0.000145 0.000145
0 Error          - vmod-dynamic boot d service.namespace.local getdns 901 (Queries for the name yielded all negative responses)

Do I miss something? Sorry if it's a obvious problem, not as experienced in varnish config.

Thanks in advance!

nigoroll commented 2 weeks ago

did you try

sub vcl_init {
  r.set_resolution_type(STUB);
}

?

am4rth commented 2 weeks ago

Works like a charm thank you very much!