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 BuildLogAction
- type BuildLogActionWriter
- type BuildOrder
- type BuildStartedAction
- type CompositeBuildAndDeployer
- type ConfigsController
- type ConfigsReloadStartedAction
- type ConfigsReloadedAction
- type DontFallBackError
- type ErrorAction
- type FallbackTester
- type FsWatcherMaker
- type GlobalYAMLApplyCompleteAction
- type GlobalYAMLApplyStartedAction
- type GlobalYAMLBuildController
- type HardCancelReader
- 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 RedirectToNextBuilder
- type ServiceChangeAction
- type ServiceWatcher
- type ServiceWatcherMaker
- type SyncletBuildAndDeployer
- type SyncletManager
- type UpdateMode
- type UpdateModeFlag
- type Upper
- type WatchManager
- type WatchableManifest
Constants ¶
const ConfigsManifestName = "_ConfigsManifest"
TODO(maia): throw an error if you try to name a manifest this in your Tiltfile?
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(dockerfile.Labels{}), wire.Value(UpperReducer), build.DefaultImageBuilder, build.NewCacheBuilder, build.NewDockerImageBuilder, NewImageBuildAndDeployer, build.NewContainerUpdater, build.NewContainerResolver, NewSyncletBuildAndDeployer, NewLocalContainerBuildAndDeployer, DefaultBuildOrder, wire.Bind(new(BuildAndDeployer), new(CompositeBuildAndDeployer)), NewCompositeBuildAndDeployer, ProvideUpdateMode, 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, action) 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 BuildLogAction: handleBuildLogAction(state, action) case BuildCompleteAction: err = handleCompletedBuild(ctx, state, action) case BuildStartedAction: handleBuildStarted(ctx, state, action) case LogAction: handleLogAction(state, action) case GlobalYAMLApplyStartedAction: handleGlobalYAMLApplyStarted(ctx, state, action) case GlobalYAMLApplyCompleteAction: handleGlobalYAMLApplyComplete(ctx, state, action) case ConfigsReloadStartedAction: handleConfigsReloadStarted(ctx, state, action) case ConfigsReloadedAction: handleConfigsReloaded(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 BuildLogAction ¶ added in v0.2.0
type BuildLogAction struct { ManifestName model.ManifestName Log []byte }
func (BuildLogAction) Action ¶ added in v0.2.0
func (BuildLogAction) Action()
type BuildLogActionWriter ¶ added in v0.2.0
type BuildLogActionWriter struct {
// contains filtered or unexported fields
}
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 Reason model.BuildReason }
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) *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 ConfigsController ¶ added in v0.2.0
type ConfigsController struct {
// contains filtered or unexported fields
}
func NewConfigsController ¶ added in v0.2.0
func NewConfigsController() *ConfigsController
func (*ConfigsController) DisableForTesting ¶ added in v0.2.0
func (cc *ConfigsController) DisableForTesting(disabled bool)
type ConfigsReloadStartedAction ¶ added in v0.2.0
func (ConfigsReloadStartedAction) Action ¶ added in v0.2.0
func (ConfigsReloadStartedAction) Action()
type ConfigsReloadedAction ¶ added in v0.2.0
type ConfigsReloadedAction struct { Manifests []model.Manifest GlobalYAML model.YAMLManifest ConfigFiles []string Err error }
func (ConfigsReloadedAction) Action ¶ added in v0.2.0
func (ConfigsReloadedAction) Action()
type DontFallBackError ¶ added in v0.2.0
type DontFallBackError struct {
// contains filtered or unexported fields
}
Something is wrong enough that we shouldn't bother falling back to other BaD's -- they won't work.
func DontFallBackErrorf ¶ added in v0.2.0
func DontFallBackErrorf(msg string, a ...interface{}) DontFallBackError
func WrapDontFallBackError ¶ added in v0.2.0
func WrapDontFallBackError(err error) DontFallBackError
type ErrorAction ¶
type ErrorAction struct {
Error error
}
func NewErrorAction ¶
func NewErrorAction(err error) ErrorAction
func (ErrorAction) Action ¶
func (ErrorAction) Action()
type FallbackTester ¶
type FsWatcherMaker ¶
func ProvideFsWatcherMaker ¶
func ProvideFsWatcherMaker() FsWatcherMaker
type GlobalYAMLApplyCompleteAction ¶ added in v0.1.0
type GlobalYAMLApplyCompleteAction struct {
Error error
}
func (GlobalYAMLApplyCompleteAction) Action ¶ added in v0.1.0
func (GlobalYAMLApplyCompleteAction) 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 HardCancelReader ¶ added in v0.2.0
type HardCancelReader struct {
// contains filtered or unexported fields
}
A reader that will stop returning data after its context has been canceled.
If any data is read from the underlying stream after the cancel happens, throw the data out.
func NewHardCancelReader ¶ added in v0.2.0
func NewHardCancelReader(ctx context.Context, reader io.Reader) HardCancelReader
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, cacheBuilder build.CacheBuilder, 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 ConfigFiles []string ManifestNames []model.ManifestName }
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) *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 RedirectToNextBuilder ¶ added in v0.2.0
type RedirectToNextBuilder struct {
// contains filtered or unexported fields
}
Nothing is on fire, this is an expected case like a container builder being passed a build with no attached container. Don't need to show this to a user.
func RedirectToNextBuilderf ¶ added in v0.2.0
func RedirectToNextBuilderf(msg string, a ...interface{}) RedirectToNextBuilder
func WrapRedirectToNextBuilder ¶ added in v0.2.0
func WrapRedirectToNextBuilder(err error) RedirectToNextBuilder
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(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, hud hud.HeadsUpDisplay, pw *PodWatcher, sw *ServiceWatcher, st *store.Store, plm *PodLogManager, pfc *PortForwardController, fwm *WatchManager, bc *BuildController, ic *ImageController, gybc *GlobalYAMLBuildController, cc *ConfigsController, kcli k8s.Client) Upper
type WatchManager ¶
type WatchManager struct {
// contains filtered or unexported fields
}
func NewWatchManager ¶
func NewWatchManager(watcherMaker FsWatcherMaker, timerMaker timerMaker) *WatchManager
func (*WatchManager) DisableForTesting ¶ added in v0.2.0
func (w *WatchManager) DisableForTesting()
type WatchableManifest ¶ added in v0.1.0
type WatchableManifest interface { Dependencies() []string ManifestName() model.ManifestName LocalRepos() []model.LocalGithubRepo }
Source Files ¶
- actions.go
- build_and_deployer.go
- build_errors.go
- buildcontroller.go
- configs_controller.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
- reader.go
- service_watch.go
- synclet_build_and_deployer.go
- synclet_manager.go
- upper.go
- watchmanager.go
- wire_gen.go