const ( // PushErrorString is the string that is printed when an error occurs during watch's Push operation PushErrorString = "Error occurred on Push" )
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 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 (o *ComponentStatus) GetState() State
func (o *ComponentStatus) SetState(s State)
type ExpBackoff struct {
// contains filtered or unexported fields
}
func NewExpBackoff() *ExpBackoff
func (o *ExpBackoff) Delay() time.Duration
func (o *ExpBackoff) Reset()
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClient) WatchAndPush(ctx context.Context, parameters WatchParameters, componentStatus ComponentStatus) error
WatchAndPush mocks base method.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) WatchAndPush(ctx, parameters, componentStatus interface{}) *gomock.Call
WatchAndPush indicates an expected call of WatchAndPush.
type NoOpWatcher struct{}
func NewNoOpWatcher() NoOpWatcher
func (o NoOpWatcher) ResultChan() <-chan watch.Event
func (o NoOpWatcher) Stop()
type PodPhases map[metav1.Time]corev1.PodPhase
func NewPodPhases() PodPhases
func (o *PodPhases) Add(out io.Writer, k metav1.Time, pod *corev1.Pod)
func (o *PodPhases) Delete(out io.Writer, pod *corev1.Pod)
func (o PodPhases) Display(out io.Writer)
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 struct {
// contains filtered or unexported fields
}
func NewWatchClient( kubeClient kclient.ClientInterface, informerClient *informer.InformerClient, ) *WatchClient
func (o *WatchClient) WatchAndPush(ctx context.Context, parameters WatchParameters, componentStatus ComponentStatus) error
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 }