browser

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: GPL-3.0 Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package browser implements the interactive Darkube browser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunBrowser

func RunBrowser(ctx context.Context, options Options) error

RunBrowser opens the app browser using the caller's scoped clients.

func RunMockBrowser

func RunMockBrowser(ctx context.Context, profile MockProfile, version string, allowSecrets bool) error

RunMockBrowser opens a browser backed only by the supplied local fixture.

Types

type AppUsage

type AppUsage struct {
	CPUCores  *float64
	RAMBytes  *float64
	DiskBytes *float64
	Failed    UsageMetricFailures
}

AppUsage is an optional latest resource snapshot, in CPU cores and bytes.

type DomainConfig

type DomainConfig struct {
	Hosts                  []string
	Subdomain              string
	BaseDomain             string
	CNAME                  string
	Challenge              string
	SSL                    bool
	RedirectHTTPS          bool
	HTTP2                  bool
	DNS                    map[string]bool
	Certificates           map[string]string
	ChallengeRecords       map[string]string
	ChallengeRecordsFailed bool
}

DomainConfig is the verified app ingress configuration editable in the TUI.

type MockAppData

type MockAppData struct {
	PlainEnvs   []client.EnvVar
	SecretNames []string
	Pods        []appstate.Pod
	Logs        []MockLog
	Usage       *AppUsage
	History     UsageHistory
}

MockAppData contains offline application fixture data.

type MockLog

type MockLog struct {
	Entry     client.LogEntry
	Pod       string
	Container string
	Previous  bool
}

MockLog is one log entry in an offline mock profile.

type MockProfile

type MockProfile struct {
	Tenant     string
	Apps       []client.App
	Alerts     []client.Alert
	Namespaces []client.Namespace
	Tenants    []MockTenant
	AppData    map[string]MockAppData
	Registries []MockRegistry
	Databases  []client.Database
	Storages   []client.Storage
}

MockProfile contains the local-only fields rendered by the fixture browser.

func LoadMockProfile

func LoadMockProfile(path string) (MockProfile, error)

LoadMockProfile reads a bounded, versioned YAML fixture. Unknown fields fail parsing so secrets and unsupported data cannot silently enter the UI model.

func ParseMockProfile

func ParseMockProfile(data []byte) (MockProfile, error)

ParseMockProfile decodes one strict YAML document without exposing parser snippets, which can contain values copied into a malformed fixture.

type MockRegistry

type MockRegistry struct {
	Registry client.Registry
	Images   []MockRegistryImage
}

MockRegistry contains an offline registry fixture.

type MockRegistryImage

type MockRegistryImage struct {
	Repository client.Repository
	Digests    []client.Digest
}

MockRegistryImage contains an offline registry image fixture.

type MockTenant

type MockTenant struct {
	Name       string
	Apps       []client.App
	Alerts     []client.Alert
	Namespaces []client.Namespace
	AppData    map[string]MockAppData
	Registries []MockRegistry
	Databases  []client.Database
	Storages   []client.Storage
}

MockTenant is one tenant and its local app snapshot.

type Options

