engine

package
v0.0.0-...-4cf64ee Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartPeanutSync

func StartPeanutSync(clientConfig *rest.Config, config PeanutConfig, peanutRepo GitRepository, met metrics.Interface, syncs *recent.RecentSynchronisations, resync chan bool, done <-chan struct{}) error

StartPeanutSync starts watching the configured Git repository, and synchronising the resources.

Types

type GitConfig

type GitConfig struct {
	RepoURL   string
	Branch    string
	Path      string
	AuthToken string
}

GitConfig is the configuration for the repo to extract resources.

func (*GitConfig) BasicAuth

func (c *GitConfig) BasicAuth() *http.BasicAuth

type GitRepository

type GitRepository interface {
	Clone(string) error
	Open(string) error
	HeadHash() (plumbing.Hash, error)
	Sync() (plumbing.Hash, error)
	ParseManifests() ([]*unstructured.Unstructured, error)
	IsManaged(r *cache.Resource) bool
}

GitRepository represents the operations that the engine needs to perform.

type PeanutConfig

type PeanutConfig struct {
	Prune      bool
	Namespace  string
	Namespaced bool
	Resync     time.Duration
}

PeanutConfig configures the engine synchronisation.

type PeanutRepository

type PeanutRepository struct {
	// contains filtered or unexported fields
}

PeanutRepository wraps git.Repository with some high-level functionality.

func NewRepository

func NewRepository(cfg GitConfig, p parser.ManifestParser) *PeanutRepository

NewRepository creates and returns a new PeanutRepository.

func (*PeanutRepository) Clone

func (p *PeanutRepository) Clone(repoPath string) error

Clone clones the configured repository to the provided path.

func (*PeanutRepository) GCMark

func (p *PeanutRepository) GCMark(key kube.ResourceKey) (string, error)

GCMark calculates a signature for the resource from the repo URL and path along with the GVK.

func (*PeanutRepository) HeadHash

func (p *PeanutRepository) HeadHash() (plumbing.Hash, error)

HeadHash returns the hash of the head commit of the repository.

func (*PeanutRepository) IsManaged

func (p *PeanutRepository) IsManaged(r *cache.Resource) bool

IsManaged is used by the cache to determine whether or not a resource is a managed resource. TODO: is this appropriate for the Repository?

func (*PeanutRepository) Open

func (p *PeanutRepository) Open(openPath string) error

Open assumes that the provided path contains a valid Git clone with the correct branch.

func (*PeanutRepository) ParseManifests

func (p *PeanutRepository) ParseManifests() ([]*unstructured.Unstructured, error)

ParseManifests parses this repository's path, and returns the parsed resources. TODO: should this take a path? Is there

func (*PeanutRepository) Sync

func (p *PeanutRepository) Sync() (plumbing.Hash, error)

Sync does a Fetch and Pull, and returns the HeadHash.

Jump to

Keyboard shortcuts

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