Documentation
¶
Index ¶
- func ApplyClusterWritePlan(plan *ClusterWritePlan) error
- func IsProtectedField(path string) bool
- func RenderScanResult(result *ImportScanResult, format string) ([]byte, error)
- func RepoHash(repoPath string) string
- func SelectApprovedFields(cluster ClusterImportResult) ([]FieldInferenceResult, []SkippedField)
- type ArtifactStore
- type ClusterImportResult
- type ClusterSources
- type ClusterWritePlan
- type ConfidenceLevel
- type DetectorRegistry
- type EvidenceRef
- type FieldConflict
- type FieldInferenceResult
- type FieldOrigin
- type ImportScanResult
- type ImportSummary
- type LiveSnapshot
- type NamespaceRegistry
- type PatchResult
- type SavedArtifact
- type Scanner
- type ServiceDetector
- type ServiceInferenceResult
- type SkippedField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyClusterWritePlan ¶
func ApplyClusterWritePlan(plan *ClusterWritePlan) error
func IsProtectedField ¶
func RenderScanResult ¶
func RenderScanResult(result *ImportScanResult, format string) ([]byte, error)
func SelectApprovedFields ¶
func SelectApprovedFields(cluster ClusterImportResult) ([]FieldInferenceResult, []SkippedField)
Types ¶
type ArtifactStore ¶
type ArtifactStore struct {
// contains filtered or unexported fields
}
func NewArtifactStore ¶
func NewArtifactStore() (*ArtifactStore, error)
func (*ArtifactStore) LoadLatest ¶
func (s *ArtifactStore) LoadLatest(repoPath string) (*SavedArtifact, error)
func (*ArtifactStore) Save ¶
func (s *ArtifactStore) Save(repoPath string, result *ImportScanResult, savedAt time.Time) (*SavedArtifact, error)
type ClusterImportResult ¶
type ClusterImportResult struct {
ClusterName string `json:"cluster_name"`
Organization string `json:"organization,omitempty"`
Sources ClusterSources `json:"sources"`
ProposedConfig *v2.Config `json:"proposed_config,omitempty"`
FieldResults []FieldInferenceResult `json:"field_results,omitempty"`
ServiceResults []ServiceInferenceResult `json:"service_results,omitempty"`
Conflicts []FieldConflict `json:"conflicts,omitempty"`
SkippedFields []SkippedField `json:"skipped_fields,omitempty"`
ExistingConfig string `json:"existing_config,omitempty"`
ProposedPatch string `json:"proposed_patch,omitempty"`
Warnings []string `json:"warnings,omitempty"`
Errors []string `json:"errors,omitempty"`
}
func BuildLiveImportResult ¶
type ClusterSources ¶
type ClusterSources struct {
RepoPath string `json:"repo_path"`
ClusterName string `json:"cluster_name"`
ClusterDir string `json:"cluster_dir,omitempty"`
OverlayDir string `json:"overlay_dir,omitempty"`
LegacyConfigPath string `json:"legacy_config_path,omitempty"`
ReadmePath string `json:"readme_path,omitempty"`
KubeconfigPaths []string `json:"kubeconfig_paths,omitempty"`
}
type ClusterWritePlan ¶
type ClusterWritePlan struct {
ClusterName string
Organization string
ConfigPath string
Create bool
ApprovedFields []FieldInferenceResult
SkippedFields []SkippedField
RenderedContent []byte
Diff string
}
func PrepareClusterWritePlan ¶
func PrepareClusterWritePlan(ctx context.Context, cluster ClusterImportResult) (*ClusterWritePlan, error)
type ConfidenceLevel ¶
type ConfidenceLevel string
const ( ConfidenceHigh ConfidenceLevel = "high" ConfidenceMedium ConfidenceLevel = "medium" ConfidenceLow ConfidenceLevel = "low" ConfidenceConflict ConfidenceLevel = "conflict" )
type DetectorRegistry ¶
type DetectorRegistry struct {
// contains filtered or unexported fields
}
func NewDetectorRegistry ¶
func NewDetectorRegistry() *DetectorRegistry
func (*DetectorRegistry) Detector ¶
func (r *DetectorRegistry) Detector(name string) ServiceDetector
func (*DetectorRegistry) Names ¶
func (r *DetectorRegistry) Names() []string
type EvidenceRef ¶
type FieldConflict ¶
type FieldConflict struct {
Path string `json:"path"`
GitOpsValue any `json:"gitops_value,omitempty"`
LiveValue any `json:"live_value,omitempty"`
Recommended string `json:"recommended,omitempty"`
Evidence []EvidenceRef `json:"evidence,omitempty"`
ProtectedField bool `json:"protected_field,omitempty"`
}
type FieldInferenceResult ¶
type FieldInferenceResult struct {
Path string `json:"path"`
Value any `json:"value,omitempty"`
Confidence ConfidenceLevel `json:"confidence"`
Origin FieldOrigin `json:"origin"`
Evidence []EvidenceRef `json:"evidence,omitempty"`
}
type FieldOrigin ¶
type FieldOrigin string
const ( FieldOriginGitOps FieldOrigin = "gitops" FieldOriginLive FieldOrigin = "live" FieldOriginDefault FieldOrigin = "default" FieldOriginManual FieldOrigin = "manual" )
type ImportScanResult ¶
type ImportScanResult struct {
RepoPath string `json:"repo_path"`
ScannedAt time.Time `json:"scanned_at"`
Clusters []ClusterImportResult `json:"clusters"`
Summary ImportSummary `json:"summary"`
Warnings []string `json:"warnings,omitempty"`
}
type ImportSummary ¶
type LiveSnapshot ¶
type LiveSnapshot struct {
KubernetesVersion string
MasterCount int
WorkerCount int
Namespaces map[string]struct{}
}
func CollectLiveSnapshot ¶
func CollectLiveSnapshot(ctx context.Context, kubeconfigPath string) (*LiveSnapshot, error)
type NamespaceRegistry ¶
type NamespaceRegistry struct {
// contains filtered or unexported fields
}
func NewNamespaceRegistry ¶
func NewNamespaceRegistry() *NamespaceRegistry
func (*NamespaceRegistry) ApplyOverrides ¶
func (r *NamespaceRegistry) ApplyOverrides(overrides []string) error
func (*NamespaceRegistry) NamespacesFor ¶
func (r *NamespaceRegistry) NamespacesFor(serviceName string) []string
type PatchResult ¶
func PatchYAMLFile ¶
func PatchYAMLFile(path string, updates []FieldInferenceResult) (*PatchResult, error)
type SavedArtifact ¶
type SavedArtifact struct {
RepoHash string `json:"repo_hash"`
Path string `json:"path"`
SavedAt time.Time `json:"saved_at"`
Result *ImportScanResult `json:"result,omitempty"`
}
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func NewScanner ¶
func NewScanner() *Scanner
func (*Scanner) ApplyNamespaceOverrides ¶
type ServiceDetector ¶
type ServiceDetector interface {
ServiceName() string
Detect(context.Context, *detectContext) ServiceInferenceResult
}
type ServiceInferenceResult ¶
type ServiceInferenceResult struct {
ServiceName string `json:"service_name"`
Namespaces []string `json:"namespaces,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
AdoptionMode *configservices.AdoptionMode `json:"adoption_mode,omitempty"`
Fields []FieldInferenceResult `json:"fields,omitempty"`
Conflicts []FieldConflict `json:"conflicts,omitempty"`
Skipped []SkippedField `json:"skipped,omitempty"`
}
type SkippedField ¶
type SkippedField struct {
Path string `json:"path"`
Reason string `json:"reason"`
Confidence ConfidenceLevel `json:"confidence,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.