mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 16:54:15 -04:00
[feat]:update the kubernets.go fix npe (#4338)
Signed-off-by: Biao Jiang <standup-jb@github.com> Co-authored-by: biao.jiang@ximalaya.com <biao.jiang@ximalaya.com>
This commit is contained in:
@@ -252,7 +252,10 @@ func (k *Kubernetes) InitKubeCache(ctx context.Context) (err error) {
|
||||
}
|
||||
// Disable use of endpoint slices for k8s versions 1.18 and earlier. Endpoint slices were
|
||||
// introduced in 1.17 but EndpointSliceMirroring was not added until 1.19.
|
||||
sv, _ := kubeClient.ServerVersion()
|
||||
sv, err := kubeClient.ServerVersion()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
major, _ := strconv.Atoi(sv.Major)
|
||||
minor, _ := strconv.Atoi(sv.Minor)
|
||||
if k.opts.useEndpointSlices && major <= 1 && minor <= 18 {
|
||||
|
||||
Reference in New Issue
Block a user