resid

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 56

Documentation

Index

Constants

View Source
const (
	TotallyNotANamespace = "_non_namespaceable_"
	DefaultNamespace     = "default"
)

Variables

This section is empty.

Functions

func ParseGroupVersion

func ParseGroupVersion(apiVersion string) (group, version string)

ParseGroupVersion parses a KRM metadata apiVersion field.

Types

type Gvk

type Gvk struct {
	Group   string `json:"group,omitempty" yaml:"group,omitempty"`
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
	Kind    string `json:"kind,omitempty" yaml:"kind,omitempty"`
	// contains filtered or unexported fields
}

Gvk identifies a Kubernetes API type. https://git.k8s.io/design-proposals-archive/api-machinery/api-group.md

func FromKind

func FromKind(k string) Gvk

FromKind makes a Gvk with only the kind specified.

func GvkFromNode added in v0.10.20

func GvkFromNode(r *yaml.RNode) Gvk

func GvkFromString

func GvkFromString(s string) Gvk

GvkFromString makes a Gvk from the output of Gvk.String().

func NewGvk added in v0.10.20

func NewGvk(g, v, k string) Gvk

func (Gvk) ApiVersion

func (x Gvk) ApiVersion() string

ApiVersion returns the combination of Group and Version

func (Gvk) AsTypeMeta added in v0.10.20

func (x Gvk) AsTypeMeta() yaml.TypeMeta

AsTypeMeta returns a yaml.TypeMeta from x's information.

func (Gvk) Equals

func (x Gvk) Equals(o Gvk) bool

Equals returns true if the Gvk's have equal fields.

func (Gvk) IsClusterScoped added in v0.10.20

func (x Gvk) IsClusterScoped() bool

IsClusterScoped returns true if the Gvk is certainly cluster scoped with respect to the available openapi data.

func (Gvk) IsLessThan

func (x Gvk) IsLessThan(o Gvk) bool

IsLessThan returns true if self is less than the argument.

func (Gvk) IsSelected

func (x Gvk) IsSelected(selector *Gvk) bool

IsSelected returns true if `selector` selects `x`; otherwise, false. If `selector` and `x` are the same, return true. If `selector` is nil, it is considered a wildcard match, returning true. If selector fields are empty, they are considered wildcards matching anything in the corresponding fields, e.g.

this item:

<Group: "extensions", Version: "v1beta1", Kind: "Deployment">

is selected by

<Group: "",           Version: "",        Kind: "Deployment">

but rejected by

<Group: "apps",       Version: "",        Kind: "Deployment">

func (Gvk) String

func (x Gvk) String() string

String returns a string representation of the GVK.

func (Gvk) StringWoEmptyField

func (x Gvk) StringWoEmptyField() string

StringWoEmptyField returns a string representation of the GVK. Non-exist fields will be omitted. This is called when generating a filename for the resource.

type ResId

type ResId struct {
	// Gvk of the resource.
	Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`

	// Name of the resource.
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// Namespace the resource belongs to, if it can belong to a namespace.
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}

ResId is an identifier of a k8s resource object.

func FromRNode added in v0.13.2

func FromRNode(rn *yaml.RNode) ResId

FromRNode returns the ResId for the RNode

func FromString

func FromString(s string) ResId

func NewResId

func NewResId(k Gvk, n string) ResId

NewResId creates new ResId.

func NewResIdKindOnly

func NewResIdKindOnly(k string, n string) ResId

NewResIdKindOnly creates a new ResId.

func NewResIdWithNamespace

func NewResIdWithNamespace(k Gvk, n, ns string) ResId

NewResIdWithNamespace creates new ResId in a given namespace.

func (ResId) EffectiveNamespace

func (id ResId) EffectiveNamespace() string

EffectiveNamespace returns a non-ambiguous, non-empty namespace for use in reporting and equality tests.

func (ResId) Equals

func (id ResId) Equals(o ResId) bool

Equals returns true if the other id matches namespace/Group/Version/Kind/name.

func (ResId) GvknEquals

func (id ResId) GvknEquals(o ResId) bool

GvknEquals returns true if the other id matches Group/Version/Kind/name.

func (ResId) IsEmpty added in v0.13.0

func (id ResId) IsEmpty() bool

IsEmpty returns true of all of the id's fields are empty strings

func (ResId) IsInDefaultNs

func (id ResId) IsInDefaultNs() bool

IsInDefaultNs returns true if id is a namespaceable ResId and the Namespace is either not set or set to DefaultNamespace.

func (ResId) IsNsEquals

func (id ResId) IsNsEquals(o ResId) bool

IsNsEquals returns true if the id is in the same effective namespace.

func (ResId) IsSelectedBy

func (id ResId) IsSelectedBy(selector ResId) bool

IsSelectedBy returns true if self is selected by the argument.

func (ResId) String

func (id ResId) String() string

String of ResId based on GVK, name and prefix

Jump to

Keyboard shortcuts

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