session

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultClient

func DefaultClient(namespace string) (*client, error)

DefaultClient creates a client based on existing kube config. The instance is created lazily only once and shared among all the callers While resolving configuration we look for .kube/config file unless KUBECONFIG env variable is set If namespace parameter is empty default one from the current context is used

func NewClient

func NewClient(c versioned.Interface, namespace string) (*client, error)

NewClient creates client to handle Session resources based on passed config

func ParseRoute

func ParseRoute(route string) (*istiov1alpha1.Route, error)

ParseRoute maps string route representation into a Route struct by unwrapping its type, name and value

Types

type DeploymentNotFoundError added in v0.0.3

type DeploymentNotFoundError struct {
	// contains filtered or unexported fields
}

DeploymentNotFoundError denotes failing to find deployment.

func (DeploymentNotFoundError) Error added in v0.0.3

func (dnfe DeploymentNotFoundError) Error() string

Error returns the formatted deployment error.

type Handler

type Handler func(opts Options) (State, func(), error)

Handler is a function to setup a server session before attempting to connect. Returns a 'cleanup' function.

type Options

type Options struct {
	NamespaceName  string            // name of the namespace for target resource
	DeploymentName string            // name of the initial resource to target
	SessionName    string            // name of the session create or join if exist
	RouteExp       string            // expression of how to route the traffic to the target resource
	Strategy       string            // name of the strategy to use for the target resource
	StrategyArgs   map[string]string // additional arguments for the strategy
}

Options holds the variables used by the Session Handler

type State

type State struct {
	DeploymentName string // name of the resource to target within the cloned route.
}

State holds the new variables as presented by the creation of the session

func CreateOrJoinHandler

func CreateOrJoinHandler(opts Options) (State, func(), error)

CreateOrJoinHandler provides the option to either create a new session if non exist or join an existing. Rely on the following flags:

  • namespace - the name of the target namespace where deployment is defined
  • deployment - the name of the target deployment and will update the flag with the new deployment name
  • session - the name of the session
  • route - the definition of traffic routing

func Offline

func Offline(opts Options) (State, func(), error)

Offline is a empty Handler doing nothing. Used for testing

func RemoveHandler

func RemoveHandler(opts Options) (State, func(), error)

RemoveHandler provides the option to delete an existing sessions if found. Rely on the following flags:

  • namespace - the name of the target namespace where deployment is defined
  • session - the name of the session

Jump to

Keyboard shortcuts

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