v1

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package v1 provides types for identifying Kubernetes API resources by group, version, and kind without depending on k8s.io/apimachinery.

Portions of this package are adapted from the Kubernetes apimachinery project: https://github.com/kubernetes/apimachinery/blob/v0.34.9/pkg/runtime/schema/group_version.go

Copyright 2015 The Kubernetes Authors. SPDX-License-Identifier: Apache-2.0

+kubebuilder:object:generate=true

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseKindArg added in v0.0.3

func ParseKindArg(arg string) (*GroupVersionKind, GroupKind)

ParseKindArg takes the common style of string which may be either `Kind.group.com` or `Kind.version.group.com` and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended but with a knowledge of all GroupKinds, calling code can take a very good guess. If there are only two segments, then `*GroupVersionKind` is nil. `Kind.group.com` -> `group=com, version=group, kind=Kind` and `group=group.com, kind=Kind`

func ParseResourceArg added in v0.0.3

func ParseResourceArg(arg string) (*GroupVersionResource, GroupResource)

ParseResourceArg takes the common style of string which may be either `resource.group.com` or `resource.version.group.com` and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended but with a knowledge of all GroupVersions, calling code can take a very good guess. If there are only two segments, then `*GroupVersionResource` is nil. `resource.group.com` -> `group=com, version=group, resource=resource` and `group=group.com, resource=resource`

Types

type GroupKind

type GroupKind struct {
	Group string
	Kind  string
}

GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types

func ParseGroupKind

func ParseGroupKind(gk string) GroupKind

func (*GroupKind) DeepCopy added in v0.0.3

func (in *GroupKind) DeepCopy() *GroupKind

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupKind.

func (*GroupKind) DeepCopyInto added in v0.0.3

func (in *GroupKind) DeepCopyInto(out *GroupKind)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (GroupKind) Empty

func (gk GroupKind) Empty() bool

func (GroupKind) String

func (gk GroupKind) String() string

func (GroupKind) WithVersion

func (gk GroupKind) WithVersion(version string) GroupVersionKind

type GroupResource added in v0.0.3

type GroupResource struct {
	Group    string
	Resource string
}

GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types

func ParseGroupResource added in v0.0.3

func ParseGroupResource(gr string) GroupResource

ParseGroupResource turns "resource.group" string into a GroupResource struct. Empty strings are allowed for each field.

func (*GroupResource) DeepCopy added in v0.0.3

func (in *GroupResource) DeepCopy() *GroupResource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupResource.

func (*GroupResource) DeepCopyInto added in v0.0.3

