mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-12 21:32:10 +00:00
remove apiserver impor from client-go
Kubernetes-commit: af11c4ac9be74115dfd35ce6f18cfa0440fc3458
This commit is contained in:
committed by
Kubernetes Publisher
parent
10ec231914
commit
d4454993f4
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
@@ -8,7 +24,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/managedfields"
|
||||
"k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager"
|
||||
"k8s.io/client-go/discovery"
|
||||
"k8s.io/kube-openapi/pkg/util/proto"
|
||||
"sigs.k8s.io/structured-merge-diff/v4/typed"
|
||||
@@ -34,13 +49,13 @@ type gvkParserCache struct {
|
||||
// mu protects the gvkParser
|
||||
mu sync.Mutex
|
||||
// gvkParser retrieves the objectType for a given gvk
|
||||
gvkParser *fieldmanager.GvkParser
|
||||
gvkParser *managedfields.GvkParser
|
||||
// lastChecked is the last time we checked if the openAPI doc has changed.
|
||||
lastChecked time.Time
|
||||
}
|
||||
|
||||
// regenerateGVKParser builds the parser from the raw OpenAPI schema.
|
||||
func regenerateGVKParser(dc discovery.DiscoveryInterface) (*fieldmanager.GvkParser, error) {
|
||||
func regenerateGVKParser(dc discovery.DiscoveryInterface) (*managedfields.GvkParser, error) {
|
||||
doc, err := dc.OpenAPISchema()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -51,7 +66,7 @@ func regenerateGVKParser(dc discovery.DiscoveryInterface) (*fieldmanager.GvkPars
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return fieldmanager.NewGVKParser(models, false)
|
||||
return managedfields.NewGVKParser(models, false)
|
||||
}
|
||||
|
||||
// objectTypeForGVK retrieves the typed.ParseableType for a given gvk from the cache
|
||||
|
Reference in New Issue
Block a user