session

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 Client added in v0.0.4

type Client struct {
	versioned.Interface
	// contains filtered or unexported fields
}

Client interacts with the k8s api server.

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 (*Client) Create added in v0.0.4

func (c *Client) Create(session *istiov1alpha1.Session) error

Create creates a session instance in a cluster.

func (*Client) Delete added in v0.0.4

func (c *Client) Delete(session *istiov1alpha1.Session) error

Delete deletes a session instance in a cluster.

func (*Client) Get added in v0.0.4

func (c *Client) Get(sessionName string) (*istiov1alpha1.Session, error)

Get retrieves details of the Session instance matching passed name.

func (*Client) Update added in v0.0.4

func (c *Client) Update(session *istiov1alpha1.Session) error

Update updates a session instance in a cluster.

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, client *Client) (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
	Revert         bool              // Revert back to previous known value if join/leave a existing session with a known ref
	Duration       *time.Duration    // Duration defines the interval used to check for changes to the session object
}

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.
	Hosts          []string            // currently exposed hosts
	Route          istiov1alpha1.Route // the current route configuration
}

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

func CreateOrJoinHandler

func CreateOrJoinHandler(opts Options, client *Client) (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, client *Client) (State, func(), error)

Offline is a empty Handler doing nothing. Used for testing.

func RemoveHandler

func RemoveHandler(opts Options, client *Client) (State, func())

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