model

package
v0.28.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const BuildHistoryLimit = 2
View Source
const BuildReasonNone = BuildReason(0)
View Source
const (
	DefaultMaxParallelUpdates = 3
)
View Source
const DefaultTelemetryPeriod = 60 * time.Second
View Source
const DefaultWebPort = 10350
View Source
const DockerPruneDefaultInterval = time.Hour

How often to prune Docker images while Tilt is running

View Source
const DockerPruneDefaultKeepRecent = 2

Keep the last 2 builds of an image

View Source
const DockerPruneDefaultMaxAge = time.Hour * 6

Prune Docker objects older than this

View Source
const MainTiltfileManifestName = ManifestName("(Tiltfile)")
View Source
const OrchestratorDC = Orchestrator("DockerCompose")
View Source
const OrchestratorK8s = Orchestrator("Kubernetes")
View Source
const OrchestratorUnknown = Orchestrator("")
View Source
const UnresourcedYAMLManifestName = ManifestName("uncategorized")

TODO(maia): throw an error if you try to name a manifest this in your Tiltfile?

Variables

Functions

func ArgListToString added in v0.21.1

func ArgListToString(args []string) string

func ChangesInvalidateBuild

func ChangesInvalidateBuild(old, new Manifest) bool

ChangesInvalidateBuild checks whether the changes from old => new manifest invalidate our build of the old one; i.e. if we're replacing `old` with `new`, should we perform a full rebuild?

func DockerignoresToIgnores added in v0.27.3

func DockerignoresToIgnores(source []Dockerignore) []v1alpha1.IgnoreDef

func FilterLiveUpdateOnly added in v0.23.5

func FilterLiveUpdateOnly(imageMapDeps []string, imageTargets []ImageTarget) []string

func ImageTargetsByID

func ImageTargetsByID(iTargets []ImageTarget) map[TargetID]ImageTarget

func IsEmptyDockerComposeProject added in v0.22.12

func IsEmptyDockerComposeProject(p v1alpha1.DockerComposeProject) bool

func LinksToURLStrings added in v0.17.8

func LinksToURLStrings(lns []Link) []string

func LocalRefSelectorsForManifests added in v0.14.0

func LocalRefSelectorsForManifests(manifests []Manifest, clusters map[string]*v1alpha1.Cluster) []container.RefSelector

func MakeTargetMap

func MakeTargetMap(targets []TargetSpec) map[TargetID]TargetSpec

Map all the targets by their target ID.

func NewRelativeFileOrChildMatcher

func NewRelativeFileOrChildMatcher(baseDir string, paths ...string) fileOrChildMatcher

NewRelativeFileOrChildMatcher returns a matcher for the given paths (with any relative paths converted to absolute, relative to the given baseDir).

func TargetIDSet

func TargetIDSet(tids []TargetID) map[TargetID]bool

func UnrecognizedWebModeError

func UnrecognizedWebModeError(v string) error

func ValidTriggerMode added in v0.18.4

func ValidTriggerMode(tm TriggerMode) bool

func ValidateAPIServerName added in v0.19.5

func ValidateAPIServerName(name APIServerName) error

Makes sure the apiserver name is well-formed.

Types

type APIServerName added in v0.19.5

type APIServerName string

If there are multiple tilt apiservers running, we can refer to them by name.

func DefaultAPIServerName added in v0.19.5

func DefaultAPIServerName(port WebPort) APIServerName

Each apiserver has a name based on the web port.

func ProvideAPIServerName added in v0.19.5

func ProvideAPIServerName(port WebPort) APIServerName

Determines what the API server name should be based on the --port flag.

TODO(nick): Long-term, most tools in this space are moving away from making users manage ports, and using names to identify different instances.

type BuildDetails

type BuildDetails interface {
	// contains filtered or unexported methods
}

type BuildReason

type BuildReason int
const (
	BuildReasonFlagChangedFiles BuildReason = 1 << iota
	BuildReasonFlagConfig

	// NOTE(nick): In live-update-v1, if a container had live-updated changed,
	// then crashed, we would automatically replace it with a fresh image.
	// This approach was difficult to reason about and sometimes led to infinite loops.
	// Users complained that it was too aggressive about doing an image build.
	//
	// In live-update-v2, the reconciler keeps track of how to bring crashing
	// containers up to date. Instead, we only kick off fresh image builds
	// if there's a new file change / trigger but the container has been
	// marked unrecoverable. So this build reason is obsolete.
	BuildReasonFlagCrashDeprecated

	BuildReasonFlagInit

	BuildReasonFlagTriggerWeb
	BuildReasonFlagTriggerCLI
	BuildReasonFlagTriggerUnknown

	// An external process called `tilt args`
	BuildReasonFlagTiltfileArgs

	// Suppose you have
	// manifestA with imageA depending on imageCommon
	// manifestB with imageB depending on imageCommon
	//
	// Building manifestA will mark imageB
	// with changed dependencies.
	BuildReasonFlagChangedDeps
)

func (BuildReason) Has

func (r BuildReason) Has(flag BuildReason) bool

