project

package
v0.26.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerNamespace = "navecd-system"
)

Variables

View Source
var (
	ErrHelmInstallationUnsupported = errors.New("Helm installation not supported yet")
)
View Source
var (
	ErrLoadProject = errors.New("Could not load project")
)

Functions

func Init

func Init(
	module string,
	shard string,
	isSecondary bool,
	path string,
	version string,
) error

Types

type InstallAction

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

func NewInstallAction

func NewInstallAction(
	kubeClient *kube.DynamicClient,
	httpClient *http.Client,
	projectRoot string,
) InstallAction

func (InstallAction) Install

func (act InstallAction) Install(ctx context.Context, opts InstallOptions) error

type InstallOptions

type InstallOptions struct {
	Branch       string
	Url          string
	Name         string
	Token        string
	Interval     int
	Shard        string
	PersistToken bool
}

type Instance

type Instance struct {
	Dag                *component.DependencyGraph
	UpdateInstructions []version.UpdateInstruction
}

Instance represents the loaded project.

type Manager

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

Manager loads a navecd project and resolves the component dependency graph.

func NewManager

func NewManager(componentBuilder component.Builder, workerPoolSize int) Manager

func (*Manager) Load

func (manager *Manager) Load(
	projectPath string,
) (*Instance, error)

Load uses a given path to a project and returns the components as a directed acyclic dependency graph.

type ReconcileResult

type ReconcileResult struct {
	// Reports whether the GitOpsProject was flagged as suspended.
	Suspended bool

	// The hash of the reconciled Git Commit.
	CommitHash string

	// PullError reports any error occured while trying to pull from vcs.
	// It is a soft error, which does not halt the reconciliation process, but has to be reported.
	PullError error

	// ComponentError reports the first occured component reconciliation error.
	// It is a soft error, which does not halt the reconciliation process, but has to be reported.
	ComponentError error
}

ReconcileResult reports the outcome and metadata of a reconciliation.

type Reconciler

type Reconciler struct {
	Log logr.Logger

	KubeConfig *rest.Config

	// Manager loads a navecd project and resolves the component dependency graph.
	ProjectManager Manager

	// RepositoryManager clones a remote vcs repository to a local path.
	RepositoryManager vcs.RepositoryManager

	// ComponentBuilder compiles and decodes CUE kubernetes manifest definitions of a component to the corresponding Go struct.
	ComponentBuilder component.Builder

	// Managers identify distinct workflows that are modifying the object (especially useful on conflicts!),
	FieldManager string

	// Defines the concurrency level of Navecd operations.
	WorkerPoolSize int

	// InsecureSkipVerify controls whether Helm clients verify server
	// certificate chains and host names.
	InsecureSkipTLSverify bool

	// Force http for Helm registries.
	PlainHTTP bool

	// Directory used to cache vcs repositories or helm charts.
	CacheDir string

	// Namespace the controller runs in.
	Namespace string

	// Cron scheduler running in the background scanning for image updates.
	Scheduler           gocron.Scheduler
	SchedulerQuitChan   chan struct{}
	SchedulerUpdateChan chan version.AvailableUpdate
	SchedulerErrGroup   *errgroup.Group
}

Reconciler clones, pulls and loads a GitOps Git repository containing the desired cluster state, translates cue definitions to either Kubernetes unstructurd objects or Helm Releases and applies/installs them on a Kubernetes cluster. Every run stores objects in the inventory and collects dangling objects.

func (*Reconciler) Reconcile

func (reconciler *Reconciler) Reconcile(
	ctx context.Context,
	gProject gitops.GitOpsProject,
) (*ReconcileResult, error)

Reconcile clones, pulls and loads a GitOps Git repository containing the desired cluster state, translates cue definitions to either Kubernetes unstructurd objects or Helm Releases and applies/installs them on a Kubernetes cluster. It stores objects in the inventory and collects dangling objects.

Jump to

Keyboard shortcuts

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