server

package
v0.22.10 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const TiltTokenCookieName = "Tilt-Token"

Variables

Functions

func ProvideConfigAccess added in v0.19.5

func ProvideConfigAccess(dir *dirs.TiltDevDir) clientcmd.ConfigAccess

Uses the kubernetes config-loading library to load api configs from disk.

Usually loads from ~/.windmill/config or ~/tilt-dev/config.

Also allows overriding with the TILT_CONFIG env variable, like TILT_CONFIG=./path/to/my/config which is useful when testing CLIs.

func ProvideKeyCert added in v0.19.5

func ProvideKeyCert() options.GeneratableKeyCert

func ProvideMemConn added in v0.18.11

func ProvideMemConn() apiserver.ConnProvider

func SendToTriggerQueue added in v0.10.16

func SendToTriggerQueue(st store.RStore, name string, buildReason model.BuildReason) error

func StreamLogs added in v0.17.0

func StreamLogs(ctx context.Context, follow bool, url model.WebURL, resources []string, printer *hud.IncrementalPrinter) error

Types

type APIServerConfig added in v0.18.11

type APIServerConfig = apiserver.Config

func ProvideTiltServerOptions added in v0.18.10

func ProvideTiltServerOptions(
	ctx context.Context,
	tiltBuild model.TiltBuild,
	memconn apiserver.ConnProvider,
	token BearerToken,
	certKey options.GeneratableKeyCert,
	apiPort APIServerPort) (*APIServerConfig, error)

Configures the Tilt API server.

func ProvideTiltServerOptionsForHeadless added in v0.22.8

func ProvideTiltServerOptionsForHeadless(ctx context.Context, base xdg.Base, memconn apiserver.ConnProvider, version model.TiltBuild) (*APIServerConfig, error)

Generate the server config, removing options that are not needed for headless mode (where we don't open up any webserver or apiserver).

func ProvideTiltServerOptionsForTesting added in v0.20.8

func ProvideTiltServerOptionsForTesting(ctx context.Context) (*APIServerConfig, error)

Generate the server config, removing options that are not needed for testing.

1) Changes http -> https 2) Skips OpenAPI installation

type APIServerPort added in v0.19.5

type APIServerPort int

func ProvideAPIServerPort added in v0.19.5

func ProvideAPIServerPort() (APIServerPort, error)

Picks a random port for the APIServer.

TODO(nick): In the future, we should be able to have the apiserver listen on other network interfaces, not just loopback. But then we would have to also setup the KeyCert to identify the server.

type AppendToTriggerQueueAction added in v0.8.10

type AppendToTriggerQueueAction struct {
	Name   model.ManifestName
	Reason model.BuildReason
}

func (AppendToTriggerQueueAction) Action added in v0.8.10

func (AppendToTriggerQueueAction) Action()

type BearerToken added in v0.19.5

type BearerToken string

func NewBearerToken added in v0.19.5

func NewBearerToken() (BearerToken, error)

Generate a new bearer token for authenticating against the apiserver. Uses 64 bits of entropy and generates a url-safe token.

type DynamicInterface added in v0.18.11

type DynamicInterface = dynamic.Interface

func ProvideTiltDynamic added in v0.18.11

func ProvideTiltDynamic(config *APIServerConfig) (DynamicInterface, error)

Provide a dynamic API client for the Tilt server.

type HeadsUpServer

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

func ProvideHeadsUpServer

func ProvideHeadsUpServer(
	ctx context.Context,
	store *store.Store,
	assetServer assets.Server,
	analytics *tiltanalytics.TiltAnalytics,
	uploader cloud.SnapshotUploader,
	wsList *WebsocketList,
	ctrlClient ctrlclient.Client) (*HeadsUpServer, error)

func (*HeadsUpServer) DumpEngineJSON added in v0.10.18

func (s *HeadsUpServer) DumpEngineJSON(w http.ResponseWriter, req *http.Request)

Dump the JSON engine over http. Only intended for 'tilt dump engine'.

func (*HeadsUpServer) HandleAnalytics added in v0.7.12

func (s *HeadsUpServer) HandleAnalytics(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) HandleAnalyticsOpt added in v0.8.4

func (s *HeadsUpServer) HandleAnalyticsOpt(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) HandleNewSnapshot added in v0.10.4

func (s *HeadsUpServer) HandleNewSnapshot(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) HandleOverrideTriggerMode added in v0.18.4

func (s *HeadsUpServer) HandleOverrideTriggerMode(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) HandleSetTiltfileArgs added in v0.10.25

func (s *HeadsUpServer) HandleSetTiltfileArgs(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) HandleTrigger added in v0.8.10

func (s *HeadsUpServer) HandleTrigger(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) Router

func (s *HeadsUpServer) Router() http.Handler

func (*HeadsUpServer) SnapshotJSON added in v0.10.5

