Documentation ¶
Overview ¶
Package cluster provides tools to interact with the k8s cluster. These include:
- A k8s client to the remote api server. - The ksync daemonset definition and a way to launch it on the cluster. - Tunnels from the remote pod to the localhost. - Connections between each remote container and the localhost.
Index ¶
- Variables
- func GetKubeConfig(context string) (*rest.Config, string, error)
- func InitKubeClient(context string) error
- func SetErrorHandlers()
- func SetImage(name string)
- type Connection
- type Service
- func (s *Service) Fields() log.Fields
- func (s *Service) IsHealthy(nodeName string) (bool, error)
- func (s *Service) IsInstalled() (bool, error)
- func (s *Service) NodeNames() ([]string, error)
- func (s *Service) PodName(nodeName string) (string, error)
- func (s *Service) Remove() error
- func (s *Service) Run(upgrade, withPSP bool) error
- func (s *Service) String() string
- func (s *Service) Version() (*pb.VersionInfo, error)
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
var ( // Client is used to communicate with the cluster's api server. Make sure to // run InitKubeClient() first. Client *kubernetes.Clientset )
var (
// ImageName is the docker image to use for running the cluster service.
ImageName = "ksync/ksync"
)
Functions ¶
func GetKubeConfig ¶
GetKubeConfig fetches a config based off a given context.
func InitKubeClient ¶
InitKubeClient creates a new k8s client for use in talking to the cluster's api server.
func SetErrorHandlers ¶
func SetErrorHandlers()
SetErrorHandlers modifies the default runtime handlers to replace the default logger with our own.
Types ¶
type Connection ¶
type Connection struct { NodeName string // contains filtered or unexported fields }
Connection creates and manages the tunnels and gRPC connection between the local host a ksync pod running on the remote cluster
func NewConnection ¶
func NewConnection(nodeName string) *Connection
NewConnection is the constructor for Connection. You specify the node you'd like to establish a connection to here.
func (*Connection) Fields ¶
func (c *Connection) Fields() log.Fields
Fields returns a set of structured fields for logging.
func (*Connection) Radar ¶
func (c *Connection) Radar() (*grpc.ClientConn, error)
Radar creates a new tunnel and gRPC connection to the radar container running in the ksync pod specified by Container.NodeName
func (*Connection) Stop ¶
func (c *Connection) Stop() error
Stop cleans all the established tunnels up. It should be called when this connection is no longer needed.
func (*Connection) String ¶
func (c *Connection) String() string
type Service ¶
type Service struct { Namespace string RadarPort int32 SyncthingAPI int32 SyncthingListener int32 // contains filtered or unexported fields }
Service is the remote server component of ksync.
func NewService ¶
func NewService() *Service
NewService constructs a Service to track the ksync daemonset on the cluster.
func (*Service) IsHealthy ¶
IsHealthy verifies the target node is running the service container and it is not scheduled for deletion.
func (*Service) IsInstalled ¶
IsInstalled makes sure the cluster service has been installed.
func (*Service) PodName ¶
PodName takes the name of a node and returns the name of the ksync pod running on that node.
func (*Service) Remove ¶
Remove provides cleanup for the ksync daemonset on the cluster. Only run this when you want to clean everything up.
type Tunnel ¶
type Tunnel struct { LocalPort int32 RemotePort int32 PodName string Namespace string Out *bytes.Buffer // contains filtered or unexported fields }
Tunnel is the connection between the local host and a specific pod in the remote cluster.