Commit fc955fd1 authored by Jiang Biao's avatar Jiang Biao Committed by GitHub

[feat]:update the kubernets.go fix npe (#4338)

Signed-off-by: default avatarBiao Jiang <standup-jb@github.com>
Co-authored-by: default avatarbiao.jiang@ximalaya.com <biao.jiang@ximalaya.com>
parent be955daa
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment