Documentation ¶
Index ¶
- 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 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 SafeContainerName(name string) string
- 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 Identifier
- type Info
- type InfoMatchError
- type Request
- type Session
- type UserClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 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 SafeContainerName ¶ added in v2.16.0
SafeContainerName returns a string that can safely be used as an argument to docker run --name. Only characters [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed. Others are replaced by an underscore, or if it's the very first character, by the character 'a'.
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 Identifier ¶ added in v2.16.0
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"` }
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 Request ¶
type Request struct { connector.ConnectRequest // If set, then use a containerized daemon for the connection. Docker bool // 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 InitRequest ¶
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) GetAllNamespaces ¶ added in v2.16.0
type Session ¶
type Session struct { UserClient Info *connector.ConnectInfo Started bool }
func GetSession ¶
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