Skip to content

Commit

Permalink
plugin/geoip: Add GLSB example (coredns#5795)
Browse files Browse the repository at this point in the history
* add glsb example

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
  • Loading branch information
chrisohaver authored Dec 7, 2022
1 parent 47e5893 commit 7813b6e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions plugin/geoip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ The following configuration configures the `City` database, and looks up geoloca
}
```

The *view* plugin can use *geoip* metadata as selection criteria to provide GSLB functionality.
In this example, clients from the city "Exampleshire" will receive answers for `example.com` from the zone defined in
`example.com.exampleshire-db`. All other clients will receive answers from the zone defined in `example.com.db`.
Note that the order of the two `example.com` server blocks below is important; the default viewless server block
must be last.

```txt
example.com {
view exampleshire {
expr metadata('geoip/city/name') == 'Exampleshire'
}
geoip /opt/geoip2/db/GeoLite2-City.mmdb
metadata
file example.com.exampleshire-db
}
example.com {
file example.com.db
}
```

## Metadata Labels

A limited set of fields will be exported as labels, all values are stored using strings **regardless of their underlying value type**, and therefore you may have to convert it back to its original type, note that numeric values are always represented in base 10.
Expand Down

0 comments on commit 7813b6e

Please sign in to comment.