Documentation ¶
Index ¶
- Variables
- func BenchConfigFor(benchFile, path string) config.BenchConfig
- func Describe(c client.Connection, gvr client.GVR, path string) (string, error)
- func FQN(ns, n string) string
- func FetchNodes(f Factory, labelsSel string) (*v1.NodeList, error)
- func IsK8sMeta(m metav1.APIResource) bool
- func IsK9sMeta(m metav1.APIResource) bool
- func IsOpenFaasEnabled() bool
- func MetaFQN(m metav1.ObjectMeta) string
- func PodToKey(path string) string
- func PortForwardID(path, co string) string
- func ToYAML(o runtime.Object) (string, error)
- func Truncate(str string, width int) string
- type Accessor
- type Accessors
- type Alias
- type Benchmark
- type Chart
- func (c *Chart) Delete(path string, cascade, force bool) error
- func (c *Chart) Describe(path string) (string, error)
- func (c *Chart) EnsureHelmConfig(ns string) (*action.Configuration, error)
- func (c *Chart) Get(_ context.Context, path string) (runtime.Object, error)
- func (c *Chart) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (c *Chart) ToYAML(path string) (string, error)
- type Container
- type Context
- type Controller
- type CronJob
- type CustomResourceDefinition
- type DaemonSet
- func (d *DaemonSet) GetInstance(fqn string) (*appsv1.DaemonSet, error)
- func (d *DaemonSet) IsHappy(ds appsv1.DaemonSet) bool
- func (d *DaemonSet) Pod(fqn string) (string, error)
- func (d *DaemonSet) Restart(path string) error
- func (d *DaemonSet) TailLogs(ctx context.Context, c chan<- []byte, opts LogOptions) error
- type Deployment
- func (d *Deployment) IsHappy(dp appsv1.Deployment) bool
- func (*Deployment) Load(f Factory, fqn string) (*appsv1.Deployment, error)
- func (d *Deployment) Pod(fqn string) (string, error)
- func (d *Deployment) Restart(path string) error
- func (d *Deployment) Scale(path string, replicas int32) error
- func (d *Deployment) TailLogs(ctx context.Context, c chan<- []byte, opts LogOptions) error
- type Describer
- type Factory
- type Generic
- func (g *Generic) Delete(path string, cascade, force bool) 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) (string, error)
- type Getter
- type HorizontalPodAutoscaler
- type Job
- type Lister
- type LogOptions
- type Loggable
- type Logger
- type Meta
- type Node
- type NodeMetricsFunc
- type NonResource
- type Nuker
- type OpenFaas
- func (f *OpenFaas) Delete(path string, _, _ bool) error
- func (f *OpenFaas) Describe(path string) (string, error)
- func (f *OpenFaas) Get(ctx context.Context, path string) (runtime.Object, error)
- func (f *OpenFaas) List(_ context.Context, ns string) ([]runtime.Object, error)
- func (f *OpenFaas) ToYAML(path string) (string, error)
- 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) IsHappy(po v1.Pod) bool
- func (p *Pod) List(ctx context.Context, ns string) ([]runtime.Object, error)
- func (p *Pod) Logs(path string, opts *v1.PodLogOptions) (*restclient.Request, error)
- func (p *Pod) Pod(fqn string) (string, error)
- func (p *Pod) TailLogs(ctx context.Context, c chan<- []byte, opts LogOptions) error
- type Policy
- type PortForward
- type PortForwarder
- func (p *PortForwarder) Active() bool
- func (p *PortForwarder) Age() string
- func (p *PortForwarder) Container() string
- func (p *PortForwarder) FQN() string
- func (p *PortForwarder) HasPortMapping(m string) bool
- func (p *PortForwarder) Path() string
- func (p *PortForwarder) Ports() []string
- func (p *PortForwarder) SetActive(b bool)
- func (p *PortForwarder) Start(path, co string, t client.PortTunnel) (*portforward.PortForwarder, error)
- func (p *PortForwarder) Stop()
- type Pulse
- type Rbac
- type ReplicaSet
- type Resource
- type ResourceMetas
- type RestMapper
- type Restartable
- type Runnable
- type Scalable
- type ScreenDump
- type Service
- type StatefulSet
- func (s *StatefulSet) IsHappy(sts appsv1.StatefulSet) bool
- func (s *StatefulSet) Pod(fqn string) (string, error)
- func (s *StatefulSet) Restart(path string) error
- func (s *StatefulSet) Scale(path string, replicas int32) error
- func (s *StatefulSet) TailLogs(ctx context.Context, c chan<- []byte, opts LogOptions) error
- type Subject
- type Switchable
- type Table
Constants ¶
This section is empty.
Variables ¶
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 FetchNodes ¶
FetchNodes retrieves all nodes.
func IsOpenFaasEnabled ¶ added in v0.15.0
func IsOpenFaasEnabled() bool
IsOpenFaasEnabled returns true if a gateway url is set in the environment.
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.
type Benchmark ¶
type Benchmark struct {
NonResource
}
Benchmark represents a benchmark resource.
type Chart ¶
type Chart struct {
NonResource
}
Chart represents a helm chart.
func (*Chart) EnsureHelmConfig ¶
func (c *Chart) EnsureHelmConfig(ns string) (*action.Configuration, error)
EnsureHelmConfig return a new configuration.
type Container ¶
type Container struct {
NonResource
}
Container represents a pod's container dao.
func (*Container) Logs ¶
func (c *Container) Logs(path string, opts *v1.PodLogOptions) (*restclient.Request, error)
Logs fetch container logs for a given pod and container.
type Context ¶
type Context struct {
NonResource
}
Context represents a kubenetes context.
func (*Context) KubeUpdate ¶
KubeUpdate modifies kubeconfig default 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 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.
type Deployment ¶
type Deployment struct {
Resource
}
Deployment represents a deployment K8s resource.
func (*Deployment) IsHappy ¶ added in v0.16.0
func (d *Deployment) IsHappy(dp appsv1.Deployment) bool
IsHappy check for happy deployments.
func (*Deployment) Load ¶ added in v0.17.0
func (*Deployment) Load(f Factory, fqn string) (*appsv1.Deployment, error)
Load returns a deployment instance.
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(path string) error
Restart a Deployment rollout.
func (*Deployment) Scale ¶
func (d *Deployment) Scale(path string, replicas int32) error
Scale a Deployment.
func (*Deployment) TailLogs ¶
func (d *Deployment) TailLogs(ctx context.Context, c chan<- []byte, opts LogOptions) 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) (string, error) }
Describer describes a resource.
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 // 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) // Forwards returns all portforwards. Forwarders() watch.Forwarders }
Factory represents a resource factory.
type Generic ¶
type Generic struct {
NonResource
}
Generic represents a generic 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 HorizontalPodAutoscaler ¶
type HorizontalPodAutoscaler struct {
Resource
}
HorizontalPodAutoscaler represents a HPA resource model.
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 LogOptions ¶
type LogOptions struct { Path string Container string Lines int64 Color color.Paint Previous bool SingleContainer bool MultiPods bool ShowTimestamp bool }
LogOptions represent logger options.
func (LogOptions) DecorateLog ¶
func (o LogOptions) DecorateLog(bytes []byte) []byte
DecorateLog add a log header to display po/co information along with the log message.
func (LogOptions) FixedSizeName ¶
func (o LogOptions) FixedSizeName() string
FixedSizeName returns a normalize fixed size pod name if possible.
func (LogOptions) HasContainer ¶
func (o LogOptions) HasContainer() bool
HasContainer checks if a container is present.
type Loggable ¶
type Loggable interface { // TaiLogs streams resource logs. TailLogs(ctx context.Context, c chan<- []byte, opts LogOptions) 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 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(path string, cascade, force bool) error }
Nuker represents a resource deleter.
type OpenFaas ¶ added in v0.15.0
type OpenFaas struct {
NonResource
}
OpenFaas represents a faas gateway connection.
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) Logs ¶
func (p *Pod) Logs(path string, opts *v1.PodLogOptions) (*restclient.Request, error)
Logs fetch container logs for a given pod and container.
type PortForward ¶
type PortForward struct {
NonResource
}
PortForward represents a port forward dao.
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) Container ¶
func (p *PortForwarder) Container() string
Container returns the targetes container.
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(m string) bool
HasPortMapping checks if port mapping is defined for this fwd.
func (*PortForwarder) Path ¶
func (p *PortForwarder) Path() string
Path returns the pod resource path.
func (*PortForwarder) Ports ¶
func (p *PortForwarder) Ports() []string
Ports returns the forwarded ports mappings.
func (*PortForwarder) SetActive ¶
func (p *PortForwarder) SetActive(b bool)
SetActive mark a portforward as active.
func (*PortForwarder) Start ¶
func (p *PortForwarder) Start(path, co string, t client.PortTunnel) (*portforward.PortForwarder, error)
Start initiates a port forward session for a given pod and ports.
type ReplicaSet ¶ added in v0.16.0
type ReplicaSet struct {
Resource
}
ReplicaSet represents a replicaset K8s resource.
func (*ReplicaSet) Load ¶ added in v0.17.0
func (r *ReplicaSet) Load(f Factory, path string) (*v1.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 ¶
Restartable represents a restartable resource.
type Scalable ¶
type Scalable interface { // Scale scales a resource up or down. Scale(path string, replicas int32) error }
Scalable represents resources that can scale.
type ScreenDump ¶
type ScreenDump struct {
NonResource
}
ScreenDump represents a scraped resources.
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 StatefulSet ¶
type StatefulSet struct {
Resource
}
StatefulSet represents a K8s sts.
func (*StatefulSet) IsHappy ¶ added in v0.16.0
func (s *StatefulSet) IsHappy(sts appsv1.StatefulSet) bool
IsHappy check for happy sts.
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(path string) error
Restart a StatefulSet rollout.
func (*StatefulSet) Scale ¶
func (s *StatefulSet) Scale(path string, replicas int32) error
Scale a StatefulSet.
func (*StatefulSet) TailLogs ¶
func (s *StatefulSet) TailLogs(ctx context.Context, c chan<- []byte, opts LogOptions) error
TailLogs tail logs for all pods represented by this StatefulSet.
type Switchable ¶
Switchable represents a switchable resource.
Source Files ¶
- alias.go
- benchmark.go
- chart.go
- container.go
- context.go
- crd.go
- cronjob.go
- cruiser.go
- describe.go
- dp.go
- ds.go
- generic.go
- helpers.go
- hpa.go
- job.go
- log_options.go
- node.go
- non_resource.go
- ofaas.go
- pod.go
- port_forward.go
- port_forwarder.go
- pulse.go
- rbac.go
- rbac_policy.go
- rbac_subject.go
- registry.go
- resource.go
- rest_mapper.go
- rs.go
- screen_dump.go
- sts.go
- svc.go
- table.go
- types.go