func (in *GroupResource) DeepCopyInto(out *GroupResource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (GroupResource) Empty added in v0.0.3

func (gr GroupResource) Empty() bool

func (GroupResource) String added in v0.0.3

func (gr GroupResource) String() string

func (GroupResource) WithVersion added in v0.0.3

func (gr GroupResource) WithVersion(version string) GroupVersionResource

type GroupVersion

type GroupVersion struct {
	Group   string
	Version string
}

GroupVersion contains the "group" and the "version", which uniquely identifies the API.

func ParseGroupVersion

func ParseGroupVersion(gv string) (GroupVersion, error)

ParseGroupVersion turns "group/version" string into a GroupVersion struct. It reports error if it cannot parse the string.

func (*GroupVersion) DeepCopy added in v0.0.3

func (in *GroupVersion) DeepCopy() *GroupVersion

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupVersion.

func (*GroupVersion) DeepCopyInto added in v0.0.3

func (in *GroupVersion) DeepCopyInto(out *GroupVersion)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (GroupVersion) Empty

func (gv GroupVersion) Empty() bool

Empty returns true if group and version are empty

func (GroupVersion) Identifier added in v0.0.3

func (gv GroupVersion) Identifier() string

Identifier implements runtime.GroupVersioner interface.

func (GroupVersion) KindForGroupVersionKinds added in v0.0.3

func (gv GroupVersion) KindForGroupVersionKinds(kinds []GroupVersionKind) (target GroupVersionKind, ok bool)

KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false if none of the options match the group. It prefers a match to group and version over just group.

func (GroupVersion) String

func (gv GroupVersion) String() string

String puts "group" and "version" into a single "group/version" string. For the legacy v1 it returns "v1".

func (GroupVersion) WithKind

func (gv GroupVersion) WithKind(kind string) GroupVersionKind

WithKind creates a GroupVersionKind based on the method receiver's GroupVersion and the passed Kind.

func (GroupVersion) WithResource added in v0.0.3

func (gv GroupVersion) WithResource(resource string) GroupVersionResource

WithResource creates a GroupVersionResource based on the method receiver's GroupVersion and the passed Resource.

type GroupVersionKind

type GroupVersionKind struct {
	Group   string
	Version string
	Kind    string
}

GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling

func FromAPIVersionAndKind

func FromAPIVersionAndKind(apiVersion, kind string) GroupVersionKind

FromAPIVersionAndKind returns a GVK representing the provided fields for types that do not use TypeMeta. This method exists to support test types and legacy serializations that have a distinct group and kind.

func (*GroupVersionKind) DeepCopy added in v0.0.3

func (in *GroupVersionKind) DeepCopy() *GroupVersionKind

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupVersionKind.

func (*GroupVersionKind) DeepCopyInto added in v0.0.3

func (in *GroupVersionKind) DeepCopyInto(out *GroupVersionKind)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (GroupVersionKind) Empty

func (gvk GroupVersionKind) Empty() bool

Empty returns true if group, version, and kind are empty

func (GroupVersionKind) GroupKind

func (gvk GroupVersionKind) GroupKind() GroupKind

func (GroupVersionKind) GroupVersion

func (gvk GroupVersionKind) GroupVersion() GroupVersion

func (GroupVersionKind) String

func (gvk GroupVersionKind) String() string

func (GroupVersionKind) ToAPIVersionAndKind

func (gvk GroupVersionKind) ToAPIVersionAndKind() (string, string)

ToAPIVersionAndKind is a convenience method for satisfying runtime.Object on types that do not use TypeMeta.

type GroupVersionResource added in v0.0.3

type GroupVersionResource struct {
	Group    string
	Version  string
	Resource string
}

GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling

func (*GroupVersionResource) DeepCopy added in v0.0.3

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupVersionResource.

func (*GroupVersionResource) DeepCopyInto added in v0.0.3

func (in *GroupVersionResource) DeepCopyInto(out *GroupVersionResource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (GroupVersionResource) Empty added in v0.0.3

func (gvr GroupVersionResource) Empty() bool

func (GroupVersionResource) GroupResource added in v0.0.3

func (gvr GroupVersionResource) GroupResource() GroupResource

func (GroupVersionResource) GroupVersion added in v0.0.3

func (gvr GroupVersionResource) GroupVersion() GroupVersion

func (GroupVersionResource) String added in v0.0.3

func (gvr GroupVersionResource) String() string

type GroupVersions added in v0.0.3

type GroupVersions []GroupVersion

GroupVersions can be used to represent a set of desired group versions.

func (GroupVersions) DeepCopy added in v0.0.3

func (in GroupVersions) DeepCopy() GroupVersions

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupVersions.

func (GroupVersions) DeepCopyInto added in v0.0.3

func (in GroupVersions) DeepCopyInto(out *GroupVersions)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (GroupVersions) Identifier added in v0.0.3

func (gvs GroupVersions) Identifier() string

Identifier implements runtime.GroupVersioner interface.

func (GroupVersions) KindForGroupVersionKinds added in v0.0.3

func (gvs GroupVersions) KindForGroupVersionKinds(kinds []GroupVersionKind) (GroupVersionKind, bool)

KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false if none of the options match the group.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL