daemon

package
v2.19.0-pro.7 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelWhenRmFromCache added in v2.16.0

func CancelWhenRmFromCache(ctx context.Context, cancel context.CancelFunc, filename string) error

CancelWhenRmFromCache watches for the file to be removed from the cache, then calls cancel.

func DeleteAllInfos added in v2.16.0

func DeleteAllInfos(ctx context.Context) error

func DeleteInfo added in v2.16.0

func DeleteInfo(ctx context.Context, file string) error

func GetKubeStartingConfig added in v2.16.0

func GetKubeStartingConfig(cmd *cobra.Command) (*api.Config, error)

func InfoExists added in v2.16.0

func InfoExists(ctx context.Context, file string) (bool, error)

func KeepInfoAlive added in v2.16.0

func KeepInfoAlive(ctx context.Context, file string) error

KeepInfoAlive updates the access and modification times of the given Info periodically so that it never gets older than keepAliveInterval. This means that any file with a modification time older than the current time minus two keepAliveIntervals can be considered stale and should be removed.

The alive poll ends and the Info is deleted when the context is cancelled.

func SaveInfo added in v2.16.0

func SaveInfo(ctx context.Context, object *Info, file string) error

func WaitUntilAllVanishes added in v2.16.0

func WaitUntilAllVanishes(ctx context.Context, ttw time.Duration) error

func WatchInfos added in v2.16.0

func WatchInfos(ctx context.Context, onChange func(context.Context) error, files ...string) error

func WithDefaultRequest

func WithDefaultRequest(ctx context.Context, cmd *cobra.Command) (context.Context, error)

func WithRequest added in v2.16.0

func WithRequest(ctx context.Context, cr *Request) context.Context

func WithSession

func WithSession(ctx context.Context, s *Session) context.Context

func WithUserClient

func WithUserClient(ctx context.Context, ud *UserClient) context.Context

Types

type Identifier added in v2.16.0

type Identifier struct {
	Name          string
	KubeContext   string
	Namespace     string
	Containerized bool
}

func IdentifierFromFlags added in v2.16.0

func IdentifierFromFlags(name string, flagMap map[string]string, containerized bool) (*Identifier, error)

IdentifierFromFlags returns a unique name created from the name of the current context and the active namespace denoted by the given flagMap.

func NewIdentifier added in v2.16.0

func NewIdentifier(name, contextName, namespace string, containerized bool) (*Identifier, error)

func (*Identifier) ContainerName added in v2.16.0

func (id *Identifier) ContainerName() string

func (*Identifier) InfoFileName added in v2.16.0

func (id *Identifier) InfoFileName() string

func (*Identifier) String added in v2.16.0

func (id *Identifier) String() string

type Info added in v2.16.0

type Info struct {
	Options      map[string]string `json:"options,omitempty"`
	InDocker     bool              `json:"in_docker,omitempty"`
	Name         string            `json:"name,omitempty"`
	KubeContext  string            `json:"kube_context,omitempty"`
	Namespace    string            `json:"namespace,omitempty"`
	DaemonPort   int               `json:"daemon_port,omitempty"`
	ExposedPorts []string          `json:"exposed_ports,omitempty"`
	Hostname     string            `json:"hostname,omitempty"`
}

func LoadInfo added in v2.16.0

func LoadInfo(ctx context.Context, file string) (*Info, error)

func LoadInfos added in v2.16.0

func LoadInfos(ctx context.Context) ([]*Info, error)

func LoadMatchingInfo added in v2.16.0

func LoadMatchingInfo(ctx context.Context, match *regexp.Regexp) (*Info, error)

func (*Info) DaemonID added in v2.16.0

func (info *Info) DaemonID() *Identifier

type InfoMatchError added in v2.16.0

type InfoMatchError string

func (InfoMatchError) Error added in v2.16.0

func (i InfoMatchError) Error() string

type MultipleDaemonsError added in v2.18.0

type MultipleDaemonsError []*Info //nolint:errname // Don't want a plural name just because the type is a slice

func (MultipleDaemonsError) Error added in v2.18.0

func (m MultipleDaemonsError) Error() string

type Request

type Request struct {
	connector.ConnectRequest

	// If set, then use a containerized daemon for the connection.
	Docker bool

	// Ports exposed by a containerized daemon. Only valid when Docker == true
	ExposedPorts []string

	// Hostname used by a containerized daemon. Only valid when Docker == true
	Hostname string

	// Match expression to use when finding an existing connection by name
	Use *regexp.Regexp

	// Request is created on-demand, not by InitRequest
	Implicit bool

	UserDaemonProfilingPort uint16
	RootDaemonProfilingPort uint16
	// contains filtered or unexported fields
}

func GetRequest

func GetRequest(ctx context.Context) *Request

func InitRequest

func InitRequest(cmd *cobra.Command) *Request

InitRequest adds the networking flags and Kubernetes flags to the given command and returns a Request and a FlagSet with the Kubernetes flags. The FlagSet is returned here so that a map of flags that gets modified can be extracted using FlagMap once the flag parsing has completed.

func NewDefaultRequest added in v2.16.0

func NewDefaultRequest() *Request

func (*Request) CommitFlags

func (cr *Request) CommitFlags(cmd *cobra.Command) error

func (*Request) GetAllNamespaces added in v2.16.0

func (cr *Request) GetAllNamespaces(cmd *cobra.Command) ([]string, error)

func (*Request) GetConfig added in v2.16.0

func (cr *Request) GetConfig(cmd *cobra.Command) (*api.Config, error)

type Session

type Session struct {
	UserClient
	Info    *connector.ConnectInfo
	Started bool
}

func GetSession

func GetSession(ctx context.Context) *Session

type UserClient

type UserClient struct {
	connector.ConnectorClient
	Conn     *grpc.ClientConn
	DaemonID *Identifier
}

func GetUserClient

func GetUserClient(ctx context.Context) *UserClient

func (*UserClient) Containerized added in v2.16.0

func (ud *UserClient) Containerized() bool

func (*UserClient) DaemonPort added in v2.13.0

func (ud *UserClient) DaemonPort() int

Jump to

Keyboard shortcuts

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