[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:
parent
be955daa37
commit
fc955fd166
1 changed files with 4 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue