gitops

package
v0.0.0-...-bac2f6a Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgoCDManager

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

ArgoCDManager implements GitOps integration with ArgoCD

func (*ArgoCDManager) GetSyncStatus

GetSyncStatus returns the current GitOps sync status

func (*ArgoCDManager) PromoteEnvironment

func (m *ArgoCDManager) PromoteEnvironment(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, from, to string) error

PromoteEnvironment promotes configuration between environments

func (*ArgoCDManager) Rollback

func (m *ArgoCDManager) Rollback(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, revision string) error

Rollback rolls back to a previous configuration

func (*ArgoCDManager) SetupGitOps

SetupGitOps configures ArgoCD for the platform

func (*ArgoCDManager) SyncWithGit

SyncWithGit triggers a sync with the Git repository

func (*ArgoCDManager) ValidateGitOpsConfig

func (m *ArgoCDManager) ValidateGitOpsConfig(platform *observabilityv1beta1.ObservabilityPlatform) error

ValidateGitOpsConfig validates GitOps configuration

type AutoPromotionConfig

type AutoPromotionConfig struct {
	// Enabled turns on auto-promotion
	Enabled bool `json:"enabled"`

	// Strategy for promotion (sequential, parallel)
	Strategy string `json:"strategy"`

	// MaxParallel environments to promote simultaneously
	MaxParallel int `json:"maxParallel,omitempty"`
}

AutoPromotionConfig configures automatic promotion

type Environment

type Environment struct {
	// Name of the environment
	Name string `json:"name"`

	// Namespace to deploy to
	Namespace string `json:"namespace"`

	// Branch to track for this environment
	Branch string `json:"branch,omitempty"`

	// Path override for this environment
	Path string `json:"path,omitempty"`

	// PromotionPolicy defines promotion rules
	PromotionPolicy *PromotionPolicy `json:"promotionPolicy,omitempty"`
}

Environment represents an environment configuration

type EnvironmentStatus

type EnvironmentStatus struct {
	// Name of the environment
	Name string `json:"name"`

	// Namespace where deployed
	Namespace string `json:"namespace"`

	// Revision deployed in this environment
	Revision string `json:"revision"`

	// PromotedFrom indicates the source environment
	PromotedFrom string `json:"promotedFrom,omitempty"`

	// PromotedAt indicates when the promotion happened
	PromotedAt string `json:"promotedAt,omitempty"`

	// Status of the environment
	Status string `json:"status"`

	// Health of components in this environment
	Health string `json:"health"`
}

EnvironmentStatus represents the status of a specific environment

type FluxManager

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

FluxManager implements GitOps integration with Flux

func (*FluxManager) GetSyncStatus

GetSyncStatus returns the current GitOps sync status

func (*FluxManager) PromoteEnvironment

func (m *FluxManager) PromoteEnvironment(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, from, to string) error

PromoteEnvironment promotes configuration between environments

func (*FluxManager) Rollback

func (m *FluxManager) Rollback(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, revision string) error

Rollback rolls back to a previous configuration

func (*FluxManager) SetupGitOps

SetupGitOps configures Flux for the platform

func (*FluxManager) SyncWithGit

SyncWithGit triggers a sync with the Git repository

func (*FluxManager) ValidateGitOpsConfig

func (m *FluxManager) ValidateGitOpsConfig(platform *observabilityv1beta1.ObservabilityPlatform) error

ValidateGitOpsConfig validates GitOps configuration

type GitOpsConfig

type GitOpsConfig struct {
	// Provider to use (argocd or flux)
	Provider GitOpsProvider `json:"provider"`

	// Repository configuration
	Repository GitRepository `json:"repository"`

	// Environments configuration
	Environments []Environment `json:"environments"`

	// AutoSync enables automatic synchronization
	AutoSync bool `json:"autoSync"`

	// AutoPromotion configuration
	AutoPromotion *AutoPromotionConfig `json:"autoPromotion,omitempty"`

	// Rollback configuration
	RollbackConfig *RollbackConfig `json:"rollbackConfig,omitempty"`
}

GitOpsConfig holds GitOps configuration

type GitOpsManager

type GitOpsManager interface {
	// SetupGitOps configures GitOps for the platform
	SetupGitOps(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform) error

	// SyncWithGit synchronizes the platform configuration with Git repository
	SyncWithGit(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform) error

	// PromoteEnvironment promotes configuration between environments
	PromoteEnvironment(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, from, to string) error

	// Rollback rolls back to a previous configuration
	Rollback(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, revision string) error

	// GetSyncStatus returns the current GitOps sync status
	GetSyncStatus(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform) (*GitOpsSyncStatus, error)

	// ValidateGitOpsConfig validates GitOps configuration
	ValidateGitOpsConfig(platform *observabilityv1beta1.ObservabilityPlatform) error
}

GitOpsManager manages GitOps integrations for ObservabilityPlatform

func NewArgoCDManager

func NewArgoCDManager(client client.Client, scheme *runtime.Scheme) (GitOpsManager, error)

NewArgoCDManager creates a new ArgoCD manager

func NewFluxManager

