Documentation ¶
Index ¶
- Variables
- func InitKubernetesExtraClusterClient(configPath, context string) (kubernetes.Interface, error)
- func InitKubernetesInClusterClient() (kubernetes.Interface, error)
- type CreatePod
- type DeletePod
- type EventCallback
- type InitialListComplete
- type Logger
- type ModPod
- type PodEvent
- type PodWatcher
- type ResourceVersion
Constants ¶
This section is empty.
Variables ¶
var ErrResultsClosed = errors.New("k8s result channel closed")
ErrResultsClosed indicates that the function exited because the results channel was closed.
Functions ¶
func InitKubernetesExtraClusterClient ¶
func InitKubernetesExtraClusterClient(configPath, context string) (kubernetes.Interface, error)
InitKubernetesExtraClusterClient attempts to initialize a kubernetes client outside the cluster
func InitKubernetesInClusterClient ¶
func InitKubernetesInClusterClient() (kubernetes.Interface, error)
InitKubernetesInClusterClient initializes a kubernetes clientset with the config that service account kubernetes gives to pods. Assumes the application is running in a kubernetes cluster and will return an error when not running in cluster
Types ¶
type CreatePod ¶
type CreatePod struct { IP *net.IPAddr // The new Pod's definition Def *k8score.Pod // contains filtered or unexported fields }
CreatePod indicates that a pod has been created and now has an assigned IP
func (*CreatePod) Continues ¶ added in v1.0.0
Continues indicates that the next event will use the same ResourceVersion because this event is part of either the same initial-state-dump or resync.
func (*CreatePod) ResourceVersion ¶ added in v0.2.0
func (c *CreatePod) ResourceVersion() ResourceVersion
ResourceVersion implements PodEvent
type DeletePod ¶
type DeletePod struct {
// contains filtered or unexported fields
}
DeletePod indicates that a pod has been destroyed (or is shutting down) and should no longer be watched.
func (*DeletePod) Continues ¶ added in v1.0.0
Continues indicates that the next event will use the same ResourceVersion because this event is part of the same resync.
func (*DeletePod) ResourceVersion ¶ added in v0.2.0
func (d *DeletePod) ResourceVersion() ResourceVersion
ResourceVersion implements PodEvent
type EventCallback ¶
EventCallback defines a function for handling pod lifetime events the context will be a copy of the context passed to the Run() method on PodWatcher.
type InitialListComplete ¶ added in v1.1.0
type InitialListComplete struct {
// contains filtered or unexported fields
}
InitialListComplete is a synthetic event indicating that the initial list of pods matching the specified label matcher is complete (all previous `CreatePod` events' callbacks have completed).
func (*InitialListComplete) Continues ¶ added in v1.1.0
func (i *InitialListComplete) Continues() bool
Continues indicates that the next event will use the same ResourceVersion because this event is part of either the same initial-state-dump or resync. This is always the last event of the initial state-dump, so it always has Continues set to false.
func (*InitialListComplete) PodName ¶ added in v1.1.0
func (i *InitialListComplete) PodName() string
PodName returns an empty string because it's not really a single pod event.
func (*InitialListComplete) ResourceVersion ¶ added in v1.1.0
func (i *InitialListComplete) ResourceVersion() ResourceVersion
ResourceVersion returns the ResourceVersion of the initial list
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
}
Logger implementations resemble the stdlogger interface.
type ModPod ¶
type ModPod struct { IP *net.IPAddr // The new Pod definition Def *k8score.Pod // contains filtered or unexported fields }
ModPod indicates a change in a pod's status or definition (anything that isn't a creation or deletion)
func (*ModPod) Continues ¶ added in v1.0.0
Continues indicates that the next event will use the same ResourceVersion because this event is part of either the same initial-state-dump or resync.
func (*ModPod) ResourceVersion ¶ added in v0.2.0
func (m *ModPod) ResourceVersion() ResourceVersion
ResourceVersion implements PodEvent
type PodEvent ¶
type PodEvent interface { PodName() string ResourceVersion() ResourceVersion // Continues indicates that the next event will use the same // ResourceVersion because this event is part of either the same // initial-state-dump or resync. Continues() bool }
PodEvent is the interface type for events being returned over a channel
type PodWatcher ¶
type PodWatcher struct { // Logger is a Logger implementation which is used for logging if non-nil Logger Logger // contains filtered or unexported fields }
PodWatcher uses the k8s API to watch for new/deleted k8s pods
func NewPodWatcher ¶
func NewPodWatcher(cs kubernetes.Interface, k8sNamespace, selector string, cbs ...EventCallback) *PodWatcher
NewPodWatcher constructs a new PodWatcher. Each callback in the variadic callback list is called in its own goroutine.
type ResourceVersion ¶ added in v0.2.0
type ResourceVersion string
ResourceVersion is the version string associated with the object/event. K8s documents that it is only valid to compare it for equality, and hence not otherwise sortable.