mirror of
https://github.com/certimate-go/certimate.git
synced 2026-09-24 23:10:13 +08:00
fix: #1412
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
k8score "k8s.io/api/core/v1"
|
||||
k8serrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
|
||||
@@ -222,6 +224,15 @@ func createK8sClient(kubeConfig string) (*rest.RESTClient, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// InClusterConfig does not set GroupVersion or NegotiatedSerializer,
|
||||
// but both are required by rest.RESTClientFor.
|
||||
if config.GroupVersion == nil {
|
||||
config.GroupVersion = &schema.GroupVersion{Group: "", Version: "v1"}
|
||||
}
|
||||
if config.NegotiatedSerializer == nil {
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
}
|
||||
|
||||
client, err := rest.RESTClientFor(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user