type Options struct {
	Tenant                   string
	Version                  string
	LocalTenants             []string
	AllowWrites              bool
	AllowSecrets             bool
	ListStorages             func(context.Context, string) ([]client.Storage, error)
	GetStoragePlans          func(context.Context, string) (map[string]client.StoragePlanAllowance, error)
	GetStorageTraffic        func(context.Context, string, string) ([]client.StorageTrafficSample, error)
	CreateStorageBucket      func(context.Context, string, string, string) (string, error)
	DeleteStorageBucket      func(context.Context, string, string, string) error
	SetStorageBucketPublic   func(context.Context, string, string, bool, string) error
	CreateStorageKey         func(context.Context, string, string, []string, []string, string) (*client.StorageKeySecret, error)
	UpdateStorageKey         func(context.Context, string, string, []string, []string, string) error
	RotateStorageKey         func(context.Context, string, string, string) (*client.StorageKeySecret, error)
	DeleteStorageKey         func(context.Context, string, string, string) error
	ListTickets              func(context.Context, string, string, bool) (client.TicketList, error)
	GetTicket                func(context.Context, string, string) (client.Ticket, error)
	GetTicketComments        func(context.Context, string, string) ([]client.TicketComment, error)
	GetTicketCategories      func(context.Context, string) ([]client.TicketCategory, error)
	GetTicketPriorities      func(context.Context, string) ([]client.TicketPriority, error)
	CreateTicket             func(context.Context, string, client.NewTicket) (string, error)
	ReplyTicket              func(context.Context, string, string, string) error
	Profile                  func(context.Context) (*client.Profile, error)
	Alerts                   func(context.Context, string) ([]client.Alert, error)
	Notifications            func(context.Context) ([]client.Notification, error)
	ListDatabases            func(context.Context, string) ([]client.Database, error)
	GetDatabase              func(context.Context, string, string) (*client.DatabaseDetail, error)
	ListApps                 func(context.Context, string) ([]client.App, error)
	GetApp                   func(context.Context, string, string) (*client.App, error)
	Usage                    func(context.Context, string, string) (*AppUsage, error)
	ListPVCs                 func(context.Context, string, string, int) ([]client.PVC, error)
	UsageHistory             func(context.Context, string, string, time.Duration, time.Duration) (*UsageHistory, error)
	Pods                     func(context.Context, string, string) ([]appstate.Pod, error)
	AppLogs                  func(context.Context, string, string, client.LogOptions) ([]client.LogEntry, error)
	ListBuilds               func(context.Context, string, string, int) ([]client.Build, error)
	GetBuild                 func(context.Context, string, client.BuildID) (*client.Build, error)
	DeployToken              func(context.Context, string, string) (string, error)
	UpdateGitBuildSettings   func(context.Context, string, string, client.GitBuildSettings, client.GitBuildSettings) error
	BuildLatest              func(context.Context, string, string) error
	RetryBuild               func(context.Context, string, client.BuildID) (*client.Build, error)
	StopBuild                func(context.Context, string, client.BuildID) error
	Environment              func(context.Context, string, string) ([]client.EnvVar, []string, error)
	SecretEnvs               func(context.Context, string, string) ([]client.EnvVar, error)
	UpdatePlainEnv           func(context.Context, string, string, []client.EnvVar) error
	UpdateSecretEnv          func(context.Context, string, string, []client.EnvVar) error
	Domains                  func(context.Context, string, string) (DomainConfig, error)
	UpdateDomains            func(context.Context, string, string, DomainConfig) error
	Ports                    func(context.Context, string, string) (PortConfig, error)
	UpdatePorts              func(context.Context, string, string, PortConfig) error
	UpdateResources          func(context.Context, string, string, ResourceConfig) error
	ListResourcePlans        func(context.Context, string) ([]client.Plan, error)
	Terminal                 func(context.Context, string, string, string, string, string) tea.ExecCommand
	EgressRoutes             func(context.Context, string) (map[string]client.ClusterEgress, error)
	Namespaces               func(context.Context, string) ([]client.Namespace, error)
	ListRegistries           func(context.Context, string) ([]client.Registry, error)
	ListRegistryRepositories func(context.Context, string, client.FlexID) ([]client.Repository, error)
	ListRegistryDigests      func(context.Context, string, client.FlexID, string) ([]client.Digest, error)
	DeleteRegistryRepository func(context.Context, string, client.FlexID, string) error
	DeleteRegistryDigests    func(context.Context, string, client.FlexID, string, []string) error
	DeleteRegistryTags       func(context.Context, string, client.FlexID, string, string, []string) error
	RestartApp               func(context.Context, string, string) error
	DeleteApp                func(context.Context, string, string) error
}

Options contains the live browser's reads and opt-in write actions.

type PortConfig

type PortConfig struct {
	Type            string
	InternalAddress string
	ExternalAddress string
	ExternalIP      string
	Ports           map[string]client.Port
}

PortConfig is the editable service projection for an app.

type ResourceConfig

type ResourceConfig struct {
	Plan, CPU, RAM                                        string
	DiskGi, Replicas, MinReplicas, MaxReplicas, CPUTarget int
	Autoscaling                                           bool
}

ResourceConfig is the staged, editable resource and scaling projection.

type UsageHistory

type UsageHistory struct {
	Start, End                  time.Time
	Step                        time.Duration
	CPU, CPUThrottle, RAM, Disk []client.Series
	NetworkReceive, NetworkSend []client.Series
	Failed                      UsageMetricFailures
}

UsageHistory holds the API's per-pod time series for a single query window.

type UsageMetricFailures

type UsageMetricFailures struct {
	CPU            bool
	CPUThrottle    bool
	RAM            bool
	Disk           bool
	NetworkReceive bool
	NetworkSend    bool
}

UsageMetricFailures records per-resource query failures so partial metric responses remain distinct from a successful query with no samples.

Jump to

Keyboard shortcuts

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