func (BuildReason) HasTrigger added in v0.14.0

func (r BuildReason) HasTrigger() bool

func (BuildReason) String added in v0.10.16

func (r BuildReason) String() string

func (BuildReason) With

func (r BuildReason) With(flag BuildReason) BuildReason

func (BuildReason) WithoutTriggers added in v0.25.1

func (r BuildReason) WithoutTriggers() BuildReason

type BuildRecord

type BuildRecord struct {
	Edits      []string
	Error      error
	StartTime  time.Time
	FinishTime time.Time // IsZero() == true for in-progress builds
	Reason     BuildReason

	BuildTypes []BuildType

	// The lookup key for the logs in the logstore.
	SpanID LogSpanID

	// We count the warnings by looking up all the logs with Level=WARNING
	// in the logstore. We store this number separately for ease of use.
	WarningCount int
}

func (BuildRecord) Duration

func (bs BuildRecord) Duration() time.Duration

func (BuildRecord) Empty

func (bs BuildRecord) Empty() bool

func (BuildRecord) HasBuildType added in v0.10.14

func (r BuildRecord) HasBuildType(bt BuildType) bool

type BuildType added in v0.10.14

type BuildType string
const BuildTypeDockerCompose BuildType = "docker-compose"
const BuildTypeImage BuildType = "image"
const BuildTypeK8s BuildType = "k8s"
const BuildTypeLiveUpdate BuildType = "live-update"
const BuildTypeLocal BuildType = "local"

type ByURL added in v0.17.7

type ByURL []Link

ByURL implements sort.Interface based on the URL field.

func (ByURL) Len added in v0.17.7

func (lns ByURL) Len() int

func (ByURL) Less added in v0.17.7

func (lns ByURL) Less(i, j int) bool

func (ByURL) Swap added in v0.17.7

func (lns ByURL) Swap(i, j int)

type Cmd

type Cmd struct {
	Argv []string
	Dir  string
	Env  []string
}

func ToBatCmd added in v0.14.0

func ToBatCmd(cmd string) Cmd

🦇🦇🦇 Named in honor of Bazel https://docs.bazel.build/versions/master/be/general.html#genrule.cmd_bat

func ToHostCmd added in v0.14.0

func ToHostCmd(cmd string) Cmd

Create a shell command for running on the Host OS

func ToHostCmdInDir added in v0.18.1

func ToHostCmdInDir(cmd string, dir string) Cmd

func ToHostCmdInDirWithEnv added in v0.18.5

func ToHostCmdInDirWithEnv(cmd string, dir string, env []string) Cmd

func ToUnixCmd added in v0.14.0

func ToUnixCmd(cmd string) Cmd

func ToUnixCmdInDir added in v0.18.1

func ToUnixCmdInDir(cmd string, dir string) Cmd

func ToUnixCmds added in v0.14.0

func ToUnixCmds(cmds []string) []Cmd

func TrySquash

func TrySquash(runs []Cmd) []Cmd

func (Cmd) Empty

func (c Cmd) Empty() bool

func (Cmd) EntrypointStr

func (c Cmd) EntrypointStr() string

func (Cmd) IsShellStandardForm

func (c Cmd) IsShellStandardForm() bool

func (Cmd) IsWindowsStandardForm added in v0.14.0

func (c Cmd) IsWindowsStandardForm() bool

func (Cmd) RunStr

func (c Cmd) RunStr() string

func (Cmd) ShellStandardScript

func (c Cmd) ShellStandardScript() string

Get the script when the shell is in standard form. Panics if the command is not in shell standard form.

func (Cmd) String

func (c Cmd) String() string

type CompositePathMatcher

type CompositePathMatcher struct {
	Matchers []PathMatcher
}

func (CompositePathMatcher) Matches

func (c CompositePathMatcher) Matches(f string) (bool, error)

func (CompositePathMatcher) MatchesEntireDir

func (c CompositePathMatcher) MatchesEntireDir(f string) (bool, error)

type CustomBuild

type CustomBuild struct {
	v1alpha1.CmdImageSpec

	// Deps is a list of file paths that are dependencies of this command.
	//
	// TODO(nick): This creates a FileWatch. We should add a RestartOn field
	// to CmdImageSpec that points to the FileWatch.
	Deps []string
}

func (CustomBuild) SkipsPush added in v0.10.22

func (cb CustomBuild) SkipsPush() bool

func (CustomBuild) WithTag

func (cb CustomBuild) WithTag(t string) CustomBuild

type DockerBuild

type DockerBuild struct {
	v1alpha1.DockerImageSpec
}

type DockerComposeBuild added in v0.23.2

type DockerComposeBuild struct {
	// Service is the name of the Docker Compose service as defined in docker-compose.yaml.
	Service string

	// Context is the build context absolute path.
	Context string
}

type DockerComposeTarget

type DockerComposeTarget struct {
	Spec v1alpha1.DockerComposeServiceSpec

	Name TargetName

	ServiceYAML string // for diff'ing when config files change

	Links []Link
	// contains filtered or unexported fields
}

