Documentation
¶
Index ¶
- Variables
- func CheckAge(encryptionBackend string, ageKeyFile string) error
- func CheckArgoCDSync(ctx context.Context, client k8s.ClientInterface) (int, int, error)
- func CheckFilePermissions(filePath string, isSecret bool) error
- func CheckGitCrypt(encryptionBackend string) error
- func CheckHelm() error
- func CheckKubectlAvailable(strict bool) error
- func CheckKubectlClusterAccess() error
- func CheckKubectlClusterAccessWithConfig(kubeconfig, kubeContext string) error
- func CheckSOPS(encryptionBackend string) error
- func CheckSSHKey(keyPath string) error
- func Execute()
- func PreflightChecks(encryption, ageKeyFile string, verbose bool, requireKubectl bool) error
- func PrintHealthStatus(status *HealthStatus)
- func WrapNonZeroExitError(command string, err error) error
- type ApplicationReport
- type ArgoCDAppInfo
- type BootstrapReport
- type ComponentHealth
- type ComponentInfo
- type ConfigReport
- type HealthCheckResult
- type HealthReport
- type HealthStatus
- type HelmReleaseReport
- type InfoResult
- type Logger
- type NamespaceReport
- type ResourceReport
- type SecretReport
- type StageLog
- type StageLogger
- type StageReport
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "unknown" Date = "unknown" )
These variables are populated at build time via -ldflags. Defaults are for local dev builds (go run / go build).
Functions ¶
func CheckArgoCDSync ¶
CheckArgoCDSync checks if ArgoCD applications are syncing
func CheckFilePermissions ¶
CheckFilePermissions verifies that critical files have proper permissions.
func CheckGitCrypt ¶
CheckGitCrypt verifies that git-crypt is installed (if using git-crypt encryption).
func CheckKubectlAvailable ¶
CheckKubectlAvailable verifies that kubectl is installed and accessible. Returns nil if kubectl is available, but only logs a warning if not available (unless strict mode is enabled).
func CheckKubectlClusterAccess ¶
func CheckKubectlClusterAccess() error
CheckKubectlClusterAccess verifies that kubectl can connect to the cluster. This checks if the current context is valid and accessible.
func CheckKubectlClusterAccessWithConfig ¶
CheckKubectlClusterAccessWithConfig verifies that kubectl can connect to the cluster using the provided kubeconfig and context.
func CheckSOPS ¶
CheckSOPS verifies that sops is installed and accessible (if using SOPS encryption).
func CheckSSHKey ¶
CheckSSHKey verifies that SSH key file is readable and has proper permissions.
func PreflightChecks ¶
PreflightChecks performs all prerequisite checks before bootstrap. strict mode is enabled when --wait-for-health is true, requiring kubectl cluster access.
func PrintHealthStatus ¶
func PrintHealthStatus(status *HealthStatus)
PrintHealthStatus prints the health check results in a formatted way
func WrapNonZeroExitError ¶
WrapNonZeroExitError wraps errors from external commands with context.
Types ¶
type ApplicationReport ¶
type ApplicationReport struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Created bool `json:"created"` // true = created, false = updated
}
ApplicationReport captures ArgoCD Application info.
type ArgoCDAppInfo ¶
type ArgoCDAppInfo struct {
Name string
Namespace string
SyncStatus string
HealthStatus string
Destination string
RepoURL string
Path string
SyncWave string
}
ArgoCDAppInfo holds ArgoCD Application information
type BootstrapReport ¶
type BootstrapReport struct {
Environment string `json:"environment"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration string `json:"duration"`
DurationMs int64 `json:"duration_ms"`
Success bool `json:"success"`
Stages []StageReport `json:"stages"`
Resources ResourceReport `json:"resources"`
Health *HealthReport `json:"health,omitempty"`
Configuration ConfigReport `json:"configuration"`
Error string `json:"error,omitempty"`
}
BootstrapReport captures the complete state and metrics of a bootstrap operation.
func NewBootstrapReport ¶
func NewBootstrapReport(env string) *BootstrapReport
NewBootstrapReport creates a new bootstrap report.
func (*BootstrapReport) AddStage ¶
func (r *BootstrapReport) AddStage(stage StageReport)
AddStage adds a completed stage to the report.
func (*BootstrapReport) Complete ¶
func (r *BootstrapReport) Complete(success bool, err error)
Complete finalizes the report with end time and duration.
func (*BootstrapReport) PrintSummary ¶
func (r *BootstrapReport) PrintSummary()
PrintSummary prints a human-readable summary of the report.
func (*BootstrapReport) ToJSON ¶
func (r *BootstrapReport) ToJSON() (string, error)
ToJSON serializes the report to JSON.
func (*BootstrapReport) WriteToFile ¶
func (r *BootstrapReport) WriteToFile(path string) error
WriteToFile writes the report to a file in JSON format.
type ComponentHealth ¶
type ComponentHealth struct {
Name string `json:"name"`
Status string `json:"status"` // Ready, NotReady, NotInstalled, Unknown
}
ComponentHealth captures individual component health status.
type ComponentInfo ¶
type ComponentInfo struct {
Name string
Namespace string
Installed bool
Status string
ReadyReplicas int
DesiredReplicas int
Version string
SyncWave string
Message string
}
ComponentInfo holds information about a component
type ConfigReport ¶
type ConfigReport struct {
BaseDir string `json:"base_dir"`
AppPath string `json:"app_path"`
Encryption string `json:"encryption"`
SecretsFile string `json:"secrets_file"`
Kubeconfig string `json:"kubeconfig,omitempty"`
Context string `json:"context,omitempty"`
DryRun bool `json:"dry_run"`
SkipArgoCDInstall bool `json:"skip_argocd_install"`
WaitForHealth bool `json:"wait_for_health"`
}
ConfigReport captures configuration used for bootstrap.
type HealthCheckResult ¶
type HealthCheckResult struct {
Component string
Status string
Message string
Duration time.Duration
}
HealthCheckResult holds the result of a health check
type HealthReport ¶
type HealthReport struct {
Checked bool `json:"checked"`
Healthy bool `json:"healthy"`
Components []ComponentHealth `json:"components"`
Timeout int `json:"timeout_seconds"`
}
HealthReport captures post-bootstrap health check results.
type HealthStatus ¶
type HealthStatus struct {
Healthy bool
StartTime time.Time
EndTime time.Time
Results []HealthCheckResult
CheckedAt time.Time
Environment string
}
HealthStatus represents overall health
func WaitForHealth ¶
func WaitForHealth(ctx context.Context, kubeconfig, kubeContext, environment string, timeoutSecs int) (*HealthStatus, error)
WaitForHealth waits for critical components to be ready after bootstrap. Timeout is in seconds. Returns detailed health status and any errors.
type HelmReleaseReport ¶
type HelmReleaseReport struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Installed bool `json:"installed"` // true = installed, false = upgraded
Skipped bool `json:"skipped"`
}
HelmReleaseReport captures Helm release info.
type InfoResult ¶
type InfoResult struct {
Environment string
ClusterVersion string
ArgoCDVersion string
Components []ComponentInfo
Applications []ArgoCDAppInfo
Health *HealthStatus
Timestamp time.Time
}
InfoResult holds bootstrap status information
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides structured logging with optional timestamp support.
func (*Logger) GetStageSummary ¶
GetStageSummary returns a summary of all stages with timings.
func (*Logger) PrintStageSummary ¶
func (l *Logger) PrintStageSummary()
PrintStageSummary prints the stage summary if verbose is enabled.
func (*Logger) Stage ¶
func (l *Logger) Stage(name string) *StageLogger
Stage starts logging a new stage.
type NamespaceReport ¶
NamespaceReport captures namespace creation info.
type ResourceReport ¶
type ResourceReport struct {
Namespace NamespaceReport `json:"namespace"`
Secrets []SecretReport `json:"secrets"`
ArgoCDRelease HelmReleaseReport `json:"argocd_release"`
AppOfApps ApplicationReport `json:"app_of_apps"`
}
ResourceReport captures information about created/updated resources.
type SecretReport ¶
type SecretReport struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Created bool `json:"created"` // true = created, false = updated
}
SecretReport captures secret creation/update info.
type StageLogger ¶
type StageLogger struct {
// contains filtered or unexported fields
}
StageLogger is a helper for logging a single stage.
func (*StageLogger) Detail ¶
func (s *StageLogger) Detail(format string, args ...interface{})
Detail adds a detail line to the current stage.
func (*StageLogger) Done ¶
func (s *StageLogger) Done()
Done marks the stage as complete and records its duration.
func (*StageLogger) SecretDetail ¶
func (s *StageLogger) SecretDetail(operation, secretName, namespace string)
SecretDetail logs a secret-related operation without exposing values.
type StageReport ¶
type StageReport struct {
Name string `json:"name"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration string `json:"duration"`
DurationMs int64 `json:"duration_ms"`
Success bool `json:"success"`
Details []string `json:"details,omitempty"`
Error string `json:"error,omitempty"`
}
StageReport captures metrics for a single bootstrap stage.