Documentation
¶
Index ¶
- Constants
- 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 Impl
- 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) 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) TopologySpecs(context.Context) ([]*topologyv1.Topology, error)
- type Implementation
- type Interface
- type NewNodeFn
- type Node
- type Resetter
- type Status
Constants ¶
const (
DefaultInitContainerImage = "us-west1-docker.pkg.dev/kne-external/kne/networkop/init-wait:ga"
)
Variables ¶
This section is empty.
Functions ¶
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 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) 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) 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 ¶
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)
}
type Node ¶
type Node interface {
Interface
Implementation
}
Node is the base interface for all node implementations in KNE.