K8s Test Cleanup and Service PTR
Change the CI setup for K8s to be simpler. Now it just creates a set of objects via a yaml file, making it very easy to modify the tests. Implement PTR for services.
This commit is contained in:
parent
137fc33b8f
commit
afe4368c34
10 changed files with 248 additions and 314 deletions
|
@ -31,6 +31,7 @@ import (
|
|||
type Kubernetes struct {
|
||||
Next middleware.Handler
|
||||
Zones []string
|
||||
primaryZone int
|
||||
Proxy proxy.Proxy // Proxy for looking up names during the resolution process
|
||||
APIEndpoint string
|
||||
APICertAuth string
|
||||
|
@ -53,6 +54,11 @@ func (k *Kubernetes) Services(state request.Request, exact bool, opt middleware.
|
|||
return s, nil, e // Haven't implemented debug queries yet.
|
||||
}
|
||||
|
||||
// PrimaryZone will return the first non-reverse zone being handled by this middleware
|
||||
func (k *Kubernetes) PrimaryZone() (string) {
|
||||
return k.Zones[k.primaryZone]
|
||||
}
|
||||
|
||||
// Reverse implements the ServiceBackend interface.
|
||||
func (k *Kubernetes) Reverse(state request.Request, exact bool, opt middleware.Options) ([]msg.Service, []msg.Service, error) {
|
||||
ip := dnsutil.ExtractAddressFromReverse(state.Name())
|
||||
|
@ -286,7 +292,8 @@ func (k *Kubernetes) getServiceRecordForIP(ip, name string) []msg.Service {
|
|||
}
|
||||
for _, service := range svcList {
|
||||
if service.Spec.ClusterIP == ip {
|
||||
return []msg.Service{{Host: ip}}
|
||||
name := k.NameTemplate.RecordNameFromNameValues(nametemplate.NameValues{TypeName: "svc", ServiceName: service.ObjectMeta.Name, Namespace: service.ObjectMeta.Namespace, Zone: k.PrimaryZone()})
|
||||
return []msg.Service{msg.Service{Host: name}}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue