aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2022-12-07 06:27:23 -0500
committerGravatar GitHub <noreply@github.com> 2022-12-07 12:27:23 +0100
commit7813b6e09062a1d95d19e305dfed9b7ad81fb1ae (patch)
tree617b2858e75915e2e1b6406936cc44b05c392162
parent47e5893e8815a7260b47f61f8a682a4f35aee91c (diff)
downloadcoredns-7813b6e09062a1d95d19e305dfed9b7ad81fb1ae.tar.gz
coredns-7813b6e09062a1d95d19e305dfed9b7ad81fb1ae.tar.zst
coredns-7813b6e09062a1d95d19e305dfed9b7ad81fb1ae.zip
plugin/geoip: Add GLSB example (#5795)
* add glsb example Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
-rw-r--r--plugin/geoip/README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/plugin/geoip/README.md b/plugin/geoip/README.md
index 9c9a943d2..febad8ad7 100644
--- a/plugin/geoip/README.md
+++ b/plugin/geoip/README.md
@@ -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.