mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
kubernetes: add multicluster support (#7266)
* kubernetes: add multicluster support Add multicluster support via Multi-Cluster Services API (MCS-API) via a new option `multiclusterZones` in the kubernetes plugin. When some multicluster zones are passed to the kubernetes plugin, it will start watching the ServiceImport objects and its associated EndpointSlices. Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> * kubernetes: implement xfr support for multicluster zones Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>
This commit is contained in:
committed by
GitHub
parent
76b199f829
commit
5c71bd0b87
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -229,6 +230,8 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) {
|
||||
overrides,
|
||||
)
|
||||
k8s.ClientConfig = config
|
||||
case "multicluster":
|
||||
k8s.opts.multiclusterZones = plugin.OriginsFromArgsOrServerBlock(c.RemainingArgs(), []string{})
|
||||
default:
|
||||
return nil, c.Errf("unknown property '%s'", c.Val())
|
||||
}
|
||||
@@ -238,6 +241,13 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) {
|
||||
return nil, c.Errf("namespaces and namespace_labels cannot both be set")
|
||||
}
|
||||
|
||||
for _, multiclusterZone := range k8s.opts.multiclusterZones {
|
||||
if !slices.Contains(k8s.Zones, multiclusterZone) {
|
||||
fmt.Println(k8s.Zones)
|
||||
return nil, c.Errf("is not authoritative for the multicluster zone %s", multiclusterZone)
|
||||
}
|
||||
}
|
||||
|
||||
return k8s, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user