...

Package watch

Overview ▾

Package watch is a generated GoMock package.

Index ▾

Package files

backo.go file_watcher.go interface.go key_watcher.go key_watcher_unix.go mock.go noop_watcher.go pod_phases.go status.go term_unix_other.go watch.go

Constants

const (
    // PushErrorString is the string that is printed when an error occurs during watch's Push operation
    PushErrorString = "Error occurred on Push"
)

type Client

type Client interface {
    // WatchAndPush watches the component under the context directory and triggers Push if there are any changes
    // It also listens on ctx's Done channel to trigger cleanup when indicated to do so
    // componentStatus is a variable to store the status of the component, and that will be exchanged between
    // parts of code (unfortunately, tthere is no place to store the status of the component in some Kubernetes resource
    // as it is generally done for a Kubernetes resource)
    WatchAndPush(ctx context.Context, parameters WatchParameters, componentStatus ComponentStatus) error
}

type ComponentStatus

type ComponentStatus struct {
    PostStartEventsDone bool
    // RunExecuted is set to true when the run command has been executed
    // Used for HotReload capability
    RunExecuted        bool
    EndpointsForwarded map[string][]v1alpha2.Endpoint
    // ImageComponentsAutoApplied is a cache of all image components that have been auto-applied.
    // This map allows to avoid applying them too many times upon state changes in the cluster for example.
    ImageComponentsAutoApplied map[string]v1alpha2.ImageComponent
    // contains filtered or unexported fields
}

func (*ComponentStatus) GetState

func (o *ComponentStatus) GetState() State

func (*ComponentStatus) SetState

func (o *ComponentStatus) SetState(s State)

type ExpBackoff

type ExpBackoff struct {
    // contains filtered or unexported fields
}

func NewExpBackoff

func NewExpBackoff() *ExpBackoff

func (*ExpBackoff) Delay

func (o *ExpBackoff) Delay() time.Duration

func (*ExpBackoff) Reset

func (o *ExpBackoff) Reset()

type MockClient

MockClient is a mock of Client interface.

type MockClient struct {
    // contains filtered or unexported fields
}

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) WatchAndPush

func (m *MockClient) WatchAndPush(ctx context.Context, parameters WatchParameters, componentStatus ComponentStatus) error

WatchAndPush mocks base method.

type MockClientMockRecorder

MockClientMockRecorder is the mock recorder for MockClient.

type MockClientMockRecorder struct {
    // contains filtered or unexported fields
}

func (*MockClientMockRecorder) WatchAndPush

func (mr *MockClientMockRecorder) WatchAndPush(ctx, parameters, componentStatus interface{}) *gomock.Call

WatchAndPush indicates an expected call of WatchAndPush.

type NoOpWatcher

type NoOpWatcher struct{}

func NewNoOpWatcher

func NewNoOpWatcher() NoOpWatcher

func (NoOpWatcher) ResultChan

func (o NoOpWatcher) ResultChan() <-chan watch.Event

func (NoOpWatcher) Stop

func (o NoOpWatcher) Stop()

type PodPhases

type PodPhases map[metav1.Time]corev1.PodPhase

func NewPodPhases

func NewPodPhases() PodPhases

func (*PodPhases) Add

func (o *PodPhases) Add(out io.Writer, k metav1.Time, pod *corev1.Pod)

func (*PodPhases) Delete

func (o *PodPhases) Delete(out io.Writer, pod *corev1.Pod)

func (PodPhases) Display

func (o PodPhases) Display(out io.Writer)

type State

type State string
const (
    StateWaitDeployment State = "WaitDeployment"
    StateSyncOutdated   State = "SyncOutdated"
    //StateWaitBindings         State = "WaitBindings"
    //StatePodRunning           State = "PodRunning"
    //StateFilesSynced          State = "FilesSynced"
    //StateBuildCommandExecuted State = "BuildCommandExecuted"
    //StateRunCommandRunning    State = "RunCommandRunning"
    StateReady State = "Ready"
)

type WatchClient

type WatchClient struct {
    // contains filtered or unexported fields
}

func NewWatchClient

func NewWatchClient(
    kubeClient kclient.ClientInterface,
    informerClient *informer.InformerClient,
) *WatchClient

func (*WatchClient) WatchAndPush

func (o *WatchClient) WatchAndPush(ctx context.Context, parameters WatchParameters, componentStatus ComponentStatus) error

type WatchParameters

WatchParameters is designed to hold the controllables and attributes that the watch function works on

type WatchParameters struct {
    StartOptions dev.StartOptions

    // Custom function that can be used to push detected changes to remote pod. For more info about what each of the parameters to this function, please refer, pkg/component/component.go#PushLocal
    // WatchHandler func(kclient.ClientInterface, string, string, string, io.Writer, []string, []string, bool, []string, bool) error
    // Custom function that can be used to push detected changes to remote devfile pod. For more info about what each of the parameters to this function, please refer, pkg/devfile/adapters/interface.go#PlatformAdapter
    DevfileWatchHandler func(context.Context, common.PushParameters, *ComponentStatus) error
    // Parameter whether or not to show build logs
    Show bool
    // DebugPort indicates which debug port to use for pushing after sync
    DebugPort int

    // WatchCluster indicates to watch Cluster-related objects (Deployment, Pod, etc)
    WatchCluster bool
}