Documentation
¶
Overview ¶
Package session warns a user before they disconnect somebody from the serial console or the VNC of a virtual machine. Both streams are exclusive: connecting takes the stream over. The platform answers who holds it, and this is where that answer is turned into a decision.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decision ¶
type Decision int
Decision is what to do about a session somebody else is holding.
func AskBeforeConnecting ¶
func AskBeforeConnecting( ctx context.Context, vms Prober, name string, kind subv1alpha2.SessionKind, force bool, ) Decision
AskBeforeConnecting is the check as a command needs it: it prepares the terminal to ask through and returns the decision. The client config is only needed to recognise the very user who asks, so a command that cannot get it still gets an answer.
func Check ¶
func Check( ctx context.Context, vms Prober, name string, kind subv1alpha2.SessionKind, force bool, s Streams, ) Decision
Check asks who holds the stream and decides whether to connect.
It never stands between a user and a virtual machine: if the platform cannot answer — an older version that does not know the question, a denied or failed request — the connection proceeds as it always did. The same when the stream is free, or held by the very user who is asking.
type Prober ¶
type Prober interface {
SerialConsole(ctx context.Context, name string, options *virtualizationv1alpha2.SerialConsoleOptions) (virtualizationv1alpha2.StreamInterface, *subv1alpha2.VirtualMachineSession, error)
VNC(ctx context.Context, name string, options *virtualizationv1alpha2.VNCOptions) (virtualizationv1alpha2.StreamInterface, *subv1alpha2.VirtualMachineSession, error)
}
Prober is the part of the client this package needs: the very calls it would connect with, asked to report who holds the stream instead.