node

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixServices

func FixServices(pb *tpb.Node)

func GetNextPort

func GetNextPort() uint32

func Register

func Register(t tpb.Node_Type, fn NewNodeFn)

Register registers the node type with the topology manager.

func ToEnvVar

func ToEnvVar(kv map[string]string) []corev1.EnvVar

func ToResourceRequirements

func ToResourceRequirements(kv map[string]string) corev1.ResourceRequirements

func Vendor

func Vendor(v tpb.Vendor, fn NewNodeFn)

Vendor registers the vendor type with the topology manager.

Types

type Certer

type Certer interface {
	GenerateSelfSigned(context.Context) error
}

Certer provides an interface for working with certs on nodes.

type ConfigPusher

type ConfigPusher interface {
	ConfigPush(context.Context, io.Reader) error
}

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
}

Impl is a topology node in the cluster.

func (*Impl) Create

func (n *Impl) Create(ctx context.Context) error

Create will create the node in the k8s cluster with all services and config maps.

func (*Impl) CreateConfig

func (n *Impl) CreateConfig(ctx context.Context) error

CreateConfig creates a boot config for the node based on the underlying proto.

func (*Impl) CreatePod

func (n *Impl) CreatePod(ctx context.Context) error

CreatePod creates a Pod for the Node based on the underlying proto.

func (*Impl) CreateService

func (n *Impl) CreateService(ctx context.Context) error

CreateService creates services for the node based on the underlying proto.

func (*Impl) Delete

func (n *Impl) Delete(ctx context.Context) error

Delete remove the node from the cluster.

func (*Impl) DeleteConfig

func (n *Impl) DeleteConfig(ctx context.Context) error

DeleteConfig removes the node configmap from the cluster.

func (*Impl) DeleteResource

func (n *Impl) DeleteResource(ctx context.Context) error

DeleteResource removes the resource definition for the Node.

func (*Impl) DeleteService

func (n *Impl) DeleteService(ctx context.Context) error

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) GetNamespace

func (n *Impl) GetNamespace() string

func (*Impl) GetProto

func (n *Impl) GetProto() *tpb.Node

func (*Impl) Name

func (n *Impl) Name() string

Name returns the name of the node.

func (*Impl) Pod

func (n *Impl) Pod(ctx context.Context) (*corev1.Pod, error)

Pod returns the pod definition for the node.

func (*Impl) Service

func (n *Impl) Service(ctx context.Context) (*corev1.Service, error)

Service returns the service definition for the node.

func (*Impl) Status

func (n *Impl) Status(ctx context.Context) (corev1.PodPhase, error)

Status returns the current pod state for Node.

type Implementation

type Implementation interface {
	// 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) (corev1.PodPhase, error)
	// Delete provides a custom implementation of pod creation
	// for a node type. Requires context, Kubernetes client interface and namespace.
	Delete(context.Context) error
	Pod(context.Context) (*corev1.Pod, error)
	Service(context.Context) (*corev1.Service, error)
}

type Interface

type Interface interface {
	Name() string
	GetNamespace() string
	GetProto() *tpb.Node
}

type NewNodeFn

type NewNodeFn func(n *Impl) (Node, error)

type Node

type Node interface {
	Interface
	Implementation
}

Node is the base interface for all node implementations in KNE.

func New

func New(namespace string, pb *tpb.Node, kClient kubernetes.Interface, rCfg *rest.Config, bp string) (Node, error)

New creates a new node for use in the k8s cluster. Configure will push the node to the cluster.

type Resetter

type Resetter interface {
	ResetCfg(ctx context.Context) error
}

Resetter provides Reset interface to nodes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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