本文整理汇总了Golang中k8s/io/kubernetes/pkg/api/unversioned.GroupVersionKind类的典型用法代码示例。如果您正苦于以下问题:Golang GroupVersionKind类的具体用法?Golang GroupVersionKind怎么用?Golang GroupVersionKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GroupVersionKind类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: getRequestOptions
func getRequestOptions(req *restful.Request, scope RequestScope, internalKind, externalKind unversioned.GroupVersionKind, subpath bool, subpathKey string) (runtime.Object, error) {
if internalKind.IsEmpty() {
return nil, nil
}
query := req.Request.URL.Query()
if subpath {
newQuery := make(url.Values)
for k, v := range query {
newQuery[k] = v
}
newQuery[subpathKey] = []string{req.PathParameter("path")}
query = newQuery
}
versioned, err := scope.Creater.New(externalKind)
if err != nil {
return nil, err
}
if err := scope.Codec.DecodeParametersInto(query, versioned); err != nil {
return nil, errors.NewBadRequest(err.Error())
}
out, err := scope.Convertor.ConvertToVersion(versioned, internalKind.GroupVersion().String())
if err != nil {
// programmer error
return nil, err
}
return out, nil
}
开发者ID:alexhersh,项目名称:kubernetes,代码行数:30,代码来源:resthandler.go
示例2: checkNamespace
// checkNamespace makes sure that the scope of gvk matches ns. It
// returns an error if namespace is empty but gvk is a namespaced
// kind, or if ns is non-empty and gvk is a namespaced kind.
func checkNamespace(gvk unversioned.GroupVersionKind, ns string) error {
group, err := registered.Group(gvk.Group)
if err != nil {
return err
}
mapping, err := group.RESTMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
return err
}
switch mapping.Scope.Name() {
case meta.RESTScopeNameRoot:
if ns != "" {
return fmt.Errorf("namespace specified for a non-namespaced kind %s", gvk)
}
case meta.RESTScopeNameNamespace:
if ns == "" {
// Skipping this check for Events, since
// controllers emit events that have no namespace,
// even though Event is a namespaced resource.
if gvk.Kind != "Event" {
return fmt.Errorf("no namespace specified for a namespaced kind %s", gvk)
}
}
}
return nil
}
开发者ID:RyanBinfeng,项目名称:kubernetes,代码行数:30,代码来源:fixture.go
示例3: getResourceKind
// getResourceKind returns the external group version kind registered for the given storage
// object. If the storage object is a subresource and has an override supplied for it, it returns
// the group version kind supplied in the override.
func (a *APIInstaller) getResourceKind(path string, storage rest.Storage) (unversioned.GroupVersionKind, error) {
if fqKindToRegister, ok := a.group.SubresourceGroupVersionKind[path]; ok {
return fqKindToRegister, nil
}
object := storage.New()
fqKinds, err := a.group.Typer.ObjectKinds(object)
if err != nil {
return unversioned.GroupVersionKind{}, err
}
// a given go type can have multiple potential fully qualified kinds. Find the one that corresponds with the group
// we're trying to register here
fqKindToRegister := unversioned.GroupVersionKind{}
for _, fqKind := range fqKinds {
if fqKind.Group == a.group.GroupVersion.Group {
fqKindToRegister = a.group.GroupVersion.WithKind(fqKind.Kind)
break
}
// TODO This keeps it doing what it was doing before, but it doesn't feel right.
if fqKind.Group == extensions.GroupName && fqKind.Kind == "ThirdPartyResourceData" {
fqKindToRegister = a.group.GroupVersion.WithKind(fqKind.Kind)
}
}
if fqKindToRegister.IsEmpty() {
return unversioned.GroupVersionKind{}, fmt.Errorf("unable to locate fully qualified kind for %v: found %v when registering for %v", reflect.TypeOf(object), fqKinds, a.group.GroupVersion)
}
return fqKindToRegister, nil
}
开发者ID:CNDonny,项目名称:scope,代码行数:33,代码来源:api_installer.go
示例4: ClientForGroupVersionKind
// ClientForGroupVersion returns a client for the specified groupVersion, creates one if none exists. Kind
// in the GroupVersionKind may be empty.
func (c *clientPoolImpl) ClientForGroupVersionKind(kind unversioned.GroupVersionKind) (*Client, error) {
c.lock.Lock()
defer c.lock.Unlock()
gv := kind.GroupVersion()
// do we have a client already configured?
if existingClient, found := c.clients[gv]; found {
return existingClient, nil
}
// avoid changing the original config
confCopy := *c.config
conf := &confCopy
// we need to set the api path based on group version, if no group, default to legacy path
conf.APIPath = c.apiPathResolverFunc(kind)
// we need to make a client
conf.GroupVersion = &gv
if conf.NegotiatedSerializer == nil {
streamingInfo, _ := api.Codecs.StreamingSerializerForMediaType("application/json;stream=watch", nil)
conf.NegotiatedSerializer = serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{Serializer: dynamicCodec{}}, streamingInfo)
}
dynamicClient, err := NewClient(conf)
if err != nil {
return nil, err
}
c.clients[gv] = dynamicClient
return dynamicClient, nil
}
开发者ID:ncdc,项目名称:kubernetes,代码行数:35,代码来源:client_pool.go
示例5: KindToResource
// KindToResource converts Kind to a resource name.
func KindToResource(kind unversioned.GroupVersionKind, mixedCase bool) (plural, singular unversioned.GroupVersionResource) {
kindName := kind.Kind
if len(kindName) == 0 {
return
}
if mixedCase {
// Legacy support for mixed case names
singular = kind.GroupVersion().WithResource(strings.ToLower(kindName[:1]) + kindName[1:])
} else {
singular = kind.GroupVersion().WithResource(strings.ToLower(kindName))
}
singularName := singular.Resource
if strings.HasSuffix(singularName, "endpoints") || strings.HasSuffix(singularName, "securitycontextconstraints") {
plural = singular
} else {
switch string(singularName[len(singularName)-1]) {
case "s":
plural = kind.GroupVersion().WithResource(singularName + "es")
case "y":
plural = kind.GroupVersion().WithResource(strings.TrimSuffix(singularName, "y") + "ies")
default:
plural = kind.GroupVersion().WithResource(singularName + "s")
}
}
return
}
开发者ID:jfcoz,项目名称:origin,代码行数:28,代码来源:restmapper.go
示例6: ClientForGroupVersionKind
// ClientForGroupVersion returns a client for the specified groupVersion, creates one if none exists. Kind
// in the GroupVersionKind may be empty.
func (c *clientPoolImpl) ClientForGroupVersionKind(kind unversioned.GroupVersionKind) (*Client, error) {
c.lock.Lock()
defer c.lock.Unlock()
gv := kind.GroupVersion()
// do we have a client already configured?
if existingClient, found := c.clients[gv]; found {
return existingClient, nil
}
// avoid changing the original config
confCopy := *c.config
conf := &confCopy
// we need to set the api path based on group version, if no group, default to legacy path
conf.APIPath = c.apiPathResolverFunc(kind)
// we need to make a client
conf.GroupVersion = &gv
dynamicClient, err := NewClient(conf)
if err != nil {
return nil, err
}
c.clients[gv] = dynamicClient
return dynamicClient, nil
}
开发者ID:Q-Lee,项目名称:kubernetes,代码行数:30,代码来源:client_pool.go
示例7: SwaggerSchema
func (f *factory) SwaggerSchema(gvk unversioned.GroupVersionKind) (*swagger.ApiDeclaration, error) {
version := gvk.GroupVersion()
clientset, err := f.clients.ClientSetForVersion(&version)
if err != nil {
return nil, err
}
return clientset.Discovery().SwaggerSchema(version)
}
开发者ID:Random-Liu,项目名称:kubernetes,代码行数:8,代码来源:factory.go
示例8: GetPrinters
func (n *NodeOptions) GetPrinters(gvk unversioned.GroupVersionKind) (kubectl.ResourcePrinter, error) {
mapping, err := n.Mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
return nil, err
}
return n.Printer(mapping, kubectl.PrintOptions{})
}
开发者ID:pweil-,项目名称:origin,代码行数:8,代码来源:node_options.go
示例9: Kind
func (o objects) Kind(gvk unversioned.GroupVersionKind, name string) (runtime.Object, error) {
// TODO our test clients deal in internal versions. We need to plumb that knowledge down here
// we might do this via an extra function to the scheme to allow getting internal group versions
// I'm punting for now
gvk.Version = ""
empty, _ := o.scheme.New(gvk.GroupVersion().String(), gvk.Kind)
nilValue := reflect.Zero(reflect.TypeOf(empty)).Interface().(runtime.Object)
arr, ok := o.types[gvk.Kind]
if !ok {
if strings.HasSuffix(gvk.Kind, "List") {
itemKind := gvk.Kind[:len(gvk.Kind)-4]
arr, ok := o.types[itemKind]
if !ok {
return empty, nil
}
out, err := o.scheme.New(gvk.GroupVersion().String(), gvk.Kind)
if err != nil {
return nilValue, err
}
if err := meta.SetList(out, arr); err != nil {
return nilValue, err
}
if out, err = o.scheme.Copy(out); err != nil {
return nilValue, err
}
return out, nil
}
return nilValue, errors.NewNotFound(gvk.Kind, name)
}
index := o.last[gvk.Kind]
if index >= len(arr) {
index = len(arr) - 1
}
if index < 0 {
return nilValue, errors.NewNotFound(gvk.Kind, name)
}
out, err := o.scheme.Copy(arr[index])
if err != nil {
return nilValue, err
}
o.last[gvk.Kind] = index + 1
if status, ok := out.(*unversioned.Status); ok {
if status.Details != nil {
status.Details.Kind = gvk.Kind
}
if status.Status != unversioned.StatusSuccess {
return nilValue, &errors.StatusError{ErrStatus: *status}
}
}
return out, nil
}
开发者ID:tacy,项目名称:dashboard,代码行数:56,代码来源:fixture.go
示例10: RunExplain
// RunExplain executes the appropriate steps to print a model's documentation
func RunExplain(f *cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, args []string) error {
if len(args) == 0 {
fmt.Fprint(cmdErr, "You must specify the type of resource to explain. ", valid_resources)
return cmdutil.UsageError(cmd, "Required resource not specified.")
}
if len(args) > 1 {
return cmdutil.UsageError(cmd, "We accept only this format: explain RESOURCE")
}
recursive := cmdutil.GetFlagBool(cmd, "recursive")
apiVersionString := cmdutil.GetFlagString(cmd, "api-version")
apiVersion := unversioned.GroupVersion{}
mapper, _ := f.Object(cmdutil.GetIncludeThirdPartyAPIs(cmd))
// TODO: After we figured out the new syntax to separate group and resource, allow
// the users to use it in explain (kubectl explain <group><syntax><resource>).
// Refer to issue #16039 for why we do this. Refer to PR #15808 that used "/" syntax.
inModel, fieldsPath, err := kubectl.SplitAndParseResourceRequest(args[0], mapper)
if err != nil {
return err
}
// TODO: We should deduce the group for a resource by discovering the supported resources at server.
fullySpecifiedGVR, groupResource := unversioned.ParseResourceArg(inModel)
gvk := unversioned.GroupVersionKind{}
if fullySpecifiedGVR != nil {
gvk, _ = mapper.KindFor(*fullySpecifiedGVR)
}
if gvk.Empty() {
gvk, err = mapper.KindFor(groupResource.WithVersion(""))
if err != nil {
return err
}
}
if len(apiVersionString) == 0 {
groupMeta, err := registered.Group(gvk.Group)
if err != nil {
return err
}
apiVersion = groupMeta.GroupVersion
} else {
apiVersion, err = unversioned.ParseGroupVersion(apiVersionString)
if err != nil {
return nil
}
}
schema, err := f.SwaggerSchema(apiVersion.WithKind(gvk.Kind))
if err != nil {
return err
}
return kubectl.PrintModelDescription(inModel, fieldsPath, out, schema, recursive)
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:57,代码来源:explain.go
示例11: copyKindDefaults
// copyKindDefaults defaults dst to the value in src if dst does not have a value set.
func copyKindDefaults(dst, src *unversioned.GroupVersionKind) {
if src == nil {
return
}
// apply kind and version defaulting from provided default
if len(dst.Kind) == 0 {
dst.Kind = src.Kind
}
if len(dst.Version) == 0 && len(src.Version) > 0 {
dst.Group = src.Group
dst.Version = src.Version
}
}
开发者ID:timstclair,项目名称:kube-contrib,代码行数:14,代码来源:protobuf.go
示例12: DecodeIntoWithSpecifiedVersionKind
// DecodeIntoWithSpecifiedVersionKind compares the passed in requestGroupVersionKind
// with data.Version and data.Kind, defaulting data.Version and
// data.Kind to the specified value if they are empty, or generating an error if
// data.Version and data.Kind are not empty and differ from the specified value.
// The function then implements the functionality of DecodeInto.
// If specifiedVersion and specifiedKind are empty, the function degenerates to
// DecodeInto.
func (s *Scheme) DecodeIntoWithSpecifiedVersionKind(data []byte, obj interface{}, requestedGVK unversioned.GroupVersionKind) error {
if len(data) == 0 {
return errors.New("empty input")
}
dataVersion, dataKind, err := s.DataVersionAndKind(data)
if err != nil {
return err
}
if dataVersion == "" {
dataVersion = requestedGVK.GroupVersion().String()
}
if dataKind == "" {
dataKind = requestedGVK.Kind
}
if (len(requestedGVK.Group) > 0 || len(requestedGVK.Version) > 0) && (dataVersion != requestedGVK.GroupVersion().String()) {
return errors.New(fmt.Sprintf("The apiVersion in the data (%s) does not match the specified apiVersion(%v)", dataVersion, requestedGVK.GroupVersion()))
}
if len(requestedGVK.Kind) > 0 && (dataKind != requestedGVK.Kind) {
return errors.New(fmt.Sprintf("The kind in the data (%s) does not match the specified kind(%v)", dataKind, requestedGVK))
}
objVersion, objKind, err := s.ObjectVersionAndKind(obj)
if err != nil {
return err
}
if dataKind == "" {
// Assume objects with unset Kind fields are being unmarshalled into the
// correct type.
dataKind = objKind
}
if dataVersion == "" {
// Assume objects with unset Version fields are being unmarshalled into the
// correct type.
dataVersion = objVersion
}
external, err := s.NewObject(dataVersion, dataKind)
if err != nil {
return err
}
if err := codec.NewDecoderBytes(data, new(codec.JsonHandle)).Decode(external); err != nil {
return err
}
flags, meta := s.generateConvertMeta(dataVersion, objVersion, external)
if err := s.converter.Convert(external, obj, flags, meta); err != nil {
return err
}
// Version and Kind should be blank in memory.
return s.SetVersionAndKind("", "", obj)
}
开发者ID:tacy,项目名称:dashboard,代码行数:58,代码来源:decode.go
示例13: GetPrinters
func (n *NodeOptions) GetPrinters(gvk unversioned.GroupVersionKind) (kubectl.ResourcePrinter, kubectl.ResourcePrinter, error) {
mapping, err := n.Mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
return nil, nil, err
}
printerWithHeaders, err := n.Printer(mapping, false, false, false, false, false, false, []string{})
if err != nil {
return nil, nil, err
}
printerNoHeaders, err := n.Printer(mapping, true, false, false, false, false, false, []string{})
if err != nil {
return nil, nil, err
}
return printerWithHeaders, printerNoHeaders, nil
}
开发者ID:RomainVabre,项目名称:origin,代码行数:16,代码来源:node_options.go
示例14: New
func (t *thirdPartyResourceDataCreator) New(kind unversioned.GroupVersionKind) (out runtime.Object, err error) {
switch kind.Kind {
case "ThirdPartyResourceData":
if apiutil.GetGroupVersion(t.group, t.version) != kind.GroupVersion().String() {
return nil, fmt.Errorf("unknown kind %v", kind)
}
return &extensions.ThirdPartyResourceData{}, nil
case "ThirdPartyResourceDataList":
if apiutil.GetGroupVersion(t.group, t.version) != kind.GroupVersion().String() {
return nil, fmt.Errorf("unknown kind %v", kind)
}
return &extensions.ThirdPartyResourceDataList{}, nil
default:
return t.delegate.New(kind)
}
}
开发者ID:erinboyd,项目名称:origin,代码行数:16,代码来源:codec.go
示例15: mappingFor
// mappingFor returns the RESTMapping for the Kind referenced by the resource.
// prefers a fully specified GroupVersionResource match. If we don't have one match on GroupResource
func (b *Builder) mappingFor(resourceArg string) (*meta.RESTMapping, error) {
fullySpecifiedGVR, groupResource := unversioned.ParseResourceArg(resourceArg)
gvk := unversioned.GroupVersionKind{}
if fullySpecifiedGVR != nil {
gvk, _ = b.mapper.KindFor(*fullySpecifiedGVR)
}
if gvk.Empty() {
var err error
gvk, err = b.mapper.KindFor(groupResource.WithVersion(""))
if err != nil {
return nil, err
}
}
return b.mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
}
开发者ID:eljefedelrodeodeljefe,项目名称:kubernetes,代码行数:18,代码来源:builder.go
示例16: Kind
func (o objects) Kind(kind unversioned.GroupVersionKind, name string) (runtime.Object, error) {
if len(kind.Version) == 0 {
kind.Version = runtime.APIVersionInternal
}
empty, err := o.scheme.New(kind)
nilValue := reflect.Zero(reflect.TypeOf(empty)).Interface().(runtime.Object)
arr, ok := o.types[kind.Kind]
if !ok {
if strings.HasSuffix(kind.Kind, "List") {
itemKind := kind.Kind[:len(kind.Kind)-4]
arr, ok := o.types[itemKind]
if !ok {
return empty, nil
}
out, err := o.scheme.New(kind)
if err != nil {
return nilValue, err
}
if err := meta.SetList(out, arr); err != nil {
return nilValue, err
}
if out, err = o.scheme.Copy(out); err != nil {
return nilValue, err
}
return out, nil
}
return nilValue, errors.NewNotFound(unversioned.GroupResource{Group: kind.Group, Resource: kind.Kind}, name)
}
index := o.last[kind.Kind]
if index >= len(arr) {
index = len(arr) - 1
}
if index < 0 {
return nilValue, errors.NewNotFound(unversioned.GroupResource{Group: kind.Group, Resource: kind.Kind}, name)
}
out, err := o.scheme.Copy(arr[index])
if err != nil {
return nilValue, err
}
o.last[kind.Kind] = index + 1
if status, ok := out.(*unversioned.Status); ok {
if status.Details != nil {
status.Details.Kind = kind.Kind
}
if status.Status != unversioned.StatusSuccess {
return nilValue, &errors.StatusError{ErrStatus: *status}
}
}
return out, nil
}
开发者ID:40a,项目名称:bootkube,代码行数:54,代码来源:fixture.go
示例17: doDeepCopyTest
func doDeepCopyTest(t *testing.T, kind unversioned.GroupVersionKind, f *fuzz.Fuzzer) {
item, err := api.Scheme.New(kind)
if err != nil {
t.Fatalf("Could not create a %v: %s", kind, err)
}
f.Fuzz(item)
itemCopy, err := api.Scheme.DeepCopy(item)
if err != nil {
t.Errorf("Could not deep copy a %v: %s", kind, err)
return
}
if !reflect.DeepEqual(item, itemCopy) {
t.Errorf("\nexpected: %#v\n\ngot: %#v\n\ndiff: %v", item, itemCopy, diff.ObjectReflectDiff(item, itemCopy))
}
prefuzzData := &bytes.Buffer{}
if err := api.Codecs.LegacyCodec(kind.GroupVersion()).Encode(item, prefuzzData); err != nil {
t.Errorf("Could not encode a %v: %s", kind, err)
return
}
// Refuzz the copy, which should have no effect on the original
f.Fuzz(itemCopy)
postfuzzData := &bytes.Buffer{}
if err := api.Codecs.LegacyCodec(kind.GroupVersion()).Encode(item, postfuzzData); err != nil {
t.Errorf("Could not encode a %v: %s", kind, err)
return
}
if bytes.Compare(prefuzzData.Bytes(), postfuzzData.Bytes()) != 0 {
t.Log(diff.StringDiff(prefuzzData.String(), postfuzzData.String()))
t.Errorf("Fuzzing copy modified original of %#v", kind)
return
}
}
开发者ID:Q-Lee,项目名称:kubernetes,代码行数:37,代码来源:copy_test.go
示例18: KindToResource
// KindToResource converts Kind to a resource name.
// Broken. This method only "sort of" works when used outside of this package. It assumes that Kinds and Resources match
// and they aren't guaranteed to do so.
func KindToResource(kind unversioned.GroupVersionKind) ( /*plural*/ unversioned.GroupVersionResource /*singular*/, unversioned.GroupVersionResource) {
kindName := kind.Kind
if len(kindName) == 0 {
return unversioned.GroupVersionResource{}, unversioned.GroupVersionResource{}
}
singularName := strings.ToLower(kindName)
singular := kind.GroupVersion().WithResource(singularName)
for _, skip := range unpluralizedSuffixes {
if strings.HasSuffix(singularName, skip) {
return singular, singular
}
}
switch string(singularName[len(singularName)-1]) {
case "s":
return kind.GroupVersion().WithResource(singularName + "es"), singular
case "y":
return kind.GroupVersion().WithResource(strings.TrimSuffix(singularName, "y") + "ies"), singular
}
return kind.GroupVersion().WithResource(singularName + "s"), singular
}
开发者ID:RomainVabre,项目名称:origin,代码行数:26,代码来源:restmapper.go
示例19: DecodeIntoWithSpecifiedVersionKind
func (t *thirdPartyResourceDataCodec) DecodeIntoWithSpecifiedVersionKind(data []byte, obj runtime.Object, gvk unversioned.GroupVersionKind) error {
thirdParty, ok := obj.(*extensions.ThirdPartyResourceData)
if !ok {
return fmt.Errorf("unexpected object: %#v", obj)
}
if gvk.Kind != "ThirdPartyResourceData" {
return fmt.Errorf("unexpeceted kind: %s", gvk.Kind)
}
var dataObj interface{}
if err := json.Unmarshal(data, &dataObj); err != nil {
return err
}
mapObj, ok := dataObj.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpcted object: %#v", dataObj)
}
if kindObj, found := mapObj["kind"]; !found {
mapObj["kind"] = gvk.Kind
} else {
kindStr, ok := kindObj.(string)
if !ok {
return fmt.Errorf("unexpected object for 'kind': %v", kindObj)
}
if kindStr != t.kind {
return fmt.Errorf("kind doesn't match, expecting: %s, got %s", gvk.Kind, kindStr)
}
}
if versionObj, found := mapObj["apiVersion"]; !found {
mapObj["apiVersion"] = gvk.GroupVersion().String()
} else {
versionStr, ok := versionObj.(string)
if !ok {
return fmt.Errorf("unexpected object for 'apiVersion': %v", versionObj)
}
if versionStr != gvk.GroupVersion().String() {
return fmt.Errorf("version doesn't match, expecting: %v, got %s", gvk.GroupVersion(), versionStr)
}
}
if err := t.populate(thirdParty, data); err != nil {
return err
}
return nil
}
开发者ID:fwalker,项目名称:dashboard,代码行数:46,代码来源:codec.go
示例20: New
func (t *thirdPartyResourceDataCreator) New(kind unversioned.GroupVersionKind) (out runtime.Object, err error) {
switch kind.Kind {
case "ThirdPartyResourceData":
if apiutil.GetGroupVersion(t.group, t.version) != kind.GroupVersion().String() {
return nil, fmt.Errorf("unknown kind %v", kind)
}
return &extensions.ThirdPartyResourceData{}, nil
case "ThirdPartyResourceDataList":
if apiutil.GetGroupVersion(t.group, t.version) != kind.GroupVersion().String() {
return nil, fmt.Errorf("unknown kind %v", kind)
}
return &extensions.ThirdPartyResourceDataList{}, nil
case "ListOptions":
if apiutil.GetGroupVersion(t.group, t.version) == kind.GroupVersion().String() {
// Translate third party group to external group.
gvk := registered.EnabledVersionsForGroup(api.GroupName)[0].WithKind(kind.Kind)
return t.delegate.New(gvk)
}
return t.delegate.New(kind)
default:
return t.delegate.New(kind)
}
}
开发者ID:RomainVabre,项目名称:origin,代码行数:23,代码来源:codec.go
注:本文中的k8s/io/kubernetes/pkg/api/unversioned.GroupVersionKind类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论