func ExtractDockerComposeTargets

func ExtractDockerComposeTargets(specs []TargetSpec) []DockerComposeTarget

func (DockerComposeTarget) DependencyIDs

func (t DockerComposeTarget) DependencyIDs() []TargetID

func (DockerComposeTarget) Empty

func (t DockerComposeTarget) Empty() bool

func (DockerComposeTarget) ID

func (DockerComposeTarget) ManifestName

func (t DockerComposeTarget) ManifestName() ManifestName

TODO(nick): This is a temporary hack until we figure out how we want to pass these IDs to the docker-compose UX.

func (DockerComposeTarget) PublishedPorts

func (t DockerComposeTarget) PublishedPorts() []int

func (DockerComposeTarget) Validate

func (dc DockerComposeTarget) Validate() error

func (DockerComposeTarget) WithImageMapDeps added in v0.23.5

func (t DockerComposeTarget) WithImageMapDeps(names []string) DockerComposeTarget
func (t DockerComposeTarget) WithLinks(links []Link) DockerComposeTarget

func (DockerComposeTarget) WithPublishedPorts

func (t DockerComposeTarget) WithPublishedPorts(ports []int) DockerComposeTarget

type DockerPruneSettings added in v0.10.14

type DockerPruneSettings struct {
	Enabled    bool
	MaxAge     time.Duration // "prune Docker objects older than X"
	NumBuilds  int           // "prune every Y builds" (takes precedence over "prune every Z hours")
	Interval   time.Duration // "prune every Z hours"
	KeepRecent int           // Keep the most recent N builds of a tag.
}

func DefaultDockerPruneSettings added in v0.10.14

func DefaultDockerPruneSettings() DockerPruneSettings

type Dockerignore

type Dockerignore struct {
	// The path to evaluate the dockerignore contents relative to
	LocalPath string

	// A human-readable string that identifies where the ignores come from.
	Source string

	// Patterns parsed out of the .dockerignore file.
	Patterns []string
}

func (Dockerignore) Empty added in v0.17.6

func (d Dockerignore) Empty() bool

type ImageTarget

type ImageTarget struct {
	// An apiserver-driven data model for injecting the image into other resources.
	v1alpha1.ImageMapSpec

	// An apiserver-driven data model for live-updating containers.
	LiveUpdateName       string
	LiveUpdateSpec       v1alpha1.LiveUpdateSpec
	LiveUpdateReconciler bool

	// An apiserver-driven data model for using docker to build images.
	DockerImageName string
	CmdImageName    string

	BuildDetails BuildDetails

	// In a live-update-only image, we don't inject the image into the Kubernetes
	// deploy, we only live-update to the deployed object. See this issue:
	//
	// https://github.com/tilt-dev/tilt/issues/4577
	//
	// This is a hacky way to model this right now until we
	// firm up how images work in the apiserver.
	IsLiveUpdateOnly bool

	FileWatchIgnores []v1alpha1.IgnoreDef
}

func ExtractImageTargets

func ExtractImageTargets(specs []TargetSpec) []ImageTarget

func MustNewImageTarget added in v0.14.0

func MustNewImageTarget(ref container.RefSelector) ImageTarget

func (ImageTarget) ClusterNeeds added in v0.27.1

func (i ImageTarget) ClusterNeeds() v1alpha1.ClusterImageNeeds

func (ImageTarget) CustomBuildInfo

func (i ImageTarget) CustomBuildInfo() CustomBuild

func (ImageTarget) Dependencies

func (i ImageTarget) Dependencies() []string

TODO(nick): This method should be deleted. We should just de-dupe and sort LocalPaths once when we create it, rather than have a duplicate method that does the "right" thing.

func (ImageTarget) DependencyIDs

func (i ImageTarget) DependencyIDs() []TargetID

func (ImageTarget) DockerBuildInfo

func (i ImageTarget) DockerBuildInfo() DockerBuild

func (ImageTarget) DockerComposeBuildInfo added in v0.23.2

func (i ImageTarget) DockerComposeBuildInfo() DockerComposeBuild

func (ImageTarget) GetFileWatchIgnores added in v0.27.3

func (i ImageTarget) GetFileWatchIgnores() []v1alpha1.IgnoreDef

func (ImageTarget) ID

func (i ImageTarget) ID() TargetID

func (ImageTarget) ImageMapDeps added in v0.23.5

func (i ImageTarget) ImageMapDeps() []string

func (ImageTarget) ImageMapName added in v0.22.14

func (i ImageTarget) ImageMapName() string

func (ImageTarget) IsCustomBuild

func (i ImageTarget) IsCustomBuild() bool

func (ImageTarget) IsDockerBuild

func (i ImageTarget) IsDockerBuild() bool

func (ImageTarget) IsDockerComposeBuild added in v0.23.2

func (i ImageTarget) IsDockerComposeBuild() bool

func (ImageTarget) LocalPaths

func (i ImageTarget) LocalPaths() []string

func (ImageTarget) MustWithRef added in v0.20.8

func (i ImageTarget) MustWithRef(ref container.RefSelector) ImageTarget

