Documentation
¶
Index ¶
- Constants
- func GetNodeLinks(n *tpb.Node) ([]topologyv1.Link, error)
- func ToEnvVar(kv map[string]string) []corev1.EnvVar
- func ToResourceRequirements(kv map[string]string) corev1.ResourceRequirements
- func Vendor(v tpb.Vendor, fn NewNodeFn)
- type Certer
- type ConfigPusher
- type Constraints
- type Impl
- func (n *Impl) BackToBackLoop() bool
- func (n *Impl) Create(ctx context.Context) error
- func (n *Impl) CreateConfig(ctx context.Context) (*corev1.Volume, error)
- func (n *Impl) CreatePod(ctx context.Context) error
- func (n *Impl) CreateService(ctx context.Context) error
- func (n *Impl) DefaultNodeConstraints() Constraints
- func (n *Impl) Delete(ctx context.Context) error
- func (n *Impl) DeleteConfig(ctx context.Context) error
- func (n *Impl) DeleteResource(ctx context.Context) error
- func (n *Impl) DeleteService(ctx context.Context) error
- func (n *Impl) Exec(ctx context.Context, cmd []string, stdin io.Reader, stdout io.Writer, ...) error
- func (n *Impl) GetCLIConn(platform string, opts []scrapliutil.Option) (*scraplinetwork.Driver, error)
- func (n *Impl) GetNamespace() string
- func (n *Impl) GetProto() *tpb.Node
- func (n *Impl) Name() string
- func (n *Impl) PatchCLIConnOpen(bin string, cliCmd []string, opts []scrapliutil.Option) []scrapliutil.Option
- func (n *Impl) Pods(ctx context.Context) ([]*corev1.Pod, error)
- func (n *Impl) Services(ctx context.Context) ([]*corev1.Service, error)
- func (n *Impl) Status(ctx context.Context) (Status, error)
- func (n *Impl) String() string
- func (n *Impl) TopologySpecs(context.Context) ([]*topologyv1.Topology, error)
- func (n *Impl) ValidateConstraints() error
- type Implementation
- type Interface
- type NewNodeFn
- type Node
- type Resetter
- type Status
Constants ¶
const ( StatusPending Status = "PENDING" StatusRunning Status = "RUNNING" StatusFailed Status = "FAILED" StatusUnknown Status = "UNKNOWN" ConfigVolumeName = "startup-config-volume" OndatraRoleLabel = "ondatra-role" OndatraRoleDUT = "DUT" OndatraRoleATE = "ATE" )
const (
DefaultInitContainerImage = "us-west1-docker.pkg.dev/kne-external/kne/init-wait:ga"
)
Variables ¶
This section is empty.
Functions ¶
func GetNodeLinks ¶ added in v0.2.0
func GetNodeLinks(n *tpb.Node) ([]topologyv1.Link, error)
func ToResourceRequirements ¶
func ToResourceRequirements(kv map[string]string) corev1.ResourceRequirements
Types ¶
type ConfigPusher ¶
ConfigPusher provides an interface for performing config pushes to the node.
type Constraints ¶ added in v0.2.2
Constraints struct holds the values for node constraints like CPU, Memory. The constraints are represented as strings grok format. For example, CPU: "1000m" or "500m" , etc. Memory: "1Gi" or "2Gi" etc.
type Impl ¶
type Impl struct {
Namespace string
KubeClient kubernetes.Interface
RestConfig *rest.Config
Proto *tpb.Node
BasePath string
Kubecfg string
}
Impl is a topology node in the cluster.
func (*Impl) BackToBackLoop ¶ added in v0.1.16
BackToBackLoop returns a bool indicating if the node supports a single link connecting two ports on the same node. By default this is false.
func (*Impl) Create ¶
Create will create the node in the k8s cluster with all services and config maps.
func (*Impl) CreateConfig ¶
CreateConfig creates a boot config for the node based on the underlying proto. A volume containing the boot config is returned. If the config size is <3MB then a ConfigMap is created as the volume source. Else a temporary file is written with the boot config to serve as a HostPath volume source.
func (*Impl) CreateService ¶
CreateService creates services for the node based on the underlying proto.
func (*Impl) DefaultNodeConstraints ¶ added in v0.2.2
func (n *Impl) DefaultNodeConstraints() Constraints
DefaultNodeConstraints - Returns default constraints of the node. It returns an empty struct by default.
func (*Impl) DeleteConfig ¶
DeleteConfig removes the node configmap from the cluster if it exists. If a config file hostPath was used for the boot config volume, clean the file up instead.
func (*Impl) DeleteResource ¶
DeleteResource removes the resource definition for the Node.
func (*Impl) DeleteService ¶
DeleteService removes the service definition for the Node.
func (*Impl) Exec ¶
func (n *Impl) Exec(ctx context.Context, cmd []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error
Exec will make a connection via spdy transport to the Pod and execute the provided command. It will wire up stdin, stdout, stderr to provided io channels.
func (*Impl) GetCLIConn ¶ added in v0.1.3
func (n *Impl) GetCLIConn(platform string, opts []scrapliutil.Option) (*scraplinetwork.Driver, error)
GetCLIConn attempts to open the transport channel towards a Network OS and perform scrapligo OnOpen actions for a given platform. Retries indefinitely till success and returns a scrapligo network driver instance.
func (*Impl) GetNamespace ¶
func (*Impl) PatchCLIConnOpen ¶ added in v0.1.3
func (n *Impl) PatchCLIConnOpen(bin string, cliCmd []string, opts []scrapliutil.Option) []scrapliutil.Option
PatchCLIConnOpen sets up scrapligo options to work with a tty provided by the combination of the bin binary, namespace and the name of the node plus cliCMd command. In the context of kne this command is typically `kubectl exec cliCmd`.
func (*Impl) TopologySpecs ¶
func (*Impl) ValidateConstraints ¶ added in v0.1.15
ValidateConstraints will check the host constraints and returns a list of errors for cases which do not meet the constraints
type Implementation ¶
type Implementation interface {
// TopologySpecs provides a custom implementation for providing
// one or more meshnet resource spec for a node type
TopologySpecs(context.Context) ([]*topologyv1.Topology, error)
// Create provides a custom implementation of pod creation
// for a node type. Requires context, Kubernetes client interface and namespace.
Create(context.Context) error
// Status provides a custom implementation of accessing vendor node status.
// Requires context, Kubernetes client interface and namespace.
Status(context.Context) (Status, error)
// Delete provides a custom implementation of pod creation
// for a node type. Requires context, Kubernetes client interface and namespace.
Delete(context.Context) error
// Pods provides a custom implementation for querying all pods created for
// for a node. Requires context, Kubernetes client interface and namespace.
Pods(context.Context) ([]*corev1.Pod, error)
// Services provides a custom implementation for querying all services created for
// for a node. Requires context, Kubernetes client interface and namespace.
Services(context.Context) ([]*corev1.Service, error)
// BackToBackLoop returns a bool if the node supports links directly between
// two ports on the same node.
BackToBackLoop() bool
// ValidateConstraints validates the host with the node's constraints.
ValidateConstraints() error
// DefaultNodeConstraints exports the node's default constraints.
DefaultNodeConstraints() Constraints
}
type Node ¶
type Node interface {
Interface
Implementation
}
Node is the base interface for all node implementations in KNE.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package drivenets implmements node definitions for nodes from the Drivenets vendor.
|
Package drivenets implmements node definitions for nodes from the Drivenets vendor. |
|
Package openconfig implmements node definitions for nodes from the OpenConfig vendor.
|
Package openconfig implmements node definitions for nodes from the OpenConfig vendor. |