-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit implements filterring results based on hand crafted GeoIP database with private networks and tags. Signed-off-by: Dinar Valeev <[email protected]> Co-authored-by: Yury Tsarev <[email protected]>
- Loading branch information
Showing
16 changed files
with
611 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: externaldns.k8s.io/v1alpha1 | ||
kind: DNSEndpoint | ||
metadata: | ||
name: geo-test | ||
labels: | ||
k8gb.absa.oss/dnstype: local | ||
spec: | ||
endpoints: | ||
- dnsName: geo.example.org | ||
recordType: A | ||
labels: | ||
strategy: "geoip" | ||
targets: | ||
- 192.200.1.5 | ||
- 192.200.1.10 | ||
- 192.200.2.5 | ||
- 192.200.2.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This is an example program used to generate `geoip.mmdb` for e2e test. | ||
|
||
I order to execute it, simply run: `go run main.go` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net" | ||
"os" | ||
|
||
"github.com/maxmind/mmdbwriter" | ||
"github.com/maxmind/mmdbwriter/inserter" | ||
"github.com/maxmind/mmdbwriter/mmdbtype" | ||
) | ||
|
||
func main() { | ||
fh, err := os.Create("geoip.mmdb") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
writer, _ := mmdbwriter.New( | ||
mmdbwriter.Options{ | ||
DatabaseType: "Test-IP-DB", | ||
RecordSize: 24, | ||
IPVersion: 4, | ||
}, | ||
) | ||
_, absaSDCNet, _ := net.ParseCIDR("192.200.1.0/24") | ||
_, absa270Net, _ := net.ParseCIDR("192.200.2.0/24") | ||
|
||
absaSDCData := mmdbtype.Map{ | ||
"datacenter": mmdbtype.String("site1"), | ||
} | ||
|
||
absa270Data := mmdbtype.Map{ | ||
"datacenter": mmdbtype.String("site2"), | ||
} | ||
|
||
if err := writer.InsertFunc(absaSDCNet, inserter.TopLevelMergeWith(absaSDCData)); err != nil { | ||
log.Fatal(err) | ||
} | ||
if err := writer.InsertFunc(absa270Net, inserter.TopLevelMergeWith(absa270Data)); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
_, err = writer.WriteTo(fh) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
coredns: | ||
extraVolumes: | ||
- name: geo-data | ||
configMap: | ||
name: geodata | ||
extraVolumeMounts: | ||
- name: geo-data | ||
mountPath: /geoip.mmdb | ||
subPath: geoip.mmdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.