sync

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithOnSyncCompleted

func WithOnSyncCompleted(callback func() error) func(*Sync)

WithOnSyncCompleted will inject a callback function in the sync configuration.

func WithRepoInfo

func WithRepoInfo(remote, branch string) func(*Sync)

WithRepoInfo will set target repository information on a sync configuration object.

func WithSSHInfo

func WithSSHInfo(privateKeyPath, password string) func(*Sync)

WithSSHInfo will set a users ssh information on sync config. Passwords are not required.

Types

type Sync

type Sync struct {
	GitDir        string
	SSHPrivateKey string
	SSHPassphrase string
	Remote        string
	Branch        string
	Interval      int

	// Internal callback that is executed at the end
	// of every sync iteration.
	OnSyncCompleted func() error
	// contains filtered or unexported fields
}

func New

func New(remote string, ctx context.Context, options ...func(*Sync)) *Sync

New sync will build a sync with provided constructor options. A remote should be specified it attempting to fetch config from a remote repo. If not specified, operator will use it's default bundled config.

func (*Sync) Bootstrap

func (s *Sync) Bootstrap() error

Bootstrap will fetch a provided repository from the configured bootstrap flags. Once that repository is fetched it will write out its contents to disk where the operator expects its configuration to live. If no bootstrap flags were provided on startup, we ignore and use a bundled local configuration tree for defaults.

func (*Sync) Watch

func (s *Sync) Watch()

Watch will kick off a loop that will pull a git project for changes on an interval provided by the users configuration. The default watch interval is 10s. A callback is exposed in the sync configuration object that is called on a successful completion of a pull. This can be used to reconcile mesh changes internally to the operator. Watch uses the internal sync context to handle routine cancellation. This means that the callback can also cancel this routine.

Jump to

Keyboard shortcuts

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