Documentation
¶
Index ¶
- Constants
- Variables
- func ParseYAMLFromManifests(manifests ...model.Manifest) ([]k8s.K8sEntity, error)
- func PopulatePortForwards(m portForwardableManifest, pod store.Pod) []model.PortForward
- func ProvideTimerMaker() timerMaker
- func TiltRunLabel() k8s.LabelPair
- type BuildAndDeployer
- type BuildCompleteAction
- type BuildController
- type BuildOrder
- type BuildStartedAction
- type CompositeBuildAndDeployer
- type DeployDiscovery
- func (d *DeployDiscovery) DeployInfoForImageBlocking(ctx context.Context, img reference.NamedTagged) (DeployInfo, error)
- func (d *DeployDiscovery) EnsureDeployInfoFetchStarted(ctx context.Context, img reference.NamedTagged, ns k8s.Namespace)
- func (d *DeployDiscovery) ForgetImage(img reference.NamedTagged) DeployInfo
- type DeployInfo
- type ErrorAction
- type FallbackTester
- type FsWatcherMaker
- type GlobalYAMLApplyCompleteAction
- type GlobalYAMLApplyError
- type GlobalYAMLApplyStartedAction
- type GlobalYAMLBuildController
- type GlobalYAMLManifestReloadedAction
- type HudStoppedAction
- type ImageBuildAndDeployer
- func (ibd *ImageBuildAndDeployer) BuildAndDeploy(ctx context.Context, manifest model.Manifest, state store.BuildState) (br store.BuildResult, err error)
- func (ibd *ImageBuildAndDeployer) PostProcessBuild(ctx context.Context, result, previousResult store.BuildResult)
- func (ibd *ImageBuildAndDeployer) SetInjectSynclet(inject bool)
- type ImageController
- type InitAction
- type LocalContainerBuildAndDeployer
- type LogAction
- type ManifestReloadedAction
- type PodChangeAction
- type PodLogAction
- type PodLogActionWriter
- type PodLogManager
- type PodLogWatch
- type PodWatcher
- type PodWatcherMaker
- type PortForwardController
- type ServiceChangeAction
- type ServiceWatcher
- type ServiceWatcherMaker
- type SyncletBuildAndDeployer
- type SyncletManager
- type UpdateMode
- type UpdateModeFlag
- type Upper
- type WatchManager
- type WatchableManifest
Constants ¶
const ManifestNameLabel = "tilt-manifest"
const TiltRunIDLabel = "tilt-runid"
Variables ¶
var AllUpdateModes = []UpdateMode{ UpdateModeAuto, UpdateModeImage, UpdateModeNaive, UpdateModeSynclet, UpdateModeContainer, }
var DeployerBaseWireSet = wire.NewSet(build.DefaultConsole, build.DefaultOut, wire.Value(build.Labels{}), wire.Value(UpperReducer), build.DefaultImageBuilder, build.NewDockerImageBuilder, NewImageBuildAndDeployer, build.NewContainerUpdater, build.NewContainerResolver, NewSyncletBuildAndDeployer, NewLocalContainerBuildAndDeployer, DefaultBuildOrder, NewDeployDiscovery, wire.Bind(new(BuildAndDeployer), new(CompositeBuildAndDeployer)), NewCompositeBuildAndDeployer, ProvideUpdateMode, store.NewStore, NewGlobalYAMLBuildController, )
var DeployerWireSet = wire.NewSet( DeployerBaseWireSet, NewSyncletManager, )
var DeployerWireSetTest = wire.NewSet( DeployerBaseWireSet, NewSyncletManagerForTests, )
var TiltRunID = uuid.New().String()
var UpperReducer = store.Reducer(func(ctx context.Context, state *store.EngineState, action store.Action) { var err error switch action := action.(type) { case InitAction: err = handleInitAction(ctx, state, action) case ErrorAction: err = action.Error case hud.ExitAction: handleExitAction(state) case manifestFilesChangedAction: handleFSEvent(ctx, state, action) case PodChangeAction: handlePodEvent(ctx, state, action.Pod) case ServiceChangeAction: handleServiceEvent(ctx, state, action) case PodLogAction: handlePodLogAction(state, action) case BuildCompleteAction: err = handleCompletedBuild(ctx, state, action) case hud.ShowErrorAction: showError(ctx, state, action.ResourceNumber) case BuildStartedAction: handleBuildStarted(ctx, state, action) case ManifestReloadedAction: handleManifestReloaded(ctx, state, action) case LogAction: handleLogAction(state, action) case GlobalYAMLManifestReloadedAction: handleGlobalYAMLManifestReloaded(ctx, state, action) case GlobalYAMLApplyStartedAction: handleGlobalYAMLApplyStarted(ctx, state, action) case GlobalYAMLApplyCompleteAction: handleGlobalYAMLApplyComplete(ctx, state, action) case GlobalYAMLApplyError: handleGlobalYAMLApplyError(ctx, state, action) default: err = fmt.Errorf("unrecognized action: %T", action) } if err != nil { state.PermanentError = err } })
Functions ¶
func ParseYAMLFromManifests ¶
func PopulatePortForwards ¶
func PopulatePortForwards(m portForwardableManifest, pod store.Pod) []model.PortForward
Extract the port-forward specs from the manifest. If any of them have ContainerPort = 0, populate them with the default port in the pod spec. Quietly drop forwards that we can't populate.
func ProvideTimerMaker ¶
func ProvideTimerMaker() timerMaker
func TiltRunLabel ¶
Types ¶
type BuildAndDeployer ¶
type BuildAndDeployer interface { // BuildAndDeploy builds and deployed the specified manifest. // // Returns a BuildResult that expresses the output of the build. // // BuildResult can be used to construct a BuildState, which contains // the last successful build and the files changed since that build. BuildAndDeploy(ctx context.Context, manifest model.Manifest, currentState store.BuildState) (store.BuildResult, error) // PostProcessBuild gets any info about the build that we'll need for subsequent builds. // In general, we'll store this info ON the BuildAndDeployer that needs it. // Each implementation of PostProcessBuild is responsible for executing long-running steps async. PostProcessBuild(ctx context.Context, result, prevResult store.BuildResult) }
type BuildCompleteAction ¶
type BuildCompleteAction struct { Result store.BuildResult Error error }
func NewBuildCompleteAction ¶
func NewBuildCompleteAction(result store.BuildResult, err error) BuildCompleteAction
func (BuildCompleteAction) Action ¶
func (BuildCompleteAction) Action()
type BuildController ¶
type BuildController struct {
// contains filtered or unexported fields
}
func NewBuildController ¶
func NewBuildController(b BuildAndDeployer) *BuildController
func (*BuildController) DisableForTesting ¶ added in v0.1.0
func (c *BuildController) DisableForTesting()
type BuildOrder ¶
type BuildOrder []BuildAndDeployer
func DefaultBuildOrder ¶
func DefaultBuildOrder(sbad *SyncletBuildAndDeployer, cbad *LocalContainerBuildAndDeployer, ibad *ImageBuildAndDeployer, env k8s.Env, mode UpdateMode) BuildOrder
type BuildStartedAction ¶
type BuildStartedAction struct { Manifest model.Manifest StartTime time.Time FilesChanged []string }
func (BuildStartedAction) Action ¶
func (BuildStartedAction) Action()
type CompositeBuildAndDeployer ¶
type CompositeBuildAndDeployer struct {
// contains filtered or unexported fields
}
CompositeBuildAndDeployer tries to run each builder in order. If a builder emits an error, it uses the FallbackTester to determine whether the error is critical enough to stop the whole pipeline, or to fallback to the next builder.
func NewCompositeBuildAndDeployer ¶
func NewCompositeBuildAndDeployer(builders BuildOrder, shouldFallBack FallbackTester) *CompositeBuildAndDeployer
func (*CompositeBuildAndDeployer) BuildAndDeploy ¶
func (composite *CompositeBuildAndDeployer) BuildAndDeploy(ctx context.Context, manifest model.Manifest, currentState store.BuildState) (store.BuildResult, error)
func (*CompositeBuildAndDeployer) PostProcessBuild ¶
func (composite *CompositeBuildAndDeployer) PostProcessBuild(ctx context.Context, result, prevResult store.BuildResult)
type DeployDiscovery ¶
type DeployDiscovery struct {
// contains filtered or unexported fields
}
Looks up containers after they've been deployed.
func NewDeployDiscovery ¶
func NewDeployDiscovery(kCli k8s.Client, store *store.Store) *DeployDiscovery
func (*DeployDiscovery) DeployInfoForImageBlocking ¶
func (d *DeployDiscovery) DeployInfoForImageBlocking(ctx context.Context, img reference.NamedTagged) (DeployInfo, error)
func (*DeployDiscovery) EnsureDeployInfoFetchStarted ¶
func (d *DeployDiscovery) EnsureDeployInfoFetchStarted(ctx context.Context, img reference.NamedTagged, ns k8s.Namespace)
func (*DeployDiscovery) ForgetImage ¶
func (d *DeployDiscovery) ForgetImage(img reference.NamedTagged) DeployInfo
Returns the deploy info that was forgotten, if any.
type DeployInfo ¶
type DeployInfo struct {
// contains filtered or unexported fields
}
func (DeployInfo) Empty ¶
func (d DeployInfo) Empty() bool
type ErrorAction ¶
type ErrorAction struct {
Error error
}
func NewErrorAction ¶
func NewErrorAction(err error) ErrorAction
func (ErrorAction) Action ¶
func (ErrorAction) Action()
type FallbackTester ¶
func DefaultShouldFallBack ¶
func DefaultShouldFallBack() FallbackTester
type FsWatcherMaker ¶
func ProvideFsWatcherMaker ¶
func ProvideFsWatcherMaker() FsWatcherMaker
type GlobalYAMLApplyCompleteAction ¶ added in v0.1.0
type GlobalYAMLApplyCompleteAction struct{}
func (GlobalYAMLApplyCompleteAction) Action ¶ added in v0.1.0
func (GlobalYAMLApplyCompleteAction) Action()
type GlobalYAMLApplyError ¶ added in v0.1.0
type GlobalYAMLApplyError struct {
Error error
}
func (GlobalYAMLApplyError) Action ¶ added in v0.1.0
func (GlobalYAMLApplyError) Action()
type GlobalYAMLApplyStartedAction ¶ added in v0.1.0
type GlobalYAMLApplyStartedAction struct{}
func (GlobalYAMLApplyStartedAction) Action ¶ added in v0.1.0
func (GlobalYAMLApplyStartedAction) Action()
type GlobalYAMLBuildController ¶ added in v0.1.0
type GlobalYAMLBuildController struct {
// contains filtered or unexported fields
}
func NewGlobalYAMLBuildController ¶ added in v0.1.0
func NewGlobalYAMLBuildController(k8sClient k8s.Client) *GlobalYAMLBuildController
type GlobalYAMLManifestReloadedAction ¶ added in v0.1.0
type GlobalYAMLManifestReloadedAction struct {
GlobalYAML model.YAMLManifest
}
func (GlobalYAMLManifestReloadedAction) Action ¶ added in v0.1.0
func (GlobalYAMLManifestReloadedAction) Action()
type HudStoppedAction ¶ added in v0.1.0
type HudStoppedAction struct {
// contains filtered or unexported fields
}
func NewHudStoppedAction ¶ added in v0.1.0
func NewHudStoppedAction(err error) HudStoppedAction
func (HudStoppedAction) Action ¶ added in v0.1.0
func (HudStoppedAction) Action()
type ImageBuildAndDeployer ¶
type ImageBuildAndDeployer struct {
// contains filtered or unexported fields
}
func NewImageBuildAndDeployer ¶
func NewImageBuildAndDeployer(b build.ImageBuilder, k8sClient k8s.Client, env k8s.Env, analytics analytics.Analytics, updateMode UpdateMode) *ImageBuildAndDeployer
func (*ImageBuildAndDeployer) BuildAndDeploy ¶
func (ibd *ImageBuildAndDeployer) BuildAndDeploy(ctx context.Context, manifest model.Manifest, state store.BuildState) (br store.BuildResult, err error)
func (*ImageBuildAndDeployer) PostProcessBuild ¶
func (ibd *ImageBuildAndDeployer) PostProcessBuild(ctx context.Context, result, previousResult store.BuildResult)
func (*ImageBuildAndDeployer) SetInjectSynclet ¶
func (ibd *ImageBuildAndDeployer) SetInjectSynclet(inject bool)
Turn on synclet injection. Should be called before any builds.
type ImageController ¶ added in v0.1.0
type ImageController struct {
// contains filtered or unexported fields
}
Handles image garbage collection.
func NewImageController ¶ added in v0.1.0
func NewImageController(reaper build.ImageReaper) *ImageController
type InitAction ¶
type InitAction struct { WatchMounts bool Manifests []model.Manifest GlobalYAMLManifest model.YAMLManifest TiltfilePath string }
func (InitAction) Action ¶
func (InitAction) Action()
type LocalContainerBuildAndDeployer ¶
type LocalContainerBuildAndDeployer struct {
// contains filtered or unexported fields
}
func NewLocalContainerBuildAndDeployer ¶
func NewLocalContainerBuildAndDeployer(cu *build.ContainerUpdater, analytics analytics.Analytics, dd *DeployDiscovery) *LocalContainerBuildAndDeployer
func (*LocalContainerBuildAndDeployer) BuildAndDeploy ¶
func (cbd *LocalContainerBuildAndDeployer) BuildAndDeploy(ctx context.Context, manifest model.Manifest, state store.BuildState) (result store.BuildResult, err error)
func (*LocalContainerBuildAndDeployer) PostProcessBuild ¶
func (cbd *LocalContainerBuildAndDeployer) PostProcessBuild(ctx context.Context, result, previousResult store.BuildResult)
type ManifestReloadedAction ¶
type ManifestReloadedAction struct { OldManifest model.Manifest NewManifest model.Manifest Error error }
func (ManifestReloadedAction) Action ¶
func (ManifestReloadedAction) Action()
type PodChangeAction ¶
func NewPodChangeAction ¶
func NewPodChangeAction(pod *v1.Pod) PodChangeAction
func (PodChangeAction) Action ¶
func (PodChangeAction) Action()
type PodLogAction ¶
type PodLogAction struct { ManifestName model.ManifestName PodID k8s.PodID Log []byte }
func (PodLogAction) Action ¶
func (PodLogAction) Action()
type PodLogActionWriter ¶
type PodLogActionWriter struct {
// contains filtered or unexported fields
}
type PodLogManager ¶
type PodLogManager struct {
// contains filtered or unexported fields
}
Collects logs from deployed containers.
func NewPodLogManager ¶
func NewPodLogManager(kClient k8s.Client) *PodLogManager
type PodLogWatch ¶
type PodLogWatch struct {
// contains filtered or unexported fields
}
type PodWatcher ¶
type PodWatcher struct {
// contains filtered or unexported fields
}
func NewPodWatcher ¶
func NewPodWatcher(kCli k8s.Client) *PodWatcher
type PortForwardController ¶
type PortForwardController struct {
// contains filtered or unexported fields
}
func NewPortForwardController ¶
func NewPortForwardController(kClient k8s.Client) *PortForwardController
type ServiceChangeAction ¶
func NewServiceChangeAction ¶
func NewServiceChangeAction(service *v1.Service, url *url.URL) ServiceChangeAction
func (ServiceChangeAction) Action ¶
func (ServiceChangeAction) Action()
type ServiceWatcher ¶
type ServiceWatcher struct {
// contains filtered or unexported fields
}
func NewServiceWatcher ¶
func NewServiceWatcher(kCli k8s.Client, nodeIP k8s.NodeIP) *ServiceWatcher
type SyncletBuildAndDeployer ¶
type SyncletBuildAndDeployer struct {
// contains filtered or unexported fields
}
func NewSyncletBuildAndDeployer ¶
func NewSyncletBuildAndDeployer(dd *DeployDiscovery, sm SyncletManager) *SyncletBuildAndDeployer
func (*SyncletBuildAndDeployer) BuildAndDeploy ¶
func (sbd *SyncletBuildAndDeployer) BuildAndDeploy(ctx context.Context, manifest model.Manifest, state store.BuildState) (store.BuildResult, error)
func (*SyncletBuildAndDeployer) PostProcessBuild ¶
func (sbd *SyncletBuildAndDeployer) PostProcessBuild(ctx context.Context, result, previousResult store.BuildResult)
type SyncletManager ¶
type SyncletManager struct {
// contains filtered or unexported fields
}
func NewSyncletManager ¶
func NewSyncletManager(kCli k8s.Client) SyncletManager
func NewSyncletManagerForTests ¶
func NewSyncletManagerForTests(kCli k8s.Client, fakeCli synclet.SyncletClient) SyncletManager
func (SyncletManager) ClientForPod ¶
func (sm SyncletManager) ClientForPod(ctx context.Context, podID k8s.PodID, ns k8s.Namespace) (synclet.SyncletClient, error)
type UpdateMode ¶
type UpdateMode string
var ( // Auto-pick the build mode based on UpdateModeAuto UpdateMode = "auto" // Only do image builds UpdateModeImage UpdateMode = "image" // Only do image builds from scratch UpdateModeNaive UpdateMode = "naive" // Deploy a synclet to make container updates faster UpdateModeSynclet UpdateMode = "synclet" // Update containers in-place. This mode only works with DockerForDesktop and Minikube. // If you try to use this mode with a different K8s cluster type, we will return an error UpdateModeContainer UpdateMode = "container" )
func ProvideUpdateMode ¶
func ProvideUpdateMode(flag UpdateModeFlag, env k8s.Env) (UpdateMode, error)
type UpdateModeFlag ¶
type UpdateModeFlag UpdateMode
A type to bind to flag values that need validation.
type Upper ¶
type Upper struct {
// contains filtered or unexported fields
}
TODO(nick): maybe this should be called 'BuildEngine' or something? Upper seems like a poor and undescriptive name.
func NewUpper ¶
func NewUpper(ctx context.Context, b BuildAndDeployer, hud hud.HeadsUpDisplay, pw *PodWatcher, sw *ServiceWatcher, st *store.Store, plm *PodLogManager, pfc *PortForwardController, fwm *WatchManager, fswm FsWatcherMaker, bc *BuildController, ic *ImageController, gybc *GlobalYAMLBuildController) Upper
type WatchManager ¶
type WatchManager struct {
// contains filtered or unexported fields
}
func NewWatchManager ¶
func NewWatchManager(watcherMaker FsWatcherMaker, timerMaker timerMaker) *WatchManager
type WatchableManifest ¶ added in v0.1.0
type WatchableManifest interface { Dependencies() []string ManifestName() model.ManifestName ConfigMatcher() (model.PathMatcher, error) LocalRepos() []model.LocalGithubRepo }
Source Files
¶
- actions.go
- build_and_deployer.go
- buildcontroller.go
- deploy.go
- global_yaml_buildcontroller.go
- image_build_and_deployer.go
- imagecontroller.go
- local_container_build_and_deployer.go
- mode.go
- parse.go
- pod.go
- pod_watch.go
- podlogmanager.go
- portforwardcontroller.go
- service_watch.go
- synclet_build_and_deployer.go
- synclet_manager.go
- upper.go
- watchmanager.go
- wire_gen.go