func NewFluxManager(client client.Client, scheme *runtime.Scheme) (GitOpsManager, error)

NewFluxManager creates a new Flux manager

func NewGitOpsManager

func NewGitOpsManager(client client.Client, scheme *runtime.Scheme, provider GitOpsProvider) (GitOpsManager, error)

NewGitOpsManager creates a new GitOps manager

func NewMultiProviderManager

func NewMultiProviderManager(client client.Client, scheme *runtime.Scheme) (GitOpsManager, error)

NewMultiProviderManager creates a manager that can work with multiple providers

type GitOpsProvider

type GitOpsProvider string

GitOpsProvider represents supported GitOps providers

const (
	// ArgoCD provider
	ArgoCD GitOpsProvider = "argocd"
	// Flux provider
	Flux GitOpsProvider = "flux"
)

type GitOpsSyncStatus

type GitOpsSyncStatus struct {
	// Provider being used
	Provider GitOpsProvider `json:"provider"`

	// LastSyncTime is the last successful sync time
	LastSyncTime string `json:"lastSyncTime,omitempty"`

	// Revision is the current Git revision
	Revision string `json:"revision,omitempty"`

	// SyncState represents the sync state
	SyncState SyncState `json:"syncState"`

	// Message provides additional information
	Message string `json:"message,omitempty"`

	// Environments shows status per environment
	Environments map[string]EnvironmentStatus `json:"environments,omitempty"`
}

GitOpsSyncStatus represents the sync status with Git

type GitRepository

type GitRepository struct {
	// URL of the Git repository
	URL string `json:"url"`

	// Branch to track
	Branch string `json:"branch"`

	// Path within the repository
	Path string `json:"path"`

	// SecretRef for authentication
	SecretRef string `json:"secretRef,omitempty"`

	// Interval for polling
	Interval string `json:"interval,omitempty"`
}

GitRepository represents Git repository configuration

type MultiProviderManager

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

MultiProviderManager supports multiple GitOps providers

func (*MultiProviderManager) GetSyncStatus

GetSyncStatus returns the current GitOps sync status

func (*MultiProviderManager) PromoteEnvironment

func (m *MultiProviderManager) PromoteEnvironment(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, from, to string) error

PromoteEnvironment promotes configuration between environments

func (*MultiProviderManager) Rollback

Rollback rolls back to a previous configuration

func (*MultiProviderManager) SetupGitOps

SetupGitOps configures GitOps for the platform

func (*MultiProviderManager) SyncWithGit

SyncWithGit synchronizes the platform configuration with Git repository

func (*MultiProviderManager) ValidateGitOpsConfig

func (m *MultiProviderManager) ValidateGitOpsConfig(platform *observabilityv1beta1.ObservabilityPlatform) error

ValidateGitOpsConfig validates GitOps configuration

type PromotionPolicy

type PromotionPolicy struct {
	// AutoPromotion enables automatic promotion
	AutoPromotion bool `json:"autoPromotion"`

	// RequiredTests that must pass
	RequiredTests []string `json:"requiredTests,omitempty"`

	// ApprovalRequired indicates if manual approval is needed
	ApprovalRequired bool `json:"approvalRequired"`

	// PromoteAfter duration to wait before promotion
	PromoteAfter string `json:"promoteAfter,omitempty"`
}

PromotionPolicy defines rules for environment promotion

type RollbackConfig

type RollbackConfig struct {
	// AutoRollback enables automatic rollback on failure
	AutoRollback bool `json:"autoRollback"`

	// FailureThreshold before triggering rollback
	FailureThreshold int `json:"failureThreshold"`

	// Window for detecting failures
	Window string `json:"window"`

	// MaxHistory to keep for rollback
	MaxHistory int `json:"maxHistory"`
}

RollbackConfig configures rollback behavior

type RollbackManager

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

RollbackManager handles automated rollback scenarios

func NewRollbackManager

func NewRollbackManager(client client.Client, scheme *runtime.Scheme, gitOpsManager GitOpsManager) *RollbackManager

NewRollbackManager creates a new rollback manager

func (*RollbackManager) CheckAndRollback

func (m *RollbackManager) CheckAndRollback(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform) error

CheckAndRollback checks if rollback is needed and performs it

func (*RollbackManager) RecordSuccessfulDeployment

func (m *RollbackManager) RecordSuccessfulDeployment(ctx context.Context, platform *observabilityv1beta1.ObservabilityPlatform, revision string) error

RecordSuccessfulDeployment records a successful deployment for future rollback

type SyncState

type SyncState string

SyncState represents the state of GitOps sync

const (
	// SyncStateSynced indicates resources are in sync
	SyncStateSynced SyncState = "Synced"
	// SyncStateOutOfSync indicates resources are out of sync
	SyncStateOutOfSync SyncState = "OutOfSync"
	// SyncStateSyncing indicates sync is in progress
	SyncStateSyncing SyncState = "Syncing"
	// SyncStateUnknown indicates unknown state
	SyncStateUnknown SyncState = "Unknown"
	// SyncStateError indicates sync error
	SyncStateError SyncState = "Error"
)

Jump to

Keyboard shortcuts

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