func (ImageTarget) Refs added in v0.14.0

func (i ImageTarget) Refs(cluster *v1alpha1.Cluster) (container.RefSet, error)

func (ImageTarget) Validate

func (i ImageTarget) Validate() error

func (ImageTarget) WithBuildDetails

func (i ImageTarget) WithBuildDetails(details BuildDetails) ImageTarget

func (ImageTarget) WithDockerImage added in v0.23.0

func (i ImageTarget) WithDockerImage(spec v1alpha1.DockerImageSpec) ImageTarget

func (ImageTarget) WithFileWatchIgnores added in v0.27.3

func (i ImageTarget) WithFileWatchIgnores(ignores []v1alpha1.IgnoreDef) ImageTarget

func (ImageTarget) WithIgnores added in v0.27.3

func (i ImageTarget) WithIgnores(ignores []v1alpha1.IgnoreDef) ImageTarget

Modified both FileWatchIgnores and ContextIgnores. Useful in tests where they're the same.

func (ImageTarget) WithImageMapDeps added in v0.23.5

func (i ImageTarget) WithImageMapDeps(names []string) ImageTarget

func (ImageTarget) WithLiveUpdateSpec added in v0.22.11

func (i ImageTarget) WithLiveUpdateSpec(name string, luSpec v1alpha1.LiveUpdateSpec) ImageTarget

func (ImageTarget) WithOverrideCommand

func (i ImageTarget) WithOverrideCommand(cmd Cmd) ImageTarget

type K8sTarget

type K8sTarget struct {
	// An apiserver-driven data model for applying Kubernetes YAML.
	//
	// This will eventually replace K8sTarget. We represent this as an embedded
	// struct while we're migrating fields.
	v1alpha1.KubernetesApplySpec

	Name TargetName

	PodReadinessMode PodReadinessMode

	// zero+ links assoc'd with this resource (to be displayed in UIs,
	// in addition to any port forwards/LB endpoints)
	Links []Link

	FileWatchIgnores []v1alpha1.IgnoreDef
	// contains filtered or unexported fields
}

func ExtractK8sTargets

func ExtractK8sTargets(specs []TargetSpec) []K8sTarget

func NewK8sTargetForTesting added in v0.20.8

func NewK8sTargetForTesting(yaml string) K8sTarget

func (K8sTarget) Dependencies added in v0.23.0

func (k8s K8sTarget) Dependencies() []string

Dependencies are files required by this target.

Part of the WatchableTarget interface.

func (K8sTarget) DependencyIDs

func (k8s K8sTarget) DependencyIDs() []TargetID

func (K8sTarget) Empty

func (k8s K8sTarget) Empty() bool

func (K8sTarget) GetFileWatchIgnores added in v0.27.3

func (k8s K8sTarget) GetFileWatchIgnores() []v1alpha1.IgnoreDef

func (K8sTarget) ID

func (k8s K8sTarget) ID() TargetID

func (K8sTarget) RefInjectCounts

func (k8s K8sTarget) RefInjectCounts() map[string]int

func (K8sTarget) Validate

func (k8s K8sTarget) Validate() error

func (K8sTarget) WithIgnores added in v0.27.3

func (k8s K8sTarget) WithIgnores(ignores []v1alpha1.IgnoreDef) K8sTarget

func (K8sTarget) WithImageDependencies added in v0.23.0

func (k8s K8sTarget) WithImageDependencies(imageMapDeps []string) K8sTarget

Track which images this depends on.

func (K8sTarget) WithPathDependencies added in v0.23.0

func (k8s K8sTarget) WithPathDependencies(paths []string) K8sTarget

WithPathDependencies registers paths that this K8sTarget depends on.

func (K8sTarget) WithRefInjectCounts

func (k8s K8sTarget) WithRefInjectCounts(ric map[string]int) K8sTarget

type LabelPair

type LabelPair struct {
	Key   string
	Value string
}

func ToLabelPairs

func ToLabelPairs(m map[string]string) []LabelPair
type Link struct {
	URL *url.URL

	// Optional name of the link; if given, used as text of the URL
	// displayed in the web UI (e.g. <a href="localhost:8888">Debugger</a>)
	Name string
}

A link associated with resource; may represent a port forward, an endpoint derived from a Service/Ingress/etc., or a URL manually associated with a resource via the Tiltfile

func MustNewLink(urlStr string, name string) Link
func NewLink(urlStr string, name string) (Link, error)
func PortForwardToLink(pf v1alpha1.Forward) Link

func (Link) URLString added in v0.17.8

func (li Link) URLString() string

type LocalTarget added in v0.10.8

type LocalTarget struct {
	UpdateCmdSpec *v1alpha1.CmdSpec

	Name     TargetName
	ServeCmd Cmd      // e.g. `python main.py`
	Links    []Link   // zero+ links assoc'd with this resource (to be displayed in UIs)
	Deps     []string // a list of ABSOLUTE file paths that are dependencies of this target

	FileWatchIgnores []v1alpha1.IgnoreDef

	// Indicates that we should allow this to run in parallel with other
	// resources  (by default, this is presumed unsafe and is not allowed).
	AllowParallel bool

	ReadinessProbe *v1alpha1.Probe

	// Move this to CmdServerSpec when we move CmdServer to API
	ServeCmdDisableSource *v1alpha1.DisableSource
}

