Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllWatcherTypes = []WatcherType{ WatcherTypeKubeAPI, WatcherTypeSharedProcessNS, WatcherTypeFile, WatcherTypeNoop, }
var ErrTimeout = fmt.Errorf("timeout while waiting")
Functions ¶
func FileExists ¶
func FilterProcessList ¶
func FilterProcessList(procs []ps.Process, filterPids sets.Int, allowedParentPid int) ([]ps.Process, error)
given list of processes returns a list of processes such that, the pid does not match any of the given filterPids, this is to filter the /pause and current process. and the parentPid is the allowedParentPid. The logic for this is because every process in the shared namespace always has a parent pid of 0
Types ¶
type ContainerInformation ¶
type NoopWatcher ¶
type NoopWatcher struct { }
func (NoopWatcher) WaitToExit ¶
func (n NoopWatcher) WaitToExit(ctx context.Context) error
func (NoopWatcher) WaitToStart ¶
func (n NoopWatcher) WaitToStart(ctx context.Context) error
type SharedNamespaceProcessLister ¶
type SharedNamespaceProcessLister struct {
// contains filtered or unexported fields
}
func (*SharedNamespaceProcessLister) AnyProcessRunning ¶
func (s *SharedNamespaceProcessLister) AnyProcessRunning(ctx context.Context) (bool, error)
func (*SharedNamespaceProcessLister) ListRunningProcesses ¶
func (s *SharedNamespaceProcessLister) ListRunningProcesses(ctx context.Context) ([]ps.Process, error)
Polls all processes and returns a filtered set. Refer to FilterProcessList for understanding the process of filtering
type Watcher ¶
type Watcher interface { WaitToStart(ctx context.Context) error WaitToExit(ctx context.Context) error }
func NewKubeAPIWatcher ¶
func NewKubeAPIWatcher(_ context.Context, clientConfig clientcmd.ClientConfig, info ContainerInformation) (Watcher, error)
func NewSharedProcessNSWatcher ¶
func NewSharedProcessNSWatcher(ctx context.Context, pollInterval time.Duration, waitNumIntervalsBeforeFinalize int) (Watcher, error)
c -> clock.Clock allows for injecting a fake clock. The watcher uses a timer pollInterval -> time.Duration, wait for this amount of time between successive process checks waitNumIntervalsBeforeFinalize -> Number of successive poll intervals of missing processes for the container, before assuming process is complete. 0/1 indicate the first time a process is detected to be missing, the wait if finalized. containerStartupTimeout -> Duration for which to wait for the container to start up. If the container has not started up in this time, exit with error.
type WatcherType ¶
type WatcherType = string
const ( // Uses KubeAPI to determine if the container is completed WatcherTypeKubeAPI WatcherType = "kube-api" // Uses a success file to determine if the container has completed. // CAUTION: Does not work if the container exits because of OOM, etc WatcherTypeFile WatcherType = "file" // To look for pid in the shared namespace. WatcherTypeSharedProcessNS WatcherType = "shared-process-ns" // Dummy watcher. Exits immediately, assuming success WatcherTypeNoop WatcherType = "noop" )