Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithOnSyncCompleted ¶
WithOnSyncCompleted will inject a callback function in the sync configuration.
func WithRepoInfo ¶
WithRepoInfo will set target repository information on a sync configuration object.
func WithSSHInfo ¶
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 ¶
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 ¶
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.