func NewLocalTarget added in v0.10.8

func NewLocalTarget(name TargetName, updateCmd Cmd, serveCmd Cmd, deps []string) LocalTarget

func (LocalTarget) Dependencies added in v0.10.8

func (lt LocalTarget) Dependencies() []string

Implements: engine.WatchableManifest

func (LocalTarget) DependencyIDs added in v0.10.8

func (lt LocalTarget) DependencyIDs() []TargetID

func (LocalTarget) Empty added in v0.10.9

func (lt LocalTarget) Empty() bool

func (LocalTarget) GetFileWatchIgnores added in v0.27.3

func (lt LocalTarget) GetFileWatchIgnores() []v1alpha1.IgnoreDef

func (LocalTarget) ID added in v0.10.8

func (lt LocalTarget) ID() TargetID

func (LocalTarget) UpdateCmdName added in v0.21.1

func (lt LocalTarget) UpdateCmdName() string

func (LocalTarget) Validate added in v0.10.8

func (lt LocalTarget) Validate() error

func (LocalTarget) WithAllowParallel added in v0.17.2

func (lt LocalTarget) WithAllowParallel(val bool) LocalTarget

func (LocalTarget) WithIgnores added in v0.10.16

func (lt LocalTarget) WithIgnores(ignores []v1alpha1.IgnoreDef) LocalTarget
func (lt LocalTarget) WithLinks(links []Link) LocalTarget

func (LocalTarget) WithReadinessProbe added in v0.18.6

func (lt LocalTarget) WithReadinessProbe(probeSpec *v1alpha1.Probe) LocalTarget

type LogSpanID added in v0.10.25

type LogSpanID string

type Manifest

type Manifest struct {
	// Properties for all manifests.
	Name ManifestName

	// Info needed to build an image. (This struct contains details of DockerBuild, CustomBuild... etc.)
	ImageTargets []ImageTarget

	// Info needed to deploy. Can be k8s yaml, docker compose, etc.
	DeployTarget TargetSpec

	// How updates are triggered:
	// - automatically, when we detect a change
	// - manually, only when the user tells us to
	TriggerMode TriggerMode

	// The resource in this manifest will not be built until all of its dependencies have been
	// ready at least once.
	ResourceDependencies []ManifestName

	SourceTiltfile ManifestName

	Labels map[string]string
}

NOTE: If you modify Manifest, make sure to modify `equalForBuildInvalidation` appropriately

func (*Manifest) ClusterName added in v0.27.2

func (m *Manifest) ClusterName() string

func (Manifest) DependencyIDs

func (m Manifest) DependencyIDs() []TargetID

func (Manifest) DockerComposeTarget

func (m Manifest) DockerComposeTarget() DockerComposeTarget

func (Manifest) ID

func (m Manifest) ID() TargetID

func (Manifest) ImageTargetAt

func (m Manifest) ImageTargetAt(i int) ImageTarget

func (Manifest) ImageTargetWithID added in v0.17.5

func (m Manifest) ImageTargetWithID(id TargetID) ImageTarget

func (*Manifest) InferImageProperties added in v0.27.2

func (m *Manifest) InferImageProperties() error

Infer image properties for each image.

func (*Manifest) InferLiveUpdateSelectors added in v0.22.14

func (m *Manifest) InferLiveUpdateSelectors() error

Assemble selectors that point to other API objects created by this manifest.

func (Manifest) IsDC

func (m Manifest) IsDC() bool

func (Manifest) IsImageDeployed

func (m Manifest) IsImageDeployed(iTarget ImageTarget) bool

func (Manifest) IsK8s

func (m Manifest) IsK8s() bool

func (Manifest) IsLocal added in v0.10.8

func (m Manifest) IsLocal() bool

func (Manifest) K8sTarget

func (m Manifest) K8sTarget() K8sTarget

func (Manifest) LocalPaths

func (m Manifest) LocalPaths() []string

func (Manifest) LocalTarget added in v0.10.8

func (m Manifest) LocalTarget() LocalTarget

func (Manifest) ManifestName

func (m Manifest) ManifestName() ManifestName

func (Manifest) PodReadinessMode added in v0.17.0

func (m Manifest) PodReadinessMode() PodReadinessMode

func (Manifest) ReverseDependencyIDs added in v0.16.0

func (m Manifest) ReverseDependencyIDs() map[TargetID][]TargetID

A map from each target id to the target IDs that depend on it.

func (Manifest) TargetIDSet added in v0.15.0

func (m Manifest) TargetIDSet() map[TargetID]bool

func (Manifest) TargetSpecs

func (m Manifest) TargetSpecs() []TargetSpec

func (Manifest) Validate

func (m Manifest) Validate() error

func (Manifest) WithDeployTarget

func (m Manifest) WithDeployTarget(t TargetSpec) Manifest

