topo

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 32 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTopology

func CreateTopology(ctx context.Context, params TopologyParams) error

CreateTopology creates the topology and configs it.

func DeleteTopology

func DeleteTopology(ctx context.Context, params TopologyParams) error

DeleteTopology deletes the topology.

func GenerateSelfSigned

func GenerateSelfSigned(ctx context.Context, n node.Node) error

GenerateSelfSigned will try to create self signed certs on the provided node. If the node doesn't have cert info then it is a noop. If the node doesn't fulfil Certer then status.Unimplmented will be returned.

func GetTopologyServices

func GetTopologyServices(ctx context.Context, params TopologyParams) (*cpb.ShowTopologyResponse, error)

GetTopologyServices returns the topology information.

func Load

func Load(fName string) (*tpb.Topology, error)

Load loads a Topology from fName.

Types

type Manager

type Manager struct {
	BasePath string
	// contains filtered or unexported fields
}

Manager is a topology instance manager for k8s cluster instance.

func (*Manager) CheckNodeStatus

func (m *Manager) CheckNodeStatus(ctx context.Context, timeout time.Duration) error

CheckNodeStatus reports node status, ignores for unimplemented nodes.

func (*Manager) ConfigPush

func (m *Manager) ConfigPush(ctx context.Context, deviceName string, r io.Reader) error

func (*Manager) CreateMeshnetTopologies

func (m *Manager) CreateMeshnetTopologies(ctx context.Context) error

CreateMeshnetTopologies creates meshnet resources for all available nodes

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context) error

Delete deletes the topology from k8s.

func (*Manager) DeleteMeshnetTopologies

func (m *Manager) DeleteMeshnetTopologies(ctx context.Context) error

DeleteMeshnetTopologies deletes meshnet resources for all available nodes

func (*Manager) Load

func (m *Manager) Load(ctx context.Context) error

Load creates an instance of the managed topology.

func (*Manager) Node

func (m *Manager) Node(nodeName string) (node.Node, error)

func (*Manager) Nodes

func (m *Manager) Nodes() []node.Node

Nodes returns all nodes in the current topology.

func (*Manager) Push

func (m *Manager) Push(ctx context.Context) error

Push pushes the current topology to k8s.

func (*Manager) Resources

func (m *Manager) Resources(ctx context.Context) (*Resources, error)

Resources gets the currently configured resources from the topology.

func (*Manager) TopologyProto

func (m *Manager) TopologyProto() *tpb.Topology

Topology returns the topology protobuf.

func (*Manager) TopologyResources

func (m *Manager) TopologyResources(ctx context.Context) ([]*topologyv1.Topology, error)

TopologyResources gets the topology CRDs for the cluster.

func (*Manager) TopologySpecs

func (m *Manager) TopologySpecs(ctx context.Context) ([]*topologyv1.Topology, error)

func (*Manager) Watch

func (m *Manager) Watch(ctx context.Context) error

type Option

type Option func(m *Manager)

func WithBasePath

func WithBasePath(s string) Option

func WithClusterConfig

func WithClusterConfig(r *rest.Config) Option

func WithKubeClient

func WithKubeClient(c kubernetes.Interface) Option

func WithTopoClient

func WithTopoClient(c topologyclientv1.Interface) Option

func WithTopology

func WithTopology(t *tpb.Topology) Option

type Resources

type Resources struct {
	Services   map[string][]*corev1.Service
	Pods       map[string][]*corev1.Pod
	ConfigMaps map[string]*corev1.ConfigMap
	Topologies map[string]*topologyv1.Topology
}

type TopologyManager

type TopologyManager interface {
	CheckNodeStatus(context.Context, time.Duration) error
	ConfigPush(context.Context, string, io.Reader) error
	Delete(context.Context) error
	Load(context.Context) error
	Node(string) (node.Node, error)
	Nodes() []node.Node
	// TopologySpecs provides a custom implementation for constructing
	// meshnet resource specs (before meshnet topology creation)
	// for all configured nodes
	TopologySpecs(context.Context) ([]*topologyv1.Topology, error)
	// TopologySpecs provides a custom implementation for querying
	// meshnet resource specs+status (after meshnet topology creation)
	// for all configured nodes
	TopologyResources(ctx context.Context) ([]*topologyv1.Topology, error)
	Push(context.Context) error
	Resources(context.Context) (*Resources, error)
	TopologyProto() *tpb.Topology
	Watch(context.Context) error
}

TopologyManager manages a topology.

func New

func New(kubecfg string, pb *tpb.Topology, opts ...Option) (TopologyManager, error)

New creates a new topology manager based on the provided kubecfg and topology.

type TopologyParams

type TopologyParams struct {
	TopoName       string   // the filename of the topology
	Kubecfg        string   // the path of kube config
	TopoNewOptions []Option // the options used in the TopoNewFunc
	Timeout        time.Duration
	DryRun         bool
}

TopologyParams specifies the parameters used by the functions that creates/deletes/show topology.

Directories

Path Synopsis
srl

Jump to

Keyboard shortcuts

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