Documentation ¶
Index ¶
- Variables
- func CancelWhenRmFromCache(ctx context.Context, cancel context.CancelFunc, filename string) error
- func DeleteAllInfos(ctx context.Context) error
- func DeleteInfo(ctx context.Context, file string) error
- func GetCommandKubeConfig(cmd *cobra.Command) (context.Context, *client.Kubeconfig, error)
- func GetKubeStartingConfig(cmd *cobra.Command) (*api.Config, error)
- func InfoExists(ctx context.Context, file string) (bool, error)
- func KeepInfoAlive(ctx context.Context, file string) error
- func SaveInfo(ctx context.Context, object *Info, file string) error
- func WaitUntilAllVanishes(ctx context.Context, ttw time.Duration) error
- func WatchInfos(ctx context.Context, onChange func(context.Context) error, files ...string) error
- func WithDefaultRequest(ctx context.Context, cmd *cobra.Command) (context.Context, error)
- func WithRequest(ctx context.Context, cr *Request) context.Context
- func WithSession(ctx context.Context, s *Session) context.Context
- func WithUserClient(ctx context.Context, ud UserClient) context.Context
- type CobraRequest
- type Identifier
- type Info
- type InfoMatchError
- type MultipleDaemonsError
- type Request
- type Session
- type UserClient
Constants ¶
This section is empty.
Variables ¶
var NewUserClientFunc = NewUserClient //nolint:gochecknoglobals // extension point
Functions ¶
func CancelWhenRmFromCache ¶ added in v2.16.0
CancelWhenRmFromCache watches for the file to be removed from the cache, then calls cancel.
func DeleteAllInfos ¶ added in v2.16.0
func GetCommandKubeConfig ¶ added in v2.21.0
GetCommandKubeConfig will return the fully resolved client.Kubeconfig for the given command.
func GetKubeStartingConfig ¶ added in v2.16.0
func KeepInfoAlive ¶ added in v2.16.0
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 WaitUntilAllVanishes ¶ added in v2.16.0
func WatchInfos ¶ added in v2.16.0
func WithDefaultRequest ¶
func WithRequest ¶ added in v2.16.0
func WithUserClient ¶
func WithUserClient(ctx context.Context, ud UserClient) context.Context
Types ¶
type CobraRequest ¶ added in v2.19.0
type CobraRequest struct { Request // contains filtered or unexported fields }
func InitRequest ¶
func InitRequest(cmd *cobra.Command) *CobraRequest
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 (*CobraRequest) CommitFlags ¶ added in v2.19.0
func (cr *CobraRequest) CommitFlags(cmd *cobra.Command) error
func (*CobraRequest) GetAllNamespaces ¶ added in v2.19.0
func (cr *CobraRequest) GetAllNamespaces(cmd *cobra.Command) ([]string, error)
type Identifier ¶ added in v2.16.0
func IdentifierFromFlags ¶ added in v2.16.0
func IdentifierFromFlags(ctx context.Context, name string, flagMap map[string]string, kubeConfigData []byte, 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 LoadMatchingInfo ¶ added in v2.16.0
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 NewDefaultRequest ¶ added in v2.16.0
func NewDefaultRequest() *Request
type Session ¶
type Session struct { UserClient Info *connector.ConnectInfo Started bool }
func GetSession ¶
func (*Session) GetAgentConfig ¶ added in v2.21.0
type UserClient ¶
type UserClient interface { connector.ConnectorClient io.Closer Conn() *grpc.ClientConn Containerized() bool DaemonPort() int DaemonID() *Identifier Executable() string Name() string Semver() semver.Version SetDaemonID(*Identifier) AddHandler(ctx context.Context, id string, cmd *dexec.Cmd, containerName string) error }
func GetUserClient ¶
func GetUserClient(ctx context.Context) UserClient
func NewUserClient ¶ added in v2.19.1
func NewUserClient(conn *grpc.ClientConn, daemonID *Identifier, version semver.Version, name string, executable string) UserClient