func (Manifest) WithDisableSource added in v0.23.0

func (m Manifest) WithDisableSource(disableSource *v1alpha1.DisableSource) Manifest

Set DisableSource for any pieces of the manifest that are disable-able but not yet in the API

func (Manifest) WithImageTarget

func (m Manifest) WithImageTarget(iTarget ImageTarget) Manifest

func (Manifest) WithImageTargets

func (m Manifest) WithImageTargets(iTargets []ImageTarget) Manifest

func (Manifest) WithLabels added in v0.22.1

func (m Manifest) WithLabels(labels map[string]string) Manifest

func (Manifest) WithTriggerMode

func (m Manifest) WithTriggerMode(mode TriggerMode) Manifest

type ManifestName

type ManifestName string

TODO(nick): We should probably get rid of ManifestName completely and just use TargetName everywhere.

func ManifestNames added in v0.18.4

func ManifestNames(names []string) []ManifestName

func (ManifestName) String

func (m ManifestName) String() string

func (ManifestName) TargetID added in v0.22.15

func (m ManifestName) TargetID() TargetID

func (ManifestName) TargetName

func (m ManifestName) TargetName() TargetName

type ManifestNameSet added in v0.17.1

type ManifestNameSet map[ManifestName]bool

type Orchestrator

type Orchestrator string

The current orchestrator we're running with (K8s or DockerCompose)

type PathMatcher

type PathMatcher interface {
	Matches(f string) (bool, error)

	// If this matches the entire dir, we can often optimize filetree walks a bit
	MatchesEntireDir(file string) (bool, error)
}
var EmptyMatcher PathMatcher = emptyMatcher{}

func NewCompositeMatcher

func NewCompositeMatcher(matchers []PathMatcher) PathMatcher

type PathSet

type PathSet struct {
	Paths         []string
	BaseDirectory string
}

A PathSet stores one or more filepaths, along with the directory that any relative paths are relative to NOTE(maia): in its current usage (for LiveUpdate.Run.Triggers, LiveUpdate.FallBackOnFiles()) this isn't strictly necessary, could just as easily convert paths to Abs when specified in the Tiltfile--but leaving this code in place for now because it was already written and may help with complicated future cases (glob support, etc.)

func NewPathSet

func NewPathSet(paths []string, baseDir string) PathSet

func (PathSet) AnyMatch

func (ps PathSet) AnyMatch(paths []string) (bool, string, error)

AnyMatch returns true if any of the given filepaths match any paths contained in the pathset (along with the first path that matched).

func (PathSet) Empty

func (ps PathSet) Empty() bool

func (PathSet) Intersection added in v0.22.14

func (ps PathSet) Intersection(paths []string) ([]string, error)

Intersection returns the set of paths that are in both the PathSet and the passed set of paths.

type PodReadinessMode added in v0.17.0

type PodReadinessMode string

Specifies how a Pod's state factors into determining whether a resource is ready

const PodReadinessIgnore PodReadinessMode = "ignore"

Don't even wait for pods to appear.

const PodReadinessNone PodReadinessMode = ""

Pod readiness isn't applicable to this resource

const PodReadinessSucceeded PodReadinessMode = "succeeded"

wait until the pod has completed successfully

const PodReadinessWait PodReadinessMode = "wait"

Always wait for pods to become ready.

type PortForward

type PortForward struct {
	// The port to connect to inside the deployed container.
	// If 0, we will connect to the first containerPort.
	ContainerPort int

	// The port to expose on the current machine.
	LocalPort int

	// Optional host to bind to on the current machine (localhost by default)
	Host string

	// Optional name of the port forward; if given, used as text of the URL
	// displayed in the web UI (e.g. <a href="localhost:8888">Debugger</a>)
	Name string
	// contains filtered or unexported fields
}

func MustPortForward added in v0.17.9

func MustPortForward(local int, container int, host string, name string, path string) PortForward

func (PortForward) PathForAppend added in v0.17.9

func (pf PortForward) PathForAppend() string

func (PortForward) WithPath added in v0.17.9

func (pf PortForward) WithPath(p *url.URL) PortForward

type Run

type Run struct {
	// Required. The command to run.
	Cmd Cmd
	// Optional. If not specified, this command runs on every change.
	// If specified, we only run the Cmd if the changed file matches a trigger.
	Triggers PathSet
}

Self-contained spec for running in a container.

Unlike v1alpha1.LiveUpdateExec, all fields of this object must be absolute paths.

func ToRun

func ToRun(cmd Cmd) Run

func ToRuns

func ToRuns(cmds []Cmd) []Run

func (Run) WithTriggers

func (r Run) WithTriggers(paths []string, baseDir string) Run

type Secret added in v0.10.10

type Secret struct {
	// The name of the secret in the kubernetes cluster, so the user
	// can look it up themselves.
	Name string

	Key string

	Value []byte

	ValueEncoded []byte

	Replacement []byte
}

func (Secret) Scrub added in v0.10.10

func (s Secret) Scrub(text []byte) []byte

type SecretSet added in v0.10.10

