Documentation ¶
Index ¶
- Constants
- Variables
- func BenchConfigFor(benchFile, path string) config.BenchConfig
- func ContinuousRanges(indexes []int) [][]int
- func Describe(c client.Connection, gvr client.GVR, path string) (string, error)
- func ExtractSecrets(o *unstructured.Unstructured) (map[string]string, error)
- func FQN(ns, n string) string
- func FetchNode(ctx context.Context, f Factory, path string) (*v1.Node, error)
- func FetchNodes(ctx context.Context, f Factory, labelsSel string) (*v1.NodeList, error)
- func GetDefaultContainer(m metav1.ObjectMeta, spec v1.PodSpec) (string, bool)
- func GetJsonPatch(imageSpecs ImageSpecs) ([]byte, error)
- func GetTemplateJsonPatch(imageSpecs ImageSpecs) ([]byte, error)
- func IsCRD(r metav1.APIResource) bool
- func IsK8sMeta(m metav1.APIResource) bool
- func IsK9sMeta(m metav1.APIResource) bool
- func MetaFQN(m metav1.ObjectMeta) string
- func PodToKey(path string) string
- func PortForwardID(path, co, portMap string) string
- func ToYAML(o runtime.Object, showManaged bool) (string, error)
- type Accessor
- type Accessors
- type Alias
- func (a *Alias) AliasesFor(s string) []string
- func (a *Alias) AsGVR(c string) (client.GVR, string, bool)
- func (a *Alias) Check(cmd string) (string, bool)
- func (a *Alias) Ensure(path string) (config.Alias, error)
- func (a *Alias) Get(_ context.Context, _ string) (runtime.Object, error)
- func (a *Alias) List(ctx context.Context, _ string) ([]runtime.Object, error)
- type Benchmark
- type ConfigMap
- type Container
- type ContainsPodSpec
- type Context
- type Controller
- type CronJob
- func (c *CronJob) GetInstance(fqn string) (*batchv1.CronJob, error)
- func (c *CronJob) ListImages(ctx context.Context, fqn string) ([]string, error)
- func (c *CronJob) Run(path string) error
- func (c *CronJob) Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error)
- func (c *CronJob) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error)
- func (c *CronJob) ToggleSuspend(ctx context.Context, path string) error
- type CustomResourceDefinition
- type DaemonSet
- func (d *DaemonSet) GetInstance(fqn string) (*appsv1.DaemonSet, error)
- func (d *DaemonSet) GetPodSpec(path string) (*v1.PodSpec, error)
- func (d *DaemonSet) ListImages(ctx context.Context, fqn string) ([]string, error)
- func (d *DaemonSet) Pod(fqn string) (string, error)
- func (d *DaemonSet) Restart(ctx context.Context, path string) error
- func (d *DaemonSet) Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error)
- func (d *DaemonSet) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error)
- func (d *DaemonSet) SetImages(ctx context.Context, path string, imageSpecs ImageSpecs) error
- func (d *DaemonSet) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error)
- type Deployment
- func (d *Deployment) GetInstance(fqn string) (*appsv1.Deployment, error)
- func (d *Deployment) GetPodSpec(path string) (*v1.PodSpec, error)
- func (d *Deployment) ListImages(ctx context.Context, fqn string) ([]string, error)
- func (d *Deployment) Pod(fqn string) (string, error)
- func (d *Deployment) Restart(ctx context.Context, path string) error
- func (d *Deployment) Scale(ctx context.Context, path string, replicas int32) error
- func (d *Deployment) Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error)
- func (d *Deployment) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error)
- func (d *Deployment) SetImages(ctx context.Context, path string, imageSpecs ImageSpecs) error
- func (d *Deployment) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error)
- type Describer
- type Dir
- type DrainOptions
- type Element
- type Factory
- type Generic
- func (g *Generic) Delete(ctx context.Context, path string, propagation *metav1.DeletionPropagation, ...) error
- func (g *Generic) Describe(path string) (string, error)
- func (g *Generic) Get(ctx context.Context, path string) (runtime.Object, error)
- func (g *Generic) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (g *Generic) ToYAML(path string, showManaged bool) (string, error)
- type Getter
- type Grace
- type HelmChart
- func (h *HelmChart) Delete(_ context.Context, path string, _ *metav1.DeletionPropagation, _ Grace) error
- func (h *HelmChart) Describe(path string) (string, error)
- func (h *HelmChart) Get(_ context.Context, path string) (runtime.Object, error)
- func (h *HelmChart) GetValues(path string, allValues bool) ([]byte, error)
- func (h *HelmChart) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (h *HelmChart) ToYAML(path string, showManaged bool) (string, error)
- func (h *HelmChart) Uninstall(path string, keepHist bool) error
- type HelmHistory
- func (h *HelmHistory) Delete(_ context.Context, path string, _ *metav1.DeletionPropagation, _ Grace) error
- func (h *HelmHistory) Describe(path string) (string, error)
- func (h *HelmHistory) Get(_ context.Context, path string) (runtime.Object, error)
- func (h *HelmHistory) GetValues(path string, allValues bool) ([]byte, error)
- func (h *HelmHistory) List(ctx context.Context, _ string) ([]runtime.Object, error)
- func (h *HelmHistory) Rollback(_ context.Context, path, rev string) error
- func (h *HelmHistory) ToYAML(path string, showManaged bool) (string, error)
- type ImageLister
- type ImageScan
- type ImageSpec
- type ImageSpecs
- type ImagesSpec
- type Job
- func (j *Job) GetInstance(fqn string) (*batchv1.Job, error)
- func (j *Job) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (j *Job) ListImages(ctx context.Context, fqn string) ([]string, error)
- func (j *Job) Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error)
- func (j *Job) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error)
- func (j *Job) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error)
- type JsonPatch
- type Lister
- type LogChan
- type LogItem
- type LogItems
- func (l *LogItems) Add(ii ...*LogItem)
- func (l *LogItems) Clear()
- func (l *LogItems) DumpDebug(m string)
- func (l *LogItems) Filter(index int, q string, showTime bool) ([]int, [][]int, error)
- func (l *LogItems) Items() []*LogItem
- func (l *LogItems) Len() int
- func (l *LogItems) Lines(index int, showTime bool, ll [][]byte)
- func (l *LogItems) Merge(n *LogItems)
- func (l *LogItems) Render(index int, showTime bool, ll [][]byte)
- func (l *LogItems) Shift(i *LogItem)
- func (l *LogItems) StrLines(index int, showTime bool) []string
- func (l *LogItems) Subset(index int) *LogItems
- type LogOptions
- func (o *LogOptions) Clone() *LogOptions
- func (o *LogOptions) HasContainer() bool
- func (o *LogOptions) Info() string
- func (o *LogOptions) ToErrLogItem(err error) *LogItem
- func (o *LogOptions) ToLogItem(bytes []byte) *LogItem
- func (o *LogOptions) ToPodLogOptions() *v1.PodLogOptions
- func (o *LogOptions) ToggleAllContainers()
- type Loggable
- type Logger
- type Meta
- type Namespace
- type Node
- func (n *Node) CountPods(nodeName string) (int, error)
- func (n *Node) Drain(path string, opts DrainOptions, w io.Writer) error
- func (n *Node) Get(ctx context.Context, path string) (runtime.Object, error)
- func (n *Node) GetPods(nodeName string) ([]*v1.Pod, error)
- func (n *Node) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (n *Node) ToggleCordon(path string, cordon bool) error
- type NodeMaintainer
- type NodeMetricsFunc
- type NonResource
- type Nuker
- type Pod
- func (p *Pod) Containers(path string, includeInit bool) ([]string, error)
- func (p *Pod) Get(ctx context.Context, path string) (runtime.Object, error)
- func (p *Pod) GetInstance(fqn string) (*v1.Pod, error)
- func (p *Pod) GetPodSpec(path string) (*v1.PodSpec, error)
- func (p *Pod) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (p *Pod) ListImages(ctx context.Context, path string) ([]string, error)
- func (p *Pod) Logs(path string, opts *v1.PodLogOptions) (*restclient.Request, error)
- func (p *Pod) Pod(fqn string) (string, error)
- func (p *Pod) Sanitize(ctx context.Context, ns string) (int, error)
- func (p *Pod) Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error)
- func (p *Pod) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error)
- func (p *Pod) SetImages(ctx context.Context, path string, imageSpecs ImageSpecs) error
- func (p *Pod) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error)
- type PodSpec
- type Policy
- type PortForward
- type PortForwarder
- func (p *PortForwarder) Active() bool
- func (p *PortForwarder) Address() string
- func (p *PortForwarder) Age() time.Time
- func (p *PortForwarder) Container() string
- func (p *PortForwarder) ContainerPort() string
- func (p *PortForwarder) FQN() string
- func (p *PortForwarder) HasPortMapping(portMap string) bool
- func (p *PortForwarder) ID() string
- func (p *PortForwarder) LocalPort() string
- func (p *PortForwarder) Port() string
- func (p *PortForwarder) SetActive(b bool)
- func (p *PortForwarder) Start(path string, tt port.PortTunnel) (*portforward.PortForwarder, error)
- func (p *PortForwarder) Stop()
- func (p *PortForwarder) String() string
- type Pulse
- type Rbac
- type Ref
- type RefScanner
- type Reference
- func (r *Reference) Get(ctx context.Context, path string) (runtime.Object, error)
- func (r *Reference) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (r *Reference) Scan(ctx context.Context) ([]runtime.Object, error)
- func (r *Reference) ScanSA(ctx context.Context) ([]runtime.Object, error)
- type Refs
- type ReplicaSet
- type Resource
- type ResourceMetas
- type RestMapper
- type Restartable
- type Runnable
- type Sanitizer
- type Scalable
- type ScreenDump
- type Secret
- type Service
- type Spec
- type StatefulSet
- func (*StatefulSet) GetInstance(f Factory, fqn string) (*appsv1.StatefulSet, error)
- func (s *StatefulSet) GetPodSpec(path string) (*v1.PodSpec, error)
- func (s *StatefulSet) ListImages(ctx context.Context, fqn string) ([]string, error)
- func (s *StatefulSet) Pod(fqn string) (string, error)
- func (s *StatefulSet) Restart(ctx context.Context, path string) error
- func (s *StatefulSet) Scale(ctx context.Context, path string, replicas int32) error
- func (s *StatefulSet) Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error)
- func (s *StatefulSet) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error)
- func (s *StatefulSet) SetImages(ctx context.Context, path string, imageSpecs ImageSpecs) error
- func (s *StatefulSet) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error)
- type Subject
- type Switchable
- type Table
- type Valuer
- type Workload
Constants ¶
const ( StatusOK = "OK" DegradedStatus = "DEGRADED" )
Variables ¶
var ( SaGVR = client.NewGVR("v1/serviceaccounts") PvcGVR = client.NewGVR("v1/persistentvolumeclaims") PcGVR = client.NewGVR("scheduling.k8s.io/v1/priorityclasses") CmGVR = client.NewGVR("v1/configmaps") SecGVR = client.NewGVR("v1/secrets") PodGVR = client.NewGVR("v1/pods") SvcGVR = client.NewGVR("v1/services") DsGVR = client.NewGVR("apps/v1/daemonsets") StsGVR = client.NewGVR("apps/v1/statefulSets") DpGVR = client.NewGVR("apps/v1/deployments") RsGVR = client.NewGVR("apps/v1/replicasets") )
var (
BenchRx = regexp.MustCompile(`[:|]+`)
)
var ItemEOF = new(LogItem)
var MetaAccess = NewMeta()
MetaAccess tracks resources metadata.
var RestMapping = &RestMapper{}
RestMapping holds k8s resource mapping.
Functions ¶
func BenchConfigFor ¶ added in v0.15.2
func BenchConfigFor(benchFile, path string) config.BenchConfig
BenchConfigFor returns a custom bench spec if defined otherwise returns the default one.
func ContinuousRanges ¶ added in v0.30.0
ContinuousRanges takes a sorted slice of integers and returns a slice of sub-slices representing continuous ranges of integers.
func ExtractSecrets ¶ added in v0.31.8
func ExtractSecrets(o *unstructured.Unstructured) (map[string]string, error)
ExtractSecrets takes an unstructured object and attempts to convert it into a Kubernetes Secret. It returns a map where the keys are the secret data keys and the values are the corresponding secret data values. If the conversion fails, it returns an error.
func FetchNodes ¶
FetchNodes retrieves all nodes.
func GetDefaultContainer ¶ added in v0.28.0
GetDefaultContainer returns a container name if specified in an annotation.
func GetJsonPatch ¶ added in v0.23.0
func GetJsonPatch(imageSpecs ImageSpecs) ([]byte, error)
GetJsonPatch returns container image patch.
func GetTemplateJsonPatch ¶ added in v0.23.0
func GetTemplateJsonPatch(imageSpecs ImageSpecs) ([]byte, error)
GetTemplateJsonPatch builds a json patch string to update PodSpec images.
func IsCRD ¶ added in v0.24.15
func IsCRD(r metav1.APIResource) bool
IsCRD checks if resource represents a CRD
func MetaFQN ¶
func MetaFQN(m metav1.ObjectMeta) string
MetaFQN returns a fully qualified resource name.
func PortForwardID ¶ added in v0.15.2
PortForwardID computes port-forward identifier.
Types ¶
type Accessor ¶
type Accessor interface { Lister Getter // Init the resource with a factory object. Init(Factory, client.GVR) // GVR returns a gvr a string. GVR() string }
Accessor represents an accessible k8s resource.
type Alias ¶
type Alias struct { NonResource *config.Aliases }
Alias tracks standard and custom command aliases.
func (*Alias) AliasesFor ¶ added in v0.31.9
type Benchmark ¶
type Benchmark struct {
NonResource
}
Benchmark represents a benchmark resource.
func (*Benchmark) Delete ¶
func (b *Benchmark) Delete(_ context.Context, path string, _ *metav1.DeletionPropagation, _ Grace) error
Delete nukes a resource.
type ConfigMap ¶ added in v0.32.0
type ConfigMap struct {
Resource
}
ConfigMap represents a configmap resource.
type Container ¶
type Container struct {
NonResource
}
Container represents a pod's container dao.
type ContainsPodSpec ¶ added in v0.23.0
type ContainsPodSpec interface { // GetPodSpec returns a podspec for the resource. GetPodSpec(path string) (*v1.PodSpec, error) // SetImages sets container image. SetImages(ctx context.Context, path string, imageSpecs ImageSpecs) error }
ContainsPodSpec represents a resource with a pod template.
type Context ¶
type Context struct {
NonResource
}
Context represents a kubernetes context.
func (*Context) MustCurrentContextName ¶
MustCurrentContextName return the active context name.
type Controller ¶ added in v0.15.2
type Controller interface { // Pod returns a pod instance matching the selector. Pod(path string) (string, error) }
Controller represents a pod controller.
type CronJob ¶
type CronJob struct {
Generic
}
CronJob represents a cronjob K8s resource.
func (*CronJob) GetInstance ¶ added in v0.29.0
GetInstance fetch a matching cronjob.
func (*CronJob) ListImages ¶ added in v0.29.0
ListImages lists container images.
type CustomResourceDefinition ¶
type CustomResourceDefinition struct {
Resource
}
CustomResourceDefinition represents a CRD resource model.
type DaemonSet ¶
type DaemonSet struct {
Resource
}
DaemonSet represents a K8s daemonset.
func (*DaemonSet) GetInstance ¶ added in v0.15.2
GetInstance returns a daemonset instance.
func (*DaemonSet) GetPodSpec ¶ added in v0.23.0
GetPodSpec returns a pod spec given a resource.
func (*DaemonSet) ListImages ¶ added in v0.29.0
ListImages lists container images.
type Deployment ¶
type Deployment struct {
Resource
}
Deployment represents a deployment K8s resource.
func (*Deployment) GetInstance ¶ added in v0.15.2
func (d *Deployment) GetInstance(fqn string) (*appsv1.Deployment, error)
GetInstance fetch a matching deployment.
func (*Deployment) GetPodSpec ¶ added in v0.23.0
func (d *Deployment) GetPodSpec(path string) (*v1.PodSpec, error)
GetPodSpec returns a pod spec given a resource.
func (*Deployment) ListImages ¶ added in v0.29.0
ListImages lists container images.
func (*Deployment) Pod ¶ added in v0.15.2
func (d *Deployment) Pod(fqn string) (string, error)
Pod returns a pod victim by name.
func (*Deployment) Restart ¶
func (d *Deployment) Restart(ctx context.Context, path string) error
Restart a Deployment rollout.
func (*Deployment) SetImages ¶ added in v0.23.0
func (d *Deployment) SetImages(ctx context.Context, path string, imageSpecs ImageSpecs) error
SetImages sets container images.
func (*Deployment) TailLogs ¶
func (d *Deployment) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error)
TailLogs tail logs for all pods represented by this Deployment.
type Describer ¶
type Describer interface { // Describe describes a resource. Describe(path string) (string, error) // ToYAML dumps a resource to YAML. ToYAML(path string, showManaged bool) (string, error) }
Describer describes a resource.
type Dir ¶ added in v0.21.0
type Dir struct {
NonResource
}
Dir tracks standard and custom command aliases.
type DrainOptions ¶ added in v0.17.6
type DrainOptions struct { GracePeriodSeconds int Timeout time.Duration IgnoreAllDaemonSets bool DeleteEmptyDirData bool Force bool DisableEviction bool }
DrainOptions tracks drain attributes.
type Factory ¶
type Factory interface { // Client retrieves an api client. Client() client.Connection // Get fetch a given 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() // DeleteForwarder deletes a pod forwarder. DeleteForwarder(path string) // Forwarders returns all portforwards. Forwarders() watch.Forwarders }
Factory represents a resource factory.
type Generic ¶
type Generic struct {
NonResource
}
Generic represents a generic resource.
func (*Generic) Delete ¶
func (g *Generic) Delete(ctx context.Context, path string, propagation *metav1.DeletionPropagation, grace Grace) error
Delete deletes a resource.
type Getter ¶
type Getter interface { // Get return a given resource. Get(ctx context.Context, path string) (runtime.Object, error) }
Getter represents a resource getter.
type HelmChart ¶ added in v0.29.0
type HelmChart struct {
NonResource
}
HelmChart represents a helm chart.
func (*HelmChart) Delete ¶ added in v0.29.0
func (h *HelmChart) Delete(_ context.Context, path string, _ *metav1.DeletionPropagation, _ Grace) error
Delete uninstall a HelmChart.
type HelmHistory ¶ added in v0.29.0
type HelmHistory struct {
NonResource
}
HelmHistory represents a helm chart.
func (*HelmHistory) Delete ¶ added in v0.29.0
func (h *HelmHistory) Delete(_ context.Context, path string, _ *metav1.DeletionPropagation, _ Grace) error
Delete uninstall a Helm.
func (*HelmHistory) Describe ¶ added in v0.29.0
func (h *HelmHistory) Describe(path string) (string, error)
Describe returns the chart notes.
func (*HelmHistory) GetValues ¶ added in v0.30.0
func (h *HelmHistory) GetValues(path string, allValues bool) ([]byte, error)
GetValues return the config for this chart.
type ImageLister ¶ added in v0.29.0
type ImageLister interface { // ListImages lists container images. ListImages(ctx context.Context, path string) ([]string, error) }
ImageLister tracks resources with container images.
type ImageScan ¶ added in v0.29.0
type ImageScan struct {
NonResource
}
ImageScan represents vulnerability scans.
type ImageSpecs ¶ added in v0.23.0
type ImageSpecs []ImageSpec
ImageSpecs represents a collection of container images.
type ImagesSpec ¶ added in v0.23.0
type ImagesSpec struct { SetElementOrderContainers []Element `json:"$setElementOrder/containers,omitempty"` SetElementOrderInitContainers []Element `json:"$setElementOrder/initContainers,omitempty"` Containers []Element `json:"containers,omitempty"` InitContainers []Element `json:"initContainers,omitempty"` }
ImagesSpec tracks container image updates.
type Job ¶
type Job struct {
Resource
}
Job represents a K8s job resource.
func (*Job) GetInstance ¶ added in v0.29.0
func (*Job) ListImages ¶ added in v0.29.0
ListImages lists container images.
type JsonPatch ¶ added in v0.23.0
type JsonPatch struct {
Spec Spec `json:"spec"`
}
JsonPatch track pod spec updates.
type Lister ¶
type Lister interface { // List returns a resource collection. List(ctx context.Context, ns string) ([]runtime.Object, error) }
Lister represents a resource lister.
type LogItem ¶ added in v0.18.0
LogItem represents a container log line.
func NewLogItem ¶ added in v0.18.0
NewLogItem returns a new item.
func NewLogItemFromString ¶ added in v0.18.0
NewLogItemFromString returns a new item.
func (*LogItem) GetTimestamp ¶ added in v0.25.0
GetTimestamp fetch log lime timestamp
type LogItems ¶ added in v0.18.0
type LogItems struct {
// contains filtered or unexported fields
}
LogItems represents a collection of log items.
func NewLogItems ¶ added in v0.24.11
func NewLogItems() *LogItems
NewLogItems returns a new instance.
type LogOptions ¶
type LogOptions struct { CreateDuration time.Duration Path string Container string DefaultContainer string SinceTime string Lines int64 SinceSeconds int64 Head bool Previous bool SingleContainer bool MultiPods bool ShowTimestamp bool AllContainers bool }
LogOptions represents logger options.
func (*LogOptions) Clone ¶ added in v0.24.11
func (o *LogOptions) Clone() *LogOptions
Clone clones options.
func (*LogOptions) HasContainer ¶
func (o *LogOptions) HasContainer() bool
HasContainer checks if a container is present.
func (*LogOptions) Info ¶ added in v0.18.1
func (o *LogOptions) Info() string
Info returns the option pod and container info.
func (*LogOptions) ToErrLogItem ¶ added in v0.25.13
func (o *LogOptions) ToErrLogItem(err error) *LogItem
func (*LogOptions) ToLogItem ¶ added in v0.25.13
func (o *LogOptions) ToLogItem(bytes []byte) *LogItem
ToLogItem add a log header to display po/co information along with the log message.
func (*LogOptions) ToPodLogOptions ¶ added in v0.18.0
func (o *LogOptions) ToPodLogOptions() *v1.PodLogOptions
ToPodLogOptions returns pod log options.
func (*LogOptions) ToggleAllContainers ¶ added in v0.24.11
func (o *LogOptions) ToggleAllContainers()
ToggleAllContainers toggles single or all-containers if possible.
type Loggable ¶
type Loggable interface { // TailLogs streams resource logs. TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error) }
Loggable represents resources with logs.
type Logger ¶
type Logger interface { // Logs tails a resource logs. Logs(path string, opts *v1.PodLogOptions) (*restclient.Request, error) }
Logger represents a resource that exposes logs.
type Meta ¶ added in v0.13.8
type Meta struct {
// contains filtered or unexported fields
}
Meta represents available resource metas.
func (*Meta) LoadResources ¶ added in v0.13.8
LoadResources hydrates server preferred+CRDs resource metadata.
func (*Meta) RegisterMeta ¶ added in v0.13.8
func (m *Meta) RegisterMeta(gvr string, res metav1.APIResource)
RegisterMeta registers a new resource meta object.
type Namespace ¶ added in v0.25.19
type Namespace struct {
Resource
}
Namespace represents a namespace resource.
type Node ¶
type Node struct {
Resource
}
Node represents a node model.
type NodeMaintainer ¶ added in v0.17.6
type NodeMaintainer interface { // ToggleCordon toggles cordon/uncordon a node. ToggleCordon(path string, cordon bool) error // Drain drains the given node. Drain(path string, opts DrainOptions, w io.Writer) error }
NodeMaintainer performs node maintenance operations.
type NodeMetricsFunc ¶
type NodeMetricsFunc func() (*mv1beta1.NodeMetricsList, error)
NodeMetricsFunc retrieves node metrics.
type NonResource ¶
type NonResource struct { Factory // contains filtered or unexported fields }
NonResource represents a non k8s resource.
type Nuker ¶
type Nuker interface { // Delete removes a resource from the api server. Delete(context.Context, string, *metav1.DeletionPropagation, Grace) error }
Nuker represents a resource deleter.
type Pod ¶
type Pod struct {
Resource
}
Pod represents a pod resource.
func (*Pod) Containers ¶
Containers returns all container names on pod.
func (*Pod) GetInstance ¶ added in v0.15.2
GetInstance returns a pod instance.
func (*Pod) GetPodSpec ¶ added in v0.23.0
GetPodSpec returns a pod spec given a resource.
func (*Pod) ListImages ¶ added in v0.29.0
ListImages lists container images.
func (*Pod) Logs ¶
func (p *Pod) Logs(path string, opts *v1.PodLogOptions) (*restclient.Request, error)
Logs fetch container logs for a given pod and container.
type PodSpec ¶ added in v0.23.0
type PodSpec struct {
Spec ImagesSpec `json:"spec"`
}
PodSpec represents a collection of container images.
type PortForward ¶
type PortForward struct {
NonResource
}
PortForward represents a port forward dao.
func (*PortForward) Delete ¶
func (p *PortForward) Delete(_ context.Context, path string, _ *metav1.DeletionPropagation, _ Grace) error
Delete deletes a portforward.
type PortForwarder ¶
type PortForwarder struct { Factory genericclioptions.IOStreams // contains filtered or unexported fields }
PortForwarder tracks a port forward stream.
func NewPortForwarder ¶
func NewPortForwarder(f Factory) *PortForwarder
NewPortForwarder returns a new port forward streamer.
func (*PortForwarder) Active ¶
func (p *PortForwarder) Active() bool
Active returns the forward status.
func (*PortForwarder) Address ¶ added in v0.32.6
func (p *PortForwarder) Address() string
Address returns the port Address.
func (*PortForwarder) Age ¶
func (p *PortForwarder) Age() time.Time
Age returns the port forward age.
func (*PortForwarder) Container ¶
func (p *PortForwarder) Container() string
Container returns the target's container.
func (*PortForwarder) ContainerPort ¶ added in v0.25.0
func (p *PortForwarder) ContainerPort() string
ContainerPort returns the container port.
func (*PortForwarder) FQN ¶
func (p *PortForwarder) FQN() string
FQN returns the portforward unique id.
func (*PortForwarder) HasPortMapping ¶ added in v0.15.2
func (p *PortForwarder) HasPortMapping(portMap string) bool
HasPortMapping checks if port mapping is defined for this fwd.
func (*PortForwarder) LocalPort ¶ added in v0.25.0
func (p *PortForwarder) LocalPort() string
LocalPort returns the local port.
func (*PortForwarder) Port ¶ added in v0.25.0
func (p *PortForwarder) Port() string
Port returns the port mapping.
func (*PortForwarder) SetActive ¶
func (p *PortForwarder) SetActive(b bool)
SetActive mark a portforward as active.
func (*PortForwarder) Start ¶
func (p *PortForwarder) Start(path string, tt port.PortTunnel) (*portforward.PortForwarder, error)
Start initiates a port forward session for a given pod and ports.
func (*PortForwarder) String ¶ added in v0.28.1
func (p *PortForwarder) String() string
String dumps as string.
type RefScanner ¶ added in v0.20.0
type RefScanner interface { // Init initializes the scanner Init(Factory, client.GVR) // Scan scan the resource for references. Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error) }
RefScanner represents a resource reference scanner.
type Reference ¶ added in v0.20.0
type Reference struct {
NonResource
}
Reference represents cluster resource references.
type Refs ¶ added in v0.20.0
type Refs []Ref
Refs represents a collection of resource references.
func ScanForRefs ¶ added in v0.20.0
ScanForRefs scans cluster resources for resource references.
type ReplicaSet ¶ added in v0.16.0
type ReplicaSet struct {
Resource
}
ReplicaSet represents a replicaset K8s resource.
func (*ReplicaSet) ListImages ¶ added in v0.29.0
ListImages lists container images.
func (*ReplicaSet) Load ¶ added in v0.17.0
func (r *ReplicaSet) Load(f Factory, path string) (*appsv1.ReplicaSet, error)
Load returns a given instance.
func (*ReplicaSet) Rollback ¶ added in v0.17.0
func (r *ReplicaSet) Rollback(fqn string) error
Rollback reverses the last deployment.
type Resource ¶
type Resource struct {
Generic
}
Resource represents an informer based resource.
type ResourceMetas ¶
type ResourceMetas map[client.GVR]metav1.APIResource
ResourceMetas represents a collection of resource metadata.
type RestMapper ¶
type RestMapper struct {
client.Connection
}
RestMapper map resource to REST mapping ie kind, group, version.
func (*RestMapper) Name ¶
func (*RestMapper) Name() meta.RESTScopeName
Name protocol returns rest scope name.
func (*RestMapper) ResourceFor ¶
func (r *RestMapper) ResourceFor(resourceArg, kind string) (*meta.RESTMapping, error)
ResourceFor produces a rest mapping from a given resource. Support full res name ie deployment.v1.apps.
func (*RestMapper) ToRESTMapper ¶
func (r *RestMapper) ToRESTMapper() (meta.RESTMapper, error)
ToRESTMapper map resources to kind, and map kind and version to interfaces for manipulating K8s objects.
type Restartable ¶
type Restartable interface { // Restart performs a rollout restart. Restart(ctx context.Context, path string) error }
Restartable represents a restartable resource.
type Sanitizer ¶ added in v0.28.1
type Sanitizer interface { // Sanitize nukes all resources in unhappy state. Sanitize(context.Context, string) (int, error) }
Sanitizer represents a resource sanitizer.
type Scalable ¶
type Scalable interface { // Scale scales a resource up or down. Scale(ctx context.Context, path string, replicas int32) error }
Scalable represents resources that can scale.
type ScreenDump ¶
type ScreenDump struct {
NonResource
}
ScreenDump represents a scraped resources.
func (*ScreenDump) Delete ¶
func (d *ScreenDump) Delete(_ context.Context, path string, _ *metav1.DeletionPropagation, _ Grace) error
Delete a ScreenDump.
type Secret ¶ added in v0.31.8
type Secret struct { Resource // contains filtered or unexported fields }
Secret represents a secret K8s resource.
func (*Secret) Decode ¶ added in v0.31.8
Decode removes the encoded part from the secret's description and appends the secret's decoded data.
type Service ¶
type Service struct {
Resource
}
Service represents a k8s service.
func (*Service) GetInstance ¶ added in v0.15.2
GetInstance returns a service instance.
type Spec ¶ added in v0.23.0
type Spec struct {
Template PodSpec `json:"template"`
}
Spec represents a pod template.
type StatefulSet ¶
type StatefulSet struct {
Resource
}
StatefulSet represents a K8s sts.
func (*StatefulSet) GetInstance ¶ added in v0.28.1
func (*StatefulSet) GetInstance(f Factory, fqn string) (*appsv1.StatefulSet, error)
GetInstance returns a statefulset instance.
func (*StatefulSet) GetPodSpec ¶ added in v0.23.0
func (s *StatefulSet) GetPodSpec(path string) (*v1.PodSpec, error)
GetPodSpec returns a pod spec given a resource.
func (*StatefulSet) ListImages ¶ added in v0.29.0
ListImages lists container images.
func (*StatefulSet) Pod ¶ added in v0.15.2
func (s *StatefulSet) Pod(fqn string) (string, error)
Pod returns a pod victim by name.
func (*StatefulSet) Restart ¶
func (s *StatefulSet) Restart(ctx context.Context, path string) error
Restart a StatefulSet rollout.
func (*StatefulSet) Scan ¶ added in v0.20.0
func (s *StatefulSet) Scan(ctx context.Context, gvr client.GVR, fqn string, wait bool) (Refs, error)
Scan scans for cluster resource refs.
func (*StatefulSet) SetImages ¶ added in v0.23.0
func (s *StatefulSet) SetImages(ctx context.Context, path string, imageSpecs ImageSpecs) error
SetImages sets container images.
func (*StatefulSet) TailLogs ¶
func (s *StatefulSet) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error)
TailLogs tail logs for all pods represented by this StatefulSet.
type Switchable ¶
Switchable represents a switchable resource.
type Table ¶
type Table struct {
Generic
}
Table retrieves K8s resources as tabular data.
type Valuer ¶ added in v0.30.0
type Valuer interface { // GetValues returns values for a resource. GetValues(path string, allValues bool) ([]byte, error) }
Valuer represents a resource with values.
Source Files ¶
- alias.go
- benchmark.go
- cluster.go
- cm.go
- container.go
- context.go
- crd.go
- cronjob.go
- cruiser.go
- describe.go
- dir.go
- dp.go
- ds.go
- generic.go
- helm_chart.go
- helm_history.go
- helpers.go
- img_scan.go
- job.go
- log_item.go
- log_items.go
- log_options.go
- node.go
- non_resource.go
- ns.go
- ofaas.go
- patch.go
- pod.go
- popeye.go
- port_forward.go
- port_forwarder.go
- pulse.go
- rbac.go
- rbac_policy.go
- rbac_subject.go
- reference.go
- registry.go
- resource.go
- rest_mapper.go
- rs.go
- screen_dump.go
- secret.go
- sts.go
- svc.go
- table.go
- types.go
- workload.go