Documentation ¶
Overview ¶
Package ksync is a set of abstract functionality used by the ksync cmd.
Index ¶
- Variables
- type BinVersion
- type Folder
- type RemoteContainer
- type Service
- type ServiceList
- func (s *ServiceList) Add(pod *v1.Pod, details *SpecDetails) error
- func (s *ServiceList) Fields() log.Fields
- func (s *ServiceList) Get(name string) (*Service, error)
- func (s *ServiceList) Has(target *Service) bool
- func (s *ServiceList) Message() (*pb.ServiceList, error)
- func (s *ServiceList) Pop(podName string) *Service
- func (s *ServiceList) Stop() error
- func (s *ServiceList) String() string
- type ServiceStatus
- type Spec
- type SpecDetails
- type SpecList
- func (s *SpecList) Create(details *SpecDetails, force bool) error
- func (s *SpecList) Delete(name string) error
- func (s *SpecList) Fields() log.Fields
- func (s *SpecList) Get(name string) (*Spec, error)
- func (s *SpecList) Has(target string) bool
- func (s *SpecList) HasLike(target *SpecDetails) bool
- func (s *SpecList) Message() (*pb.SpecList, error)
- func (s *SpecList) Save() error
- func (s *SpecList) String() string
- func (s *SpecList) Update() error
- func (s *SpecList) Watch() error
- type SpecStatus
- type Syncthing
Constants ¶
This section is empty.
Variables ¶
var ( // GitCommit is the commit hash of the commit used to build GitCommit string // VersionString is the canonical version string VersionString string // BuildDate contains the build timestamp BuildDate string // GitTag optionally contains the git tag used in build GitTag string // GoVersion contains the Go version used in build GoVersion string )
These values will be stamped at build time
var SignalLoss = make(chan bool)
SignalLoss is a channel for communicating when contact with a cluster has been lost
Functions ¶
This section is empty.
Types ¶
type BinVersion ¶
type BinVersion struct { Version string GoVersion string GitCommit string GitTag string BuildDate string OS string Arch string }
BinVersion represents the version of this binary.
func Version ¶
func Version() *BinVersion
Version contains version information for the binary. It is set at build time.
type Folder ¶
type Folder struct { SpecName string RemoteContainer *RemoteContainer Reload bool LocalPath string RemotePath string Status ServiceStatus LocalReadOnly bool RemoteReadOnly bool // contains filtered or unexported fields }
Folder is what controls the syncing between a local folder and a specific container running in the remote cluster.
func (*Folder) Run ¶
Run starts syncing the folder between the local host and the remote container. It is expected that syncthing is already running locally ( normally started by Syncthing).
func (*Folder) ShortFields ¶
ShortFields returns a set of structured fields to show users that are simplified.
type RemoteContainer ¶
RemoteContainer is a specific container running on the remote cluster.
func DeserializeRemoteContainer ¶
func DeserializeRemoteContainer(c *pb.RemoteContainer) (*RemoteContainer, error)
DeserializeRemoteContainer deserializes gRPC messages into a RemoteContainer struct
func NewRemoteContainer ¶
func NewRemoteContainer( pod *apiv1.Pod, containerName string) (*RemoteContainer, error)
NewRemoteContainer builds a RemoteContainer from a pod.
func (*RemoteContainer) Fields ¶
func (c *RemoteContainer) Fields() log.Fields
Fields returns a set of structured fields for logging.
func (*RemoteContainer) Message ¶
func (c *RemoteContainer) Message() (*pb.RemoteContainer, error)
Message is used to serialize over gRPC
func (*RemoteContainer) String ¶
func (c *RemoteContainer) String() string
type Service ¶
type Service struct { RemoteContainer *RemoteContainer SpecDetails *SpecDetails // contains filtered or unexported fields }
Service reflects a spec that will sync files between a local and remote folder.
func DeserializeService ¶
DeserializeService deserializes gRPC messages into a Service struct
func NewService ¶
func NewService(cntr *RemoteContainer, details *SpecDetails) *Service
NewService constructs a Service to sync files between a local and remote folder.
func (*Service) ShortFields ¶
ShortFields returns a set of structured fields to show users that are simplified.
func (*Service) Status ¶
func (s *Service) Status() ServiceStatus
Status returns the current status of this service.
type ServiceList ¶
type ServiceList struct {
Items []*Service
}
ServiceList is a list of services.
func DeserializeServiceList ¶
func DeserializeServiceList(s *pb.ServiceList) (*ServiceList, error)
DeserializeServiceList deserializes gRPC messages into a ServiceList struct
func NewServiceList ¶
func NewServiceList() *ServiceList
NewServiceList is a constructor for ServiceList
func (*ServiceList) Add ¶
func (s *ServiceList) Add(pod *v1.Pod, details *SpecDetails) error
Add takes a pod/spec, creates a new service, adds it to the list and starts it.
func (*ServiceList) Fields ¶
func (s *ServiceList) Fields() log.Fields
Fields returns a set of structured fields for logging.
func (*ServiceList) Get ¶
func (s *ServiceList) Get(name string) (*Service, error)
Get searches the service list for a matching service (by name) and returns it
func (*ServiceList) Has ¶
func (s *ServiceList) Has(target *Service) bool
Has checks for equivalence between the existing services.
func (*ServiceList) Message ¶
func (s *ServiceList) Message() (*pb.ServiceList, error)
Message is used to serialize over gRPC
func (*ServiceList) Pop ¶
func (s *ServiceList) Pop(podName string) *Service
Pop fetches a service by pod name and removes it from the list.
func (*ServiceList) Stop ¶
func (s *ServiceList) Stop() error
Stop takes all the services in a list and stops them.
func (*ServiceList) String ¶
func (s *ServiceList) String() string
type ServiceStatus ¶
type ServiceStatus string
ServiceStatus is the current status of a service.
const ( // ServiceStopped is for when a service is stopped. ServiceStopped ServiceStatus = "stopped" // ServiceStarting is for when a service is starting. ServiceStarting ServiceStatus = "starting" // ServiceWatching is for when a service is watching. ServiceWatching ServiceStatus = "watching" // ServiceUpdating is for when a service is updating. ServiceUpdating ServiceStatus = "updating" // ServiceReloading is for when the container is restarting. ServiceReloading ServiceStatus = "reloading" // ServiceError is for when a service is experiencing an error. ServiceError ServiceStatus = "error" )
type Spec ¶
type Spec struct { Details *SpecDetails Services *ServiceList `structs:"-"` Status SpecStatus // contains filtered or unexported fields }
Spec is what manages the configuration and state of a folder being synced between the localhost and a remote container. It has a list of services for remote containers that match the SpecDetails (active folder syncs).
func DeserializeSpec ¶
DeserializeSpec deserializes gRPC messages into a Spec struct
func (*Spec) Cleanup ¶
Cleanup will remove anything running in the background, meant to be used when a spec is deleted.
type SpecDetails ¶
type SpecDetails struct { // Local config Name string // RemoteContainer Locator ContainerName string Pod string Selector []string Namespace string // File config LocalPath string RemotePath string // Reload related options Reload bool // One-way-sync related options LocalReadOnly bool RemoteReadOnly bool }
SpecDetails encapsulates all the configuration required to sync files between a local and remote folder.
func DeserializeSpecDetails ¶
func DeserializeSpecDetails(s *pb.SpecDetails) (*SpecDetails, error)
DeserializeSpecDetails deserializes gRPC messages into a SpecDetails struct
func (*SpecDetails) Equivalence ¶
func (s *SpecDetails) Equivalence() map[string]interface{}
Equivalence returns a set of fields that can be used to compare specs for equivalence via. reflect.DeepEqual.
func (*SpecDetails) Fields ¶
func (s *SpecDetails) Fields() log.Fields
Fields returns a set of structured fields for logging.
func (*SpecDetails) IsValid ¶
func (s *SpecDetails) IsValid() error
IsValid returns an error if the spec is not valid.
func (*SpecDetails) Message ¶
func (s *SpecDetails) Message() (*pb.SpecDetails, error)
Message is used to serialize over gRPC
func (*SpecDetails) String ¶
func (s *SpecDetails) String() string
type SpecList ¶
SpecList is a list of specs.
func DeserializeSpecList ¶
DeserializeSpecList deserializes gRPC messages into a SpecList struct
func (*SpecList) Create ¶
func (s *SpecList) Create(details *SpecDetails, force bool) error
Create checks an individual input spec for likeness and duplicates then adds the spec into the SpecList
func (*SpecList) HasLike ¶
func (s *SpecList) HasLike(target *SpecDetails) bool
HasLike checks a given spec for deep equivalence against another spec
type SpecStatus ¶
type SpecStatus string
SpecStatus is the status of a spec
const ( SpecWaiting SpecStatus = "waiting" SpecRunning SpecStatus = "running" )
See docs/spec-lifecycle.png
type Syncthing ¶
type Syncthing struct {
// contains filtered or unexported fields
}
Syncthing represents the local syncthing process.
func (*Syncthing) HasBinary ¶
HasBinary checks whether the syncthing binary exists in the correct location or not.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cluster provides tools to interact with the k8s cluster.
|
Package cluster provides tools to interact with the k8s cluster. |
Package doctor provides tools to help validate environments and operational status.
|
Package doctor provides tools to help validate environments and operational status. |
Package server provides a gRPC server that can be started by ksync.
|
Package server provides a gRPC server that can be started by ksync. |