type SecretSet map[string]Secret

Secrets are different than other kinds of build/deploy outputs.

Once something is marked as a secret, we want to scrub it from all logs until the user quits Tilt. Removing the secret from the Kubernetes cluster doesn't suddenly "reveal" the secret.

func (SecretSet) AddAll added in v0.10.10

func (s SecretSet) AddAll(other SecretSet)

func (SecretSet) AddSecret added in v0.10.10

func (s SecretSet) AddSecret(name string, key string, value []byte)

func (SecretSet) Scrub added in v0.10.10

func (s SecretSet) Scrub(text []byte) []byte

type SecretSettings added in v0.14.0

type SecretSettings struct {
	ScrubSecrets bool // whether to scrub secrets in logs
}

func DefaultSecretSettings added in v0.14.0

func DefaultSecretSettings() SecretSettings

type Sync

type Sync struct {
	LocalPath     string
	ContainerPath string
}

Self-contained spec for syncing files from local to a container.

Unlike v1alpha1.LiveUpdateSync, all fields of this object must be absolute paths.

type Target

type Target interface {
	Spec() TargetSpec
	Status() TargetStatus
}

type TargetGraph

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

func NewTargetGraph

func NewTargetGraph(targets []TargetSpec) (TargetGraph, error)

func (TargetGraph) DeployedImages

func (g TargetGraph) DeployedImages() []ImageTarget

Returns all the images in the graph that are directly deployed to a container.

func (TargetGraph) DepsOf

func (g TargetGraph) DepsOf(t TargetSpec) ([]TargetSpec, error)

Return the direct dependency targets.

func (TargetGraph) Images

func (g TargetGraph) Images() []ImageTarget

func (TargetGraph) IsDeployedImage

func (g TargetGraph) IsDeployedImage(iTarget ImageTarget) bool

Is this image directly deployed a container?

func (TargetGraph) IsSingleSourceDAG

func (g TargetGraph) IsSingleSourceDAG() bool

In Tilt, Manifests should always be DAGs with a single root node (the deploy target). This is just a quick sanity check to make sure that's true, because many of our graph-traversal algorithms won't work if it's not true.

func (TargetGraph) VisitTree

func (g TargetGraph) VisitTree(root TargetSpec, visit func(dep TargetSpec) error) error

Visit t and its transitive dependencies in post-order (aka depth-first)

type TargetID

type TargetID struct {
	Type TargetType
	Name TargetName
}

func DedupeTargetIDs

func DedupeTargetIDs(ids []TargetID) []TargetID

De-duplicate target ids, maintaining the same order.

func ImageID

func ImageID(ref container.RefSelector) TargetID

func (TargetID) Empty

func (id TargetID) Empty() bool

func (TargetID) String

func (id TargetID) String() string

type TargetName

type TargetName string

func (TargetName) String

func (n TargetName) String() string

type TargetSpec

type TargetSpec interface {
	ID() TargetID

	// Check to make sure the spec is well-formed.
	// All TargetSpecs should throw an error in the case where the ID is empty.
	Validate() error

	DependencyIDs() []TargetID
}

func TopologicalSort

func TopologicalSort(targets []TargetSpec) ([]TargetSpec, error)

Create a topologically sorted list of targets. Returns an error if the targets can't be topologically sorted. (e.g., there's a cycle).

type TargetStatus

type TargetStatus interface {
	TargetID() TargetID
	LastBuild() BuildRecord
}

type TargetType

type TargetType string
const (
	// Deployed k8s entities
	TargetTypeK8s TargetType = "k8s"

	// Image builds
	TargetTypeImage TargetType = "image"

	// Docker-compose service build and deploy
	// TODO(nick): Currently, build and deploy are represented as a single target.
	// In the future, we might have a separate build target and deploy target.
	TargetTypeDockerCompose TargetType = "docker-compose"

	// Runs a local command when triggered (manually or via changed dep)
	TargetTypeLocal TargetType = "local"

	// Aggregation of multiple targets into one UI view.
	// TODO(nick): Currently used as the type for both Manifest and YAMLManifest, though
	// we expect YAMLManifest to go away.
	TargetTypeManifest TargetType = "manifest"

	// Changes that affect all targets, rebuilding the target graph.
	TargetTypeConfigs TargetType = "configs"
)

type TelemetrySettings added in v0.10.25

type TelemetrySettings struct {
	Cmd     Cmd
	Workdir string // directory from which this Cmd should be run

	// How often to send the trace data.
	Period time.Duration
}

type TelemetryStatus added in v0.10.25

type TelemetryStatus struct {
	LastRunAt             time.Time
	ControllerActionCount int
}

type TiltBuild

type TiltBuild struct {
	// Version w/o leading "v"
	Version   string
	CommitSHA string
	Date      string
	Dev       bool
}

Information on a build of the Tilt binary

func (TiltBuild) AnalyticsVersion

func (b TiltBuild) AnalyticsVersion() string

func (TiltBuild) Empty

func (b TiltBuild) Empty() bool

func (TiltBuild) HumanBuildStamp added in v0.15.0