func (s *HeadsUpServer) SnapshotJSON(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) ViewJSON

func (s *HeadsUpServer) ViewJSON(w http.ResponseWriter, req *http.Request)

func (*HeadsUpServer) ViewWebsocket

func (s *HeadsUpServer) ViewWebsocket(w http.ResponseWriter, req *http.Request)

type HeadsUpServerController added in v0.7.11

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

func ProvideHeadsUpServerController added in v0.7.11

func ProvideHeadsUpServerController(
	configAccess clientcmd.ConfigAccess,
	apiServerName model.APIServerName,
	webListener WebListener,
	apiServerConfig *APIServerConfig,
	hudServer *HeadsUpServer,
	assetServer assets.Server,
	webURL model.WebURL) *HeadsUpServerController

func (*HeadsUpServerController) OnChange added in v0.7.11

func (*HeadsUpServerController) SetUp added in v0.18.11

Merge the APIServer and the Tilt Web server into a single handler, and attach them both to the public listener.

func (*HeadsUpServerController) TearDown added in v0.8.2

func (s *HeadsUpServerController) TearDown(ctx context.Context)

type LogStreamer added in v0.17.0

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

func NewLogStreamer added in v0.17.0

func NewLogStreamer(resources []string, p *hud.IncrementalPrinter) *LogStreamer

func (*LogStreamer) Handle added in v0.17.0

func (ls *LogStreamer) Handle(v proto_webview.View) error

type OverrideTriggerModeAction added in v0.18.4

type OverrideTriggerModeAction struct {
	ManifestNames []model.ManifestName
	TriggerMode   model.TriggerMode
}

TODO: a way to clear an override

func (OverrideTriggerModeAction) Action added in v0.18.4

func (OverrideTriggerModeAction) Action()

type ViewHandler added in v0.17.0

type ViewHandler interface {
	Handle(v proto_webview.View) error
}

type WebListener added in v0.19.5

type WebListener net.Listener

func ProvideWebListener added in v0.19.5

func ProvideWebListener(host model.WebHost, port model.WebPort) (WebListener, error)

Creates a listener for the plain http web server.

type WebsocketConn added in v0.8.2

type WebsocketConn interface {
	NextReader() (int, io.Reader, error)
	Close() error
	NextWriter(messageType int) (io.WriteCloser, error)
}

type WebsocketList added in v0.20.5

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

func NewWebsocketList added in v0.20.5

func NewWebsocketList() *WebsocketList

func (*WebsocketList) Add added in v0.20.5

func (*WebsocketList) ForEach added in v0.20.5

func (l *WebsocketList) ForEach(f func(w *WebsocketSubscriber))

Operate on all websockets in the list.

While the ForEach is running, the list may not be modified.

In the future, it might make sense allow modification of the list while the foreach runs, but then we'd need additional synchronization to make sure we don't get websocket send() after removal.

func (*WebsocketList) Remove added in v0.20.5

func (l *WebsocketList) Remove(w *WebsocketSubscriber)

type WebsocketReader added in v0.17.0

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

func (*WebsocketReader) Listen added in v0.17.0

func (wsr *WebsocketReader) Listen(ctx context.Context) error

type WebsocketSubscriber

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

func NewWebsocketSubscriber

func NewWebsocketSubscriber(ctx context.Context, ctrlClient ctrlclient.Client, st store.RStore, conn WebsocketConn) *WebsocketSubscriber

func (*WebsocketSubscriber) OnChange

func (ws *WebsocketSubscriber) OnChange(ctx context.Context, s store.RStore, summary store.ChangeSummary) error

func (*WebsocketSubscriber) SendUIButtonUpdate added in v0.20.8

func (ws *WebsocketSubscriber) SendUIButtonUpdate(ctx context.Context, nn types.NamespacedName, uiButton *v1alpha1.UIButton)

Sends a UIButton update on the websocket.

func (*WebsocketSubscriber) SendUIResourceUpdate added in v0.20.5

func (ws *WebsocketSubscriber) SendUIResourceUpdate(ctx context.Context, nn types.NamespacedName, uiResource *v1alpha1.UIResource)

Sends a UIResource update on the websocket.

func (*WebsocketSubscriber) SendUISessionUpdate added in v0.20.5

func (ws *WebsocketSubscriber) SendUISessionUpdate(ctx context.Context, uiSession *v1alpha1.UISession)

Sends a UISession update on the websocket.

func (*WebsocketSubscriber) Stream

func (ws *WebsocketSubscriber) Stream(ctx context.Context)

Should be called exactly once. Consumes messages until the socket closes.

func (*WebsocketSubscriber) TearDown added in v0.8.2

func (ws *WebsocketSubscriber) TearDown(ctx context.Context)

Jump to

Keyboard shortcuts

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