plugin/kubernetes: use struct{} was map values (#2125)

This takes less space than a bool, the value isn't used for anything
else than "present in map" any way.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2018-09-22 18:13:33 +01:00 committed by GitHub
parent f98db6b637
commit 6f966eed41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,7 @@ type dnsControl struct {
// watch-related items channel // watch-related items channel
watchChan dnswatch.Chan watchChan dnswatch.Chan
watched map[string]bool watched map[string]struct{}
zones []string zones []string
endpointNameMode bool endpointNameMode bool
} }
@ -105,7 +105,7 @@ func newdnsController(kubeClient *kubernetes.Clientset, opts dnsControlOpts) *dn
client: kubeClient, client: kubeClient,
selector: opts.selector, selector: opts.selector,
stopCh: make(chan struct{}), stopCh: make(chan struct{}),
watched: make(map[string]bool), watched: make(map[string]struct{}),
zones: opts.zones, zones: opts.zones,
endpointNameMode: opts.endpointNameMode, endpointNameMode: opts.endpointNameMode,
} }
@ -287,7 +287,7 @@ func (dns *dnsControl) Watch(qname string) error {
if dns.watchChan == nil { if dns.watchChan == nil {
return fmt.Errorf("cannot start watch because the channel has not been set") return fmt.Errorf("cannot start watch because the channel has not been set")
} }
dns.watched[qname] = true dns.watched[qname] = struct{}{}
return nil return nil
} }