func (b TiltBuild) HumanBuildStamp() string

func (TiltBuild) WebVersion

func (b TiltBuild) WebVersion() WebVersion

type TiltSubcommand added in v0.16.0

type TiltSubcommand string

e.g., "up", "down", "ci"

func (TiltSubcommand) String added in v0.16.0

func (t TiltSubcommand) String() string

type TriggerMode

type TriggerMode int
const (
	// Tilt automatically performs all builds (initial and non-initial) without manual intervention
	TriggerModeAuto TriggerMode = iota
	// Tilt automatically performs initial builds without manual intervention, but requires manual intervention for non-initial builds
	TriggerModeManualWithAutoInit TriggerMode = iota
	// Tilt requires manual intervention for all builds, and never automatically performs a build
	TriggerModeManual TriggerMode = iota
	// Resource does not automatically build on `tilt up`, but builds automatically in response to file changes
	TriggerModeAutoWithManualInit TriggerMode = iota
)

Currently TriggerMode models two orthogonal attributes in one enum:

  1. Whether a file change should update the resource immediately (auto vs manual mode)
  1. Whether a resource should start when the env starts (auto_init=true vs auto_init=false mode, sometimes called AutoInit vs ManualInit mode)

In the APIServer, we don't model these as attributes of a resource. Rather, the resource specifies where these attribute comes from, with the ability to define different sources.

Update triggers are modeled as StartOn/RestartOn, so resources can be configured with different types of update triggers.

Start/stop status of resources are modeled as DisableOn, so that individual objects can be independently started/stopped.

We expect TriggerMode to go away in the API in favor of better visualization of why updates have been triggered and why resources are stopped.

func (TriggerMode) AutoInitial added in v0.10.18

func (t TriggerMode) AutoInitial() bool

func (TriggerMode) AutoOnChange added in v0.10.18

func (t TriggerMode) AutoOnChange() bool

type UpdateSettings added in v0.14.0

type UpdateSettings struct {

	// A list of images to suppress the warning for.
	SuppressUnusedImageWarnings []string
	// contains filtered or unexported fields
}

func DefaultUpdateSettings added in v0.14.0

func DefaultUpdateSettings() UpdateSettings

func (UpdateSettings) K8sUpsertTimeout added in v0.14.0

func (us UpdateSettings) K8sUpsertTimeout() time.Duration

func (UpdateSettings) MaxParallelUpdates added in v0.14.0

func (us UpdateSettings) MaxParallelUpdates() int

func (UpdateSettings) WithK8sUpsertTimeout added in v0.14.0

func (us UpdateSettings) WithK8sUpsertTimeout(timeout time.Duration) UpdateSettings

func (UpdateSettings) WithMaxParallelUpdates added in v0.14.0

func (us UpdateSettings) WithMaxParallelUpdates(n int) UpdateSettings

type UserConfigState added in v0.10.24

type UserConfigState struct {
	ArgsChangeTime time.Time
	Args           []string
}

func NewUserConfigState added in v0.10.24

func NewUserConfigState(args []string) UserConfigState

func (UserConfigState) WithArgs added in v0.10.25

func (ucs UserConfigState) WithArgs(args []string) UserConfigState

type VersionSettings added in v0.10.19

type VersionSettings struct {
	CheckUpdates bool
}

type WatchSettings added in v0.17.6

type WatchSettings struct {
	Ignores []Dockerignore
}

func (WatchSettings) Empty added in v0.17.6

func (ws WatchSettings) Empty() bool

type WebDevPort

type WebDevPort int

type WebHost added in v0.10.18

type WebHost string

type WebMode

type WebMode string
const (
	// By default, we serve the js locally in dev builds and from prod in released
	// builds.
	DefaultWebMode WebMode = "default"

	// Local webpack server
	LocalWebMode WebMode = "local"

	// Generic prod build; uses embedded if available otherwise cloud
	ProdWebMode WebMode = "prod"

	// Production build embedded assets
	EmbeddedWebMode WebMode = "embedded"

	// Production build assets from cloud bucket
	CloudWebMode WebMode = "cloud"

	// Precompiled with `make build-js`. This is an experimental mode
	// we're playing around with to avoid the cost of webpack startup.
	PrecompiledWebMode WebMode = "precompiled"
)

func (WebMode) IsProd added in v0.26.3

func (m WebMode) IsProd() bool

func (*WebMode) Set

func (m *WebMode) Set(v string) error

func (*WebMode) String

func (m *WebMode) String() string

func (*WebMode) Type

func (m *WebMode) Type() string

type WebPort

type WebPort int

type WebSHA added in v0.10.14

type WebSHA string

Web version of the form aaaaaaa where a is a hex letter Used for fetching web assets

type WebURL

type WebURL url.URL

func (WebURL) Empty

func (u WebURL) Empty() bool

func (WebURL) String

func (u WebURL) String() string

type WebVersion

type WebVersion string

Web version of the form vA.B.C, where A, B, and C are integers Used for fetching web assets

Directories

Path Synopsis
A central logstore.
A central logstore.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL