Documentation
¶
Overview ¶
Package gitops provides GitOps integration for the Gunj Operator
Package gitops provides GitOps integration for the Gunj Operator
Index ¶
- type ArgoCDAppConfig
- type ArgoCDManager
- func (m *ArgoCDManager) CreateOrUpdateApplication(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *ArgoCDManager) DeleteApplications(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
- func (m *ArgoCDManager) GetApplicationResources(ctx context.Context, appName string) ([]observabilityv1beta1.ResourceStatus, error)
- func (m *ArgoCDManager) GetHealthStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.HealthStatus, error)
- func (m *ArgoCDManager) GetSyncStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.SyncStatus, error)
- func (m *ArgoCDManager) SyncApplication(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *ArgoCDManager) UpdateApplicationSpec(ctx context.Context, appName string, ...) error
- type BackoffPolicy
- type DriftAction
- type DriftDetail
- type DriftDetectionConfig
- type DriftDetector
- type DriftResult
- type DriftStatus
- type DriftedResource
- type Environment
- type FileChange
- type FluxKustomizationConfig
- type FluxManager
- func (m *FluxManager) CreateOrUpdateKustomization(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *FluxManager) DeleteKustomizations(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
- func (m *FluxManager) GetHealthStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.HealthStatus, error)
- func (m *FluxManager) GetKustomizationResources(ctx context.Context, kustomizationName, namespace string) ([]observabilityv1beta1.ResourceStatus, error)
- func (m *FluxManager) GetSyncStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.SyncStatus, error)
- func (m *FluxManager) ReconcileKustomization(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *FluxManager) SuspendKustomization(ctx context.Context, kustomizationName, namespace string, suspend bool) error
- func (m *FluxManager) UpdateKustomizationSpec(ctx context.Context, kustomizationName, namespace string, ...) error
- type GitCredentials
- type GitOpsConfig
- type GitOpsController
- type GitOpsProvider
- type GitOpsStatus
- type GitRepository
- type GitSyncConfig
- type GitSyncManager
- func (m *GitSyncManager) CleanupSync(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
- func (m *GitSyncManager) GetLastSyncTime(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*time.Time, error)
- func (m *GitSyncManager) SetupSync(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *GitSyncManager) TriggerSync(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
- type GitSynchronizer
- type Manager
- func (m *Manager) DetectAndRemediateDrift(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) error
- func (m *Manager) HandleGitWebhook(ctx context.Context, event *WebhookEvent) error
- func (m *Manager) PromoteEnvironment(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, ...) error
- func (m *Manager) ReconcileGitOps(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) error
- func (m *Manager) RollbackDeployment(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, ...) error
- type MetricThreshold
- type PromotionConfig
- type PromotionEvent
- type PromotionManager
- func (m *PromotionManager) ApprovePromotion(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *PromotionManager) GetPromotionHistory(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) ([]PromotionRequest, error)
- func (m *PromotionManager) Promote(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *PromotionManager) RejectPromotion(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *PromotionManager) ShouldPromote(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) bool
- type PromotionPolicy
- type PromotionRequest
- type PromotionStatus
- type PromotionStrategy
- type PullRequest
- type PullRequestEvent
- type PushEvent
- type Release
- type ReleaseAsset
- type RetryPolicy
- type RevisionHistory
- type RollbackConfig
- type RollbackManager
- func (m *RollbackManager) GetRollbackStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (string, error)
- func (m *RollbackManager) Rollback(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
- func (m *RollbackManager) StoreRevisionMetrics(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, ...) error
- func (m *RollbackManager) ValidateRollback(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
- type RollbackSnapshot
- type RollbackTrigger
- type RollbackTriggerType
- type SecretReference
- type SyncPolicy
- type SyncStatus
- type TagEvent
- type WebhookConfig
- type WebhookEvent
- type WebhookEventType
- type WebhookFilters
- type WebhookHandler
- type WebhookProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgoCDAppConfig ¶
type ArgoCDAppConfig struct {
Name string
Project string
RepoURL string
Path string
TargetRevision string
DestinationServer string
DestinationNamespace string
SyncOptions []string
AutoSync bool
Values map[string]string
IgnoreDifferences []observabilityv1beta1.ResourceIgnoreDifferences
RetryPolicy *observabilityv1beta1.ArgoCDRetryPolicy
}
ArgoCDAppConfig represents ArgoCD application configuration
type ArgoCDManager ¶
type ArgoCDManager struct {
// contains filtered or unexported fields
}
ArgoCDManager manages ArgoCD applications
func NewArgoCDManager ¶
func NewArgoCDManager(client client.Client, log logr.Logger) *ArgoCDManager
NewArgoCDManager creates a new ArgoCD manager
func (*ArgoCDManager) CreateOrUpdateApplication ¶
func (m *ArgoCDManager) CreateOrUpdateApplication(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, config *ArgoCDAppConfig) error
CreateOrUpdateApplication creates or updates an ArgoCD application
func (*ArgoCDManager) DeleteApplications ¶
func (m *ArgoCDManager) DeleteApplications(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
DeleteApplications deletes all ArgoCD applications for a deployment
func (*ArgoCDManager) GetApplicationResources ¶
func (m *ArgoCDManager) GetApplicationResources(ctx context.Context, appName string) ([]observabilityv1beta1.ResourceStatus, error)
GetApplicationResources gets the resources managed by an ArgoCD application
func (*ArgoCDManager) GetHealthStatus ¶
func (m *ArgoCDManager) GetHealthStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.HealthStatus, error)
GetHealthStatus gets the health status of ArgoCD applications
func (*ArgoCDManager) GetSyncStatus ¶
func (m *ArgoCDManager) GetSyncStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.SyncStatus, error)
GetSyncStatus gets the sync status of ArgoCD applications
func (*ArgoCDManager) SyncApplication ¶
func (m *ArgoCDManager) SyncApplication(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, appName string) error
SyncApplication triggers a sync for an ArgoCD application
func (*ArgoCDManager) UpdateApplicationSpec ¶
func (m *ArgoCDManager) UpdateApplicationSpec(ctx context.Context, appName string, updateFunc func(spec map[string]interface{}) error) error
UpdateApplicationSpec updates the spec of an ArgoCD application
type BackoffPolicy ¶
type BackoffPolicy struct {
// Duration is the base duration
Duration metav1.Duration `json:"duration"`
// Factor is the multiplication factor
Factor int `json:"factor"`
// MaxDuration is the maximum duration
MaxDuration metav1.Duration `json:"maxDuration"`
}
BackoffPolicy defines backoff configuration
type DriftAction ¶
type DriftAction string
DriftAction defines actions to take on drift
const ( // DriftActionNotify only notifies about drift DriftActionNotify DriftAction = "notify" // DriftActionRemediate automatically remediates drift DriftActionRemediate DriftAction = "remediate" )
type DriftDetail ¶
type DriftDetail struct {
// Path is the field path
Path string
// Expected is the expected value
Expected interface{}
// Actual is the actual value
Actual interface{}
}
DriftDetail provides details about a drifted field
type DriftDetectionConfig ¶
type DriftDetectionConfig struct {
// Enabled enables drift detection
Enabled bool `json:"enabled"`
// Interval is the drift check interval
Interval metav1.Duration `json:"interval"`
// Action defines what to do when drift is detected
Action DriftAction `json:"action"`
// IgnoreFields lists fields to ignore during drift detection
IgnoreFields []string `json:"ignoreFields,omitempty"`
}
DriftDetectionConfig defines drift detection settings
type DriftDetector ¶
type DriftDetector interface {
// DetectDrift detects configuration drift
DetectDrift(ctx context.Context, expected, actual runtime.Object) (*DriftResult, error)
// Remediate remediates detected drift
Remediate(ctx context.Context, drift *DriftResult) error
}
DriftDetector defines the interface for drift detection
func NewDriftDetector ¶
NewDriftDetector creates a new drift detector
func (*DriftDetector) DetectDrift ¶
func (d *DriftDetector) DetectDrift(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.DriftStatus, error)
DetectDrift detects configuration drift in deployed resources
func (*DriftDetector) RemediateDrift ¶
func (d *DriftDetector) RemediateDrift(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, driftStatus *observabilityv1beta1.DriftStatus) error
RemediateDrift remediates detected drift
type DriftResult ¶
type DriftResult struct {
// HasDrift indicates if drift was detected
HasDrift bool
// DriftedFields lists fields with drift
DriftedFields map[string]DriftDetail
}
DriftResult represents drift detection result
type DriftStatus ¶
type DriftStatus struct {
// Detected indicates if drift was detected
Detected bool `json:"detected"`
// LastCheckTime is when drift was last checked
LastCheckTime *metav1.Time `json:"lastCheckTime,omitempty"`
// DriftedResources lists resources with drift
DriftedResources []DriftedResource `json:"driftedResources,omitempty"`
}
DriftStatus represents drift detection status
type DriftedResource ¶
type DriftedResource struct {
// Name is the resource name
Name string `json:"name"`
// Kind is the resource kind
Kind string `json:"kind"`
// Namespace is the resource namespace
Namespace string `json:"namespace,omitempty"`
// Fields lists drifted fields
Fields []string `json:"fields"`
}
DriftedResource represents a resource with drift
type Environment ¶
type Environment struct {
// Name is the environment name
Name string `json:"name"`
// Namespace is the target namespace
Namespace string `json:"namespace"`
// Branch is the Git branch for this environment
Branch string `json:"branch"`
// AutoPromote enables automatic promotion to next environment
AutoPromote bool `json:"autoPromote"`
// PromotionPolicy defines promotion requirements
PromotionPolicy *PromotionPolicy `json:"promotionPolicy,omitempty"`
}
Environment represents an environment in the promotion pipeline
type FileChange ¶
type FileChange struct {
// Path is the file path
Path string `json:"path"`
// Action is the change action (added, modified, deleted)
Action string `json:"action"`
// Additions is the number of lines added
Additions int `json:"additions"`
// Deletions is the number of lines deleted
Deletions int `json:"deletions"`
}
FileChange represents a file change in a commit
type FluxKustomizationConfig ¶
type FluxKustomizationConfig struct {
Name string
SourceRef string
Path string
TargetNamespace string
ServiceAccount string
Interval string
Timeout string
Prune bool
Values map[string]string
HealthChecks []observabilityv1beta1.FluxHealthCheck
}
FluxKustomizationConfig represents Flux Kustomization configuration
type FluxManager ¶
type FluxManager struct {
// contains filtered or unexported fields
}
FluxManager manages Flux Kustomizations
func NewFluxManager ¶
func NewFluxManager(client client.Client, log logr.Logger) *FluxManager
NewFluxManager creates a new Flux manager
func (*FluxManager) CreateOrUpdateKustomization ¶
func (m *FluxManager) CreateOrUpdateKustomization(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, config *FluxKustomizationConfig) error
CreateOrUpdateKustomization creates or updates a Flux Kustomization
func (*FluxManager) DeleteKustomizations ¶
func (m *FluxManager) DeleteKustomizations(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
DeleteKustomizations deletes all Flux Kustomizations for a deployment
func (*FluxManager) GetHealthStatus ¶
func (m *FluxManager) GetHealthStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.HealthStatus, error)
GetHealthStatus gets the health status of Flux Kustomizations
func (*FluxManager) GetKustomizationResources ¶
func (m *FluxManager) GetKustomizationResources(ctx context.Context, kustomizationName, namespace string) ([]observabilityv1beta1.ResourceStatus, error)
GetKustomizationResources gets the resources managed by a Flux Kustomization
func (*FluxManager) GetSyncStatus ¶
func (m *FluxManager) GetSyncStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*observabilityv1beta1.SyncStatus, error)
GetSyncStatus gets the sync status of Flux Kustomizations
func (*FluxManager) ReconcileKustomization ¶
func (m *FluxManager) ReconcileKustomization(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, kustomizationName string) error
ReconcileKustomization triggers a reconciliation for a Flux Kustomization
func (*FluxManager) SuspendKustomization ¶
func (m *FluxManager) SuspendKustomization(ctx context.Context, kustomizationName, namespace string, suspend bool) error
SuspendKustomization suspends a Flux Kustomization
func (*FluxManager) UpdateKustomizationSpec ¶
func (m *FluxManager) UpdateKustomizationSpec(ctx context.Context, kustomizationName, namespace string, updateFunc func(spec map[string]interface{}) error) error
UpdateKustomizationSpec updates the spec of a Flux Kustomization
type GitCredentials ¶
GitCredentials represents Git authentication credentials
type GitOpsConfig ¶
type GitOpsConfig struct {
// Provider specifies the GitOps provider (argocd or flux)
Provider GitOpsProvider `json:"provider"`
// Repository contains Git repository configuration
Repository GitRepository `json:"repository"`
// SyncPolicy defines how to sync resources
SyncPolicy SyncPolicy `json:"syncPolicy"`
// Promotion defines multi-environment promotion settings
Promotion *PromotionConfig `json:"promotion,omitempty"`
// Rollback defines rollback configuration
Rollback *RollbackConfig `json:"rollback,omitempty"`
// DriftDetection enables drift detection and remediation
DriftDetection *DriftDetectionConfig `json:"driftDetection,omitempty"`
}
GitOpsConfig represents GitOps configuration for a platform
type GitOpsController ¶
type GitOpsController interface {
// Reconcile reconciles GitOps state
Reconcile(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) error
// Sync synchronizes resources with Git
Sync(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) error
// GetStatus returns current GitOps status
GetStatus(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) (*GitOpsStatus, error)
// Rollback performs a rollback
Rollback(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, revision string) error
// Promote promotes to the next environment
Promote(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, targetEnv string) error
}
GitOpsController defines the interface for GitOps controllers
type GitOpsProvider ¶
type GitOpsProvider string
GitOpsProvider represents supported GitOps providers
const ( // ProviderArgoCD represents ArgoCD GitOps provider ProviderArgoCD GitOpsProvider = "argocd" // ProviderFlux represents Flux GitOps provider ProviderFlux GitOpsProvider = "flux" )
type GitOpsStatus ¶
type GitOpsStatus struct {
// Provider is the active GitOps provider
Provider GitOpsProvider `json:"provider"`
// SyncStatus represents current sync status
SyncStatus SyncStatus `json:"syncStatus"`
// LastSyncTime is when the last sync occurred
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"`
// LastSyncRevision is the last synced Git revision
LastSyncRevision string `json:"lastSyncRevision,omitempty"`
// DriftStatus represents drift detection status
DriftStatus *DriftStatus `json:"driftStatus,omitempty"`
// PromotionStatus represents promotion pipeline status
PromotionStatus *PromotionStatus `json:"promotionStatus,omitempty"`
// Conditions represents GitOps conditions
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
GitOpsStatus represents the status of GitOps integration
type GitRepository ¶
type GitRepository struct {
// URL is the Git repository URL
URL string `json:"url"`
// Branch is the Git branch to track
Branch string `json:"branch"`
// Path is the path within the repository
Path string `json:"path"`
// SecretRef references a secret containing Git credentials
SecretRef *SecretReference `json:"secretRef,omitempty"`
// Interval is the sync interval
Interval metav1.Duration `json:"interval,omitempty"`
}
GitRepository represents Git repository configuration
type GitSyncConfig ¶
type GitSyncConfig struct {
Repository string
Branch string
Path string
PollInterval string
Credentials *GitCredentials
WebhookURL string
}
GitSyncConfig represents Git synchronization configuration
type GitSyncManager ¶
type GitSyncManager struct {
// contains filtered or unexported fields
}
GitSyncManager manages Git repository synchronization
func NewGitSyncManager ¶
func NewGitSyncManager(client client.Client, log logr.Logger) *GitSyncManager
NewGitSyncManager creates a new Git sync manager
func (*GitSyncManager) CleanupSync ¶
func (m *GitSyncManager) CleanupSync(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
CleanupSync cleans up Git sync resources
func (*GitSyncManager) GetLastSyncTime ¶
func (m *GitSyncManager) GetLastSyncTime(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (*time.Time, error)
GetLastSyncTime gets the last successful sync time
func (*GitSyncManager) SetupSync ¶
func (m *GitSyncManager) SetupSync(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, config *GitSyncConfig) error
SetupSync sets up Git repository synchronization
func (*GitSyncManager) TriggerSync ¶
func (m *GitSyncManager) TriggerSync(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
TriggerSync triggers an immediate Git synchronization
type GitSynchronizer ¶
type GitSynchronizer interface {
// Clone clones a Git repository
Clone(ctx context.Context, repo GitRepository) (string, error)
// Pull pulls latest changes
Pull(ctx context.Context, repoPath string) error
// GetRevision gets current revision
GetRevision(ctx context.Context, repoPath string) (string, error)
// GetFiles gets files from repository
GetFiles(ctx context.Context, repoPath string, pattern string) ([]string, error)
// Cleanup cleans up cloned repository
Cleanup(ctx context.Context, repoPath string) error
}
GitSynchronizer defines the interface for Git synchronization
type Manager ¶
type Manager struct {
Client client.Client
Scheme *runtime.Scheme
Log logr.Logger
ArgoCDManager *argocd.Manager
FluxManager *flux.Manager
SyncManager *sync.Manager
RollbackMgr *rollback.Manager
DriftDetector *drift.Detector
}
Manager coordinates GitOps operations for ObservabilityPlatforms
func NewManager ¶
NewManager creates a new GitOps manager
func (*Manager) DetectAndRemediateDrift ¶
func (m *Manager) DetectAndRemediateDrift(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) error
DetectAndRemediateDrift checks for configuration drift
func (*Manager) HandleGitWebhook ¶
func (m *Manager) HandleGitWebhook(ctx context.Context, event *WebhookEvent) error
HandleGitWebhook processes Git webhook events
func (*Manager) PromoteEnvironment ¶
func (m *Manager) PromoteEnvironment(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, targetEnv string) error
PromoteEnvironment promotes a platform configuration to another environment
func (*Manager) ReconcileGitOps ¶
func (m *Manager) ReconcileGitOps(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) error
ReconcileGitOps ensures GitOps integration for a platform
func (*Manager) RollbackDeployment ¶
func (m *Manager) RollbackDeployment(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, reason string) error
RollbackDeployment rolls back a failed deployment
type MetricThreshold ¶
type MetricThreshold struct {
// Name is the metric name
Name string `json:"name"`
// Query is the PromQL query
Query string `json:"query"`
// Threshold is the threshold value
Threshold float64 `json:"threshold"`
// Operator is the comparison operator (>, <, >=, <=, ==)
Operator string `json:"operator"`
}
MetricThreshold defines a metric-based threshold
type PromotionConfig ¶
type PromotionConfig struct {
// Environments defines the promotion pipeline
Environments []Environment `json:"environments"`
// Strategy defines promotion strategy
Strategy PromotionStrategy `json:"strategy"`
// ApprovalRequired indicates if manual approval is needed
ApprovalRequired bool `json:"approvalRequired"`
}
PromotionConfig defines multi-environment promotion settings
type PromotionEvent ¶
type PromotionEvent struct {
// From is the source environment
From string `json:"from"`
// To is the target environment
To string `json:"to"`
// Time is when the promotion occurred
Time metav1.Time `json:"time"`
// Revision is the Git revision promoted
Revision string `json:"revision"`
// Status is the promotion status
Status string `json:"status"`
}
PromotionEvent represents a promotion event
type PromotionManager ¶
type PromotionManager interface {
// CanPromote checks if promotion is allowed
CanPromote(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, targetEnv string) (bool, error)
// Promote performs the promotion
Promote(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, targetEnv string) error
// GetPromotionHistory gets promotion history
GetPromotionHistory(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) ([]PromotionEvent, error)
}
PromotionManager defines the interface for managing promotions
func NewPromotionManager ¶
NewPromotionManager creates a new promotion manager
func (*PromotionManager) ApprovePromotion ¶
func (m *PromotionManager) ApprovePromotion(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, approvalName, approvedBy string) error
ApprovePromotion approves a pending promotion
func (*PromotionManager) GetPromotionHistory ¶
func (m *PromotionManager) GetPromotionHistory(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) ([]PromotionRequest, error)
GetPromotionHistory gets the promotion history for a deployment
func (*PromotionManager) Promote ¶
func (m *PromotionManager) Promote(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, env observabilityv1beta1.Environment) error
Promote promotes an environment to a new revision
func (*PromotionManager) RejectPromotion ¶
func (m *PromotionManager) RejectPromotion(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, approvalName, rejectedBy, reason string) error
RejectPromotion rejects a pending promotion
func (*PromotionManager) ShouldPromote ¶
func (m *PromotionManager) ShouldPromote(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, env observabilityv1beta1.Environment) bool
ShouldPromote checks if an environment should be promoted
type PromotionPolicy ¶
type PromotionPolicy struct {
// MinReplicaAvailability is the minimum replica availability percentage
MinReplicaAvailability int `json:"minReplicaAvailability"`
// HealthCheckDuration is how long to monitor health before promotion
HealthCheckDuration metav1.Duration `json:"healthCheckDuration"`
// MetricThresholds defines metric-based promotion gates
MetricThresholds []MetricThreshold `json:"metricThresholds,omitempty"`
}
PromotionPolicy defines promotion requirements
type PromotionRequest ¶
type PromotionRequest struct {
FromEnvironment string
ToEnvironment string
Revision string
RequestedBy string
ApprovedBy string
Status string
CreatedAt time.Time
CompletedAt *time.Time
Reason string
}
PromotionRequest represents a promotion request
type PromotionStatus ¶
type PromotionStatus struct {
// CurrentEnvironment is the current environment
CurrentEnvironment string `json:"currentEnvironment"`
// PromotionHistory lists recent promotions
PromotionHistory []PromotionEvent `json:"promotionHistory,omitempty"`
}
PromotionStatus represents promotion pipeline status
type PromotionStrategy ¶
type PromotionStrategy string
PromotionStrategy defines how promotions are performed
const ( // PromotionStrategyManual requires manual promotion PromotionStrategyManual PromotionStrategy = "manual" // PromotionStrategyAutomatic enables automatic promotion PromotionStrategyAutomatic PromotionStrategy = "automatic" // PromotionStrategyProgressive enables progressive rollout PromotionStrategyProgressive PromotionStrategy = "progressive" )
type PullRequest ¶
type PullRequest struct {
// Number is the PR number
Number int `json:"number"`
// Title is the PR title
Title string `json:"title"`
// Description is the PR description
Description string `json:"description"`
// State is the PR state (open, closed, merged)
State string `json:"state"`
// Action is the PR action (opened, closed, reopened, synchronize)
Action string `json:"action"`
// SourceBranch is the source branch
SourceBranch string `json:"source_branch"`
// TargetBranch is the target branch
TargetBranch string `json:"target_branch"`
// Author is the PR author
Author string `json:"author"`
// Labels are the PR labels
Labels []string `json:"labels"`
// Reviewers are the requested reviewers
Reviewers []string `json:"reviewers"`
// Approved indicates if the PR is approved
Approved bool `json:"approved"`
// MergeCommit is the merge commit SHA (if merged)
MergeCommit string `json:"merge_commit,omitempty"`
}
PullRequest represents pull request details
type PullRequestEvent ¶
type PullRequestEvent struct {
// Repository is the repository URL
Repository string `json:"repository"`
// Number is the PR number
Number int `json:"number"`
// Action is the PR action (opened, closed, merged)
Action string `json:"action"`
// SourceBranch is the source branch
SourceBranch string `json:"sourceBranch"`
// TargetBranch is the target branch
TargetBranch string `json:"targetBranch"`
}
PullRequestEvent represents a pull request event
type PushEvent ¶
type PushEvent struct {
// Repository is the repository URL
Repository string `json:"repository"`
// Branch is the branch name
Branch string `json:"branch"`
// Revision is the new revision
Revision string `json:"revision"`
// Author is the commit author
Author string `json:"author"`
// Message is the commit message
Message string `json:"message"`
// Timestamp is the push timestamp
Timestamp time.Time `json:"timestamp"`
}
PushEvent represents a Git push event
type Release ¶
type Release struct {
// Name is the release name
Name string `json:"name"`
// Tag is the release tag
Tag string `json:"tag"`
// Description is the release description
Description string `json:"description"`
// Prerelease indicates if this is a pre-release
Prerelease bool `json:"prerelease"`
// Draft indicates if this is a draft
Draft bool `json:"draft"`
// Assets are the release assets
Assets []ReleaseAsset `json:"assets,omitempty"`
}
Release represents a release event
type ReleaseAsset ¶
type ReleaseAsset struct {
// Name is the asset name
Name string `json:"name"`
// URL is the download URL
URL string `json:"url"`
// Size is the asset size in bytes
Size int64 `json:"size"`
// ContentType is the MIME type
ContentType string `json:"content_type"`
}
ReleaseAsset represents a release asset
type RetryPolicy ¶
type RetryPolicy struct {
// Limit is the maximum number of retries
Limit int `json:"limit"`
// Backoff defines backoff strategy
Backoff *BackoffPolicy `json:"backoff,omitempty"`
}
RetryPolicy defines retry configuration
type RevisionHistory ¶
type RevisionHistory struct {
Revision string
DeployTime time.Time
Status string
Health string
Environment string
Metrics map[string]float64
}
RevisionHistory represents a deployment revision
type RollbackConfig ¶
type RollbackConfig struct {
// Enabled enables automatic rollback
Enabled bool `json:"enabled"`
// MaxHistory is the maximum number of rollback points to keep
MaxHistory int `json:"maxHistory"`
// Triggers defines rollback triggers
Triggers []RollbackTrigger `json:"triggers"`
}
RollbackConfig defines rollback configuration
type RollbackManager ¶
type RollbackManager interface {
// CreateSnapshot creates a rollback snapshot
CreateSnapshot(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) error
// ListSnapshots lists available snapshots
ListSnapshots(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) ([]RollbackSnapshot, error)
// Rollback performs a rollback to a snapshot
Rollback(ctx context.Context, platform *observabilityv1.ObservabilityPlatform, snapshotID string) error
// ShouldRollback checks if rollback should be triggered
ShouldRollback(ctx context.Context, platform *observabilityv1.ObservabilityPlatform) (bool, string, error)
}
RollbackManager defines the interface for managing rollbacks
func NewRollbackManager ¶
NewRollbackManager creates a new rollback manager
func (*RollbackManager) GetRollbackStatus ¶
func (m *RollbackManager) GetRollbackStatus(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) (string, error)
GetRollbackStatus gets the status of a rollback operation
func (*RollbackManager) Rollback ¶
func (m *RollbackManager) Rollback(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
Rollback performs a rollback to a previous revision
func (*RollbackManager) StoreRevisionMetrics ¶
func (m *RollbackManager) StoreRevisionMetrics(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment, revision string, metrics map[string]float64) error
StoreRevisionMetrics stores metrics for a revision
func (*RollbackManager) ValidateRollback ¶
func (m *RollbackManager) ValidateRollback(ctx context.Context, deployment *observabilityv1beta1.GitOpsDeployment) error
ValidateRollback validates if a rollback can be performed
type RollbackSnapshot ¶
type RollbackSnapshot struct {
// ID is the snapshot ID
ID string `json:"id"`
// Revision is the Git revision
Revision string `json:"revision"`
// Timestamp is when the snapshot was created
Timestamp metav1.Time `json:"timestamp"`
// Platform is the platform configuration
Platform *observabilityv1.ObservabilityPlatform `json:"platform"`
// Status is the platform status at snapshot time
Status observabilityv1.ObservabilityPlatformStatus `json:"status"`
}
RollbackSnapshot represents a rollback point
type RollbackTrigger ¶
type RollbackTrigger struct {
// Type is the trigger type
Type RollbackTriggerType `json:"type"`
// Threshold is the threshold for the trigger
Threshold string `json:"threshold"`
// Duration is how long the condition must persist
Duration metav1.Duration `json:"duration"`
}
RollbackTrigger defines when to trigger a rollback
type RollbackTriggerType ¶
type RollbackTriggerType string
RollbackTriggerType defines types of rollback triggers
const ( // RollbackTriggerTypeHealthCheck triggers on health check failure RollbackTriggerTypeHealthCheck RollbackTriggerType = "healthCheck" // RollbackTriggerTypeMetric triggers on metric threshold RollbackTriggerTypeMetric RollbackTriggerType = "metric" // RollbackTriggerTypeError triggers on error rate RollbackTriggerTypeError RollbackTriggerType = "error" )
type SecretReference ¶
type SecretReference struct {
// Name is the secret name
Name string `json:"name"`
// Namespace is the secret namespace
Namespace string `json:"namespace,omitempty"`
}
SecretReference references a Kubernetes secret
type SyncPolicy ¶
type SyncPolicy struct {
// Automated enables automated sync
Automated bool `json:"automated"`
// Prune enables resource pruning
Prune bool `json:"prune"`
// SelfHeal enables automatic remediation
SelfHeal bool `json:"selfHeal"`
// Retry defines retry configuration
Retry *RetryPolicy `json:"retry,omitempty"`
// SyncOptions provides additional sync options
SyncOptions []string `json:"syncOptions,omitempty"`
}
SyncPolicy defines synchronization policy
type SyncStatus ¶
type SyncStatus string
SyncStatus represents synchronization status
const ( // SyncStatusSynced indicates resources are synced SyncStatusSynced SyncStatus = "Synced" // SyncStatusOutOfSync indicates resources are out of sync SyncStatusOutOfSync SyncStatus = "OutOfSync" // SyncStatusSyncing indicates sync is in progress SyncStatusSyncing SyncStatus = "Syncing" // SyncStatusUnknown indicates unknown sync status SyncStatusUnknown SyncStatus = "Unknown" )
type TagEvent ¶
type TagEvent struct {
// Repository is the repository URL
Repository string `json:"repository"`
// Tag is the tag name
Tag string `json:"tag"`
// Revision is the tagged revision
Revision string `json:"revision"`
// Message is the tag message
Message string `json:"message"`
}
TagEvent represents a Git tag event
type WebhookConfig ¶
type WebhookConfig struct {
// Provider is the webhook provider
Provider WebhookProvider `json:"provider"`
// Secret is the webhook secret for validation
Secret string `json:"secret"`
// Events are the events to listen for
Events []WebhookEventType `json:"events"`
// Filters are optional event filters
Filters *WebhookFilters `json:"filters,omitempty"`
}
WebhookConfig represents webhook configuration
type WebhookEvent ¶
type WebhookEvent struct {
// Type is the type of event
Type WebhookEventType `json:"type"`
// Repository is the Git repository URL
Repository string `json:"repository"`
// Branch is the branch name (for push events)
Branch string `json:"branch,omitempty"`
// Tag is the tag name (for tag events)
Tag string `json:"tag,omitempty"`
// Commit is the commit SHA
Commit string `json:"commit,omitempty"`
// Author is the author of the change
Author string `json:"author,omitempty"`
// Message is the commit/tag message
Message string `json:"message,omitempty"`
// Timestamp is when the event occurred
Timestamp time.Time `json:"timestamp"`
// PullRequest contains PR details
PullRequest *PullRequest `json:"pull_request,omitempty"`
// Release contains release details
Release *Release `json:"release,omitempty"`
// Changes contains file changes
Changes []FileChange `json:"changes,omitempty"`
}
WebhookEvent represents a Git webhook event
type WebhookEventType ¶
type WebhookEventType string
WebhookEventType represents the type of Git webhook event
const ( // WebhookEventPush represents a git push event WebhookEventPush WebhookEventType = "push" // WebhookEventPullRequest represents a pull request event WebhookEventPullRequest WebhookEventType = "pull_request" // WebhookEventTag represents a tag event WebhookEventTag WebhookEventType = "tag" // WebhookEventRelease represents a release event WebhookEventRelease WebhookEventType = "release" )
type WebhookFilters ¶
type WebhookFilters struct {
// Branches to include
Branches []string `json:"branches,omitempty"`
// Tags to include (supports patterns)
Tags []string `json:"tags,omitempty"`
// Paths to watch (supports patterns)
Paths []string `json:"paths,omitempty"`
// ExcludePaths to ignore
ExcludePaths []string `json:"exclude_paths,omitempty"`
// Authors to include
Authors []string `json:"authors,omitempty"`
// Labels required on PRs
Labels []string `json:"labels,omitempty"`
}
WebhookFilters represents webhook event filters
type WebhookHandler ¶
type WebhookHandler interface {
// HandlePush handles push events
HandlePush(ctx context.Context, event PushEvent) error
// HandlePullRequest handles pull request events
HandlePullRequest(ctx context.Context, event PullRequestEvent) error
// HandleTag handles tag events
HandleTag(ctx context.Context, event TagEvent) error
}
WebhookHandler defines the interface for handling Git webhooks
type WebhookProvider ¶
type WebhookProvider string
WebhookProvider represents a Git webhook provider
const ( // WebhookProviderGitHub represents GitHub webhooks WebhookProviderGitHub WebhookProvider = "github" // WebhookProviderGitLab represents GitLab webhooks WebhookProviderGitLab WebhookProvider = "gitlab" // WebhookProviderBitbucket represents Bitbucket webhooks WebhookProviderBitbucket WebhookProvider = "bitbucket" // WebhookProviderGitea represents Gitea webhooks WebhookProviderGitea WebhookProvider = "gitea" )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package argocd provides ArgoCD integration for GitOps
|
Package argocd provides ArgoCD integration for GitOps |
|
Package flux provides Flux integration for GitOps
|
Package flux provides Flux integration for GitOps |
|
Package sync provides Git synchronization functionality
|
Package sync provides Git synchronization functionality |