Documentation ¶
Index ¶
- Variables
- func ReadLinesFromKeyboard(ctx context.Context, chanTimeout time.Duration) <-chan string
- func Run()
- type AsyncChanBundle
- func (a *AsyncChanBundle) Error(err error)
- func (a *AsyncChanBundle) GetErrorChannel() <-chan error
- func (a *AsyncChanBundle) GetReadyChannel() chan struct{}
- func (a *AsyncChanBundle) GetStopChannel() <-chan struct{}
- func (a *AsyncChanBundle) RaceCloseTimer(ctx context.Context, duration time.Duration) (isClosed bool)
- func (a *AsyncChanBundle) Ready()
- func (a *AsyncChanBundle) Stop()
- func (a *AsyncChanBundle) WaitReady(ctx context.Context) error
- type CliContext
- type DeletePod
- type KubernetesClient
- type PortForward
- type RemoteExec
- type RemoteExecOptions
- type Scope
- func (s *Scope) AddField(expression string)
- func (s *Scope) AddLabel(expression string)
- func (s *Scope) AddOrField(key string, value string)
- func (s *Scope) AddOrLabel(key string, value string)
- func (s *Scope) BuildListOptions() (options v1.ListOptions)
- func (s *Scope) IsPodInScope(pod v1Core.Pod) bool
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoPodInRunningState emitted when TCP connection is ok but no pods are currently ready to accept the request ErrNoPodInRunningState = errors.New("no pod is in running state") // ErrNoPodsMatchedQuery emitted when TCP connection is ok but no pods matched query (can happen also during scale) ErrNoPodsMatchedQuery = errors.New("no pods matched query") )
Functions ¶
func ReadLinesFromKeyboard ¶
ReadLinesFromKeyboard will return a channel that will emit full lines Notice: setting Stdin.SetReadDeadline is not always possible (depends OS and stdin type such as PIPE)
the method will ignore the error, if you need to use stdin on other context read from returned channel until it is closed
Types ¶
type AsyncChanBundle ¶
type AsyncChanBundle struct {
// contains filtered or unexported fields
}
AsyncChanBundle is a bundle to match some k8s apis
func (*AsyncChanBundle) Error ¶
func (a *AsyncChanBundle) Error(err error)
Error will stop the bundle and send error to err channel
func (*AsyncChanBundle) GetErrorChannel ¶
func (a *AsyncChanBundle) GetErrorChannel() <-chan error
GetErrorChannel returns error channel as readonly to write to the channel use .Error method
func (*AsyncChanBundle) GetReadyChannel ¶
func (a *AsyncChanBundle) GetReadyChannel() chan struct{}
GetReadyChannel returns the ready channel
func (*AsyncChanBundle) GetStopChannel ¶
func (a *AsyncChanBundle) GetStopChannel() <-chan struct{}
GetStopChannel returns the stop channel as readonly
func (*AsyncChanBundle) RaceCloseTimer ¶
func (a *AsyncChanBundle) RaceCloseTimer(ctx context.Context, duration time.Duration) (isClosed bool)
RaceCloseTimer will emit the first of ctx.Done, duration or bundle stop
func (*AsyncChanBundle) Stop ¶
func (a *AsyncChanBundle) Stop()
Stop the bundle, can be called multiple times
type CliContext ¶
type CliContext struct { Ctx *cli.Context KClient *KubernetesClient Scope Scope Pods []v1.Pod App labelKeyValue // contains filtered or unexported fields }
CliContext is the main api for kubeba currently kubeba is coupled to run as CLI program
func NewFromContext ¶
func NewFromContext(ctx *cli.Context) *CliContext
NewFromContext creates CLI context from urfave cli
func (*CliContext) FilterPods ¶
func (cc *CliContext) FilterPods()
FilterPods will clear pods which isnt in scope k8s api doesn't allow complex conditions so it has to be done on the client side
func (*CliContext) LoadApp ¶
func (cc *CliContext) LoadApp() (err error)
LoadApp load relevant deployment
func (*CliContext) LoadNamespace ¶
func (cc *CliContext) LoadNamespace() (err error)
LoadNamespace will load a namespace if more than one found \ exists \ matched query
func (*CliContext) LoadPods ¶
func (cc *CliContext) LoadPods() error
LoadPods will force to reload pods list
type DeletePod ¶
type DeletePod struct {
// contains filtered or unexported fields
}
DeletePod holds info for delete pod request
func NewDeletePod ¶
NewDeletePod Create delete pod request
type KubernetesClient ¶
type KubernetesClient struct { *kubernetes.Clientset Config *rest.Config }
KubernetesClient wraps google k8s client
func NewClient ¶
func NewClient(kubeconfig string) (*KubernetesClient, error)
NewClient generate wrapped k8s client
func (*KubernetesClient) GetPodsForScope ¶
func (k *KubernetesClient) GetPodsForScope(scope Scope) ([]v1.Pod, error)
GetPodsForScope filter only relevant pods matching scope
type PortForward ¶
type PortForward struct {
// contains filtered or unexported fields
}
PortForward instance of port forward to pod instance
func NewPortForward ¶
func NewPortForward(pod v1.Pod, client *KubernetesClient, localPort int, podPort int) *PortForward
NewPortForward constructs port forward request (but wont start it yet)
func (*PortForward) Start ¶
func (p *PortForward) Start(bundle *AsyncChanBundle, stdout io.Writer, stderr io.Writer)
Start the port forward, blocks until channel is closed or error happened.
type RemoteExec ¶
type RemoteExec struct {
// contains filtered or unexported fields
}
RemoteExec for specific exec instance
func NewRemoteExec ¶
func NewRemoteExec(pod v1.Pod, client *KubernetesClient, cmd string) *RemoteExec
NewRemoteExec creates remote exec instance but wont start yet
type RemoteExecOptions ¶
type RemoteExecOptions struct { Cmd []string Container string Pod v1.Pod Tty bool Interactive bool }
RemoteExecOptions for RemoteExec
type Scope ¶
type Scope struct { Namespace string // name contains and not equals FreeName string Labels []string Fields []string // since k8s doesn't support OR condition for fields (fieldA=x OR fieldB=y) // this will perform the or condition logically inside the app OrLabels map[string]string OrFields map[string]string }
Scope filters all the pods in the cluster to a specific app / deployment
func (*Scope) AddOrField ¶
AddOrField isn't supported by k8s and will happen on client side
func (*Scope) AddOrLabel ¶
AddOrLabel isn't supported by k8s and will happen on client side
func (*Scope) BuildListOptions ¶
func (s *Scope) BuildListOptions() (options v1.ListOptions)
BuildListOptions converts the scope options to k8s api request