manifest

package
v0.0.0-...-8e53d61 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FQN

func FQN(ns, n string) string

FQN returns a fully qualified resource name.

func GetDefaultContainer

func GetDefaultContainer(m metav1.ObjectMeta, spec v1.PodSpec) (string, bool)

GetDefaultContainer returns a container name if specified in an annotation.

func MetaFQN

func MetaFQN(m metav1.ObjectMeta) string

MetaFQN returns a fully qualified resource name.

Types

type ContextKey

type ContextKey string

ContextKey represents context key.

const (
	KeyFactory     ContextKey = "factory"
	KeyLabels      ContextKey = "labels"
	KeyFields      ContextKey = "fields"
	KeyTable       ContextKey = "table"
	KeyDir         ContextKey = "dir"
	KeyPath        ContextKey = "path"
	KeySubject     ContextKey = "subject"
	KeyGVR         ContextKey = "gvr"
	KeyForwards    ContextKey = "forwards"
	KeyContainers  ContextKey = "containers"
	KeyBenchCfg    ContextKey = "benchcfg"
	KeyAliases     ContextKey = "aliases"
	KeyUID         ContextKey = "uid"
	KeySubjectKind ContextKey = "subjectKind"
	KeySubjectName ContextKey = "subjectName"
	KeyNamespace   ContextKey = "namespace"
	KeyCluster     ContextKey = "cluster"
	KeyApp         ContextKey = "app"
	KeyStyles      ContextKey = "styles"
	KeyMetrics     ContextKey = "metrics"
	KeyHasMetrics  ContextKey = "has-metrics"
	KeyToast       ContextKey = "toast"
	KeyWithMetrics ContextKey = "withMetrics"
	KeyViewConfig  ContextKey = "viewConfig"
	KeyWait        ContextKey = "wait"
)

A collection of context keys.

type Factory

type Factory interface {
	// Get fetch a give resource.
	Get(gvr, path string, wait bool, sel labels.Selector) (runtime.Object, error)

	// List fetch a collection of resources.
	List(gvr, ns string, wait bool, sel labels.Selector) ([]runtime.Object, error)

	// ForResource fetch an informer for a given resource.
	ForResource(ns, gvr string) (informers.GenericInformer, error)

	// CanForResource fetch an informer for a given resource if authorized
	CanForResource(ns, gvr string, verbs []string) (informers.GenericInformer, error)

	// WaitForCacheSync synchronize the cache.
	WaitForCacheSync()
}

type GVR

type GVR struct {
	// contains filtered or unexported fields
}

GVR represents a kubernetes resource schema as a string. Format is group/version/resources:subresource.

func FromGVAndR

func FromGVAndR(ctx context.Context, gv, r string) GVR

FromGVAndR builds a gvr from a group/version and resource.

func NewGVR

func NewGVR(ctx context.Context, gvr string) GVR

NewGVR builds a new gvr from a group, version, resource.

func NewGVRFromMeta

func NewGVRFromMeta(a metav1.APIResource) GVR

NewGVRFromMeta builds a gvr from resource metadata.

func (GVR) AsResourceName

func (g GVR) AsResourceName() string

AsResourceName returns a resource . separated descriptor in the shape of kind.version.group.

func (GVR) FQN

func (g GVR) FQN(n string) string

FQN returns a fully qualified resource name.

func (GVR) G

func (g GVR) G() string

G returns the resource group name.

func (GVR) GR

func (g GVR) GR() *schema.GroupResource

GR returns a full schema representation.

func (GVR) GV

func (g GVR) GV() schema.GroupVersion

GV returns the group version scheme representation.

func (GVR) GVK

func (g GVR) GVK() schema.GroupVersionKind

GVK returns a full schema representation.

func (GVR) GVR

GVR returns a full schema representation.

func (GVR) R

func (g GVR) R() string

R returns the resource name.

func (GVR) RG

func (g GVR) RG() (string, string)

RG returns the resource and group.

func (GVR) String

func (g GVR) String() string

String returns gvr as string.

func (GVR) SubResource

func (g GVR) SubResource() string

SubResource returns a sub resource if available.

func (GVR) V

func (g GVR) V() string

V returns the resource version.

type GVRs

type GVRs []GVR

GVRs represents a collection of gvr.

func (GVRs) Len

func (g GVRs) Len() int

Len returns the list size.

func (GVRs) Less

func (g GVRs) Less(i, j int) bool

Less returns true if i < j.

func (GVRs) Swap

func (g GVRs) Swap(i, j int)

Swap swaps list values.

type Generic

type Generic struct {
	NonResource
}

func (*Generic) Describe

func (g *Generic) Describe(path string) (string, error)

Describe describes a resource.

func (*Generic) Get

func (g *Generic) Get(ctx context.Context, path string) (runtime.Object, error)

Get returns a given resource.

func (*Generic) List

func (g *Generic) List(ctx context.Context, ns string) ([]runtime.Object, error)

List returns a collection of resources.

func (*Generic) ToYAML

func (g *Generic) ToYAML(path string, showManaged bool) (string, error)

ToYAML returns a resource yaml.

type NonResource

type NonResource struct {
	Factory
	// contains filtered or unexported fields
}

NonResource represents a non k8s resource.

func (*NonResource) GVR

func (n *NonResource) GVR() string

GVR returns a gvr.

func (*NonResource) Get

Get returns the given resource.

func (*NonResource) GetFactory

func (n *NonResource) GetFactory() Factory

func (*NonResource) Init

func (n *NonResource) Init(f Factory, gvr GVR)

Init initializes the resource.

type Pod

type Pod struct {
	Resource
}

Pod represents a pod resource.

func (*Pod) Containers

func (p *Pod) Containers(path string, includeInit bool) ([]string, error)

Containers returns all container names on pod.

func (*Pod) Get

func (p *Pod) Get(ctx context.Context, path string) (runtime.Object, error)

Get returns a resource instance if found, else an error.

func (*Pod) GetInstance

func (p *Pod) GetInstance(fqn string) (*v1.Pod, error)

GetInstance returns a pod instance.

func (*Pod) GetPodSpec

func (p *Pod) GetPodSpec(path string) (*v1.PodSpec, error)

GetPodSpec returns a pod spec given a resource.

func (*Pod) IsHappy

func (p *Pod) IsHappy(po v1.Pod) bool

IsHappy check for happy deployments.

func (*Pod) List

func (p *Pod) List(ctx context.Context, ns string) ([]runtime.Object, error)

List returns a collection of nodes.

func (*Pod) Pod

func (p *Pod) Pod(fqn string) (string, error)

Pod returns a pod victim by name.

type Resource

type Resource struct {
	Generic
}

func (*Resource) Get

func (r *Resource) Get(_ context.Context, path string) (runtime.Object, error)

Get returns a resource instance if found, else an error.

func (*Resource) List

func (r *Resource) List(ctx context.Context, ns string) ([]runtime.Object, error)

List returns a collection of resources.

func (*Resource) ToYAML

func (r *Resource) ToYAML(path string, showManaged bool) (string, error)

ToYAML returns a resource yaml.

Jump to

Keyboard shortcuts

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