Documentation
¶
Overview ¶
pkg/merger/file.go
pkg/merger/file_auth.go
pkg/merger/helm.go
pkg/merger/helper.go
pkg/merger/merger.go
Package merger resolves and merges Katalog and Komposer YAML files into a single unified CRD map that the Katalog runtime consumes. It is the ingestion layer between raw YAML on disk (or remote sources) and the operator's live configuration.
Entry point: New(paths...).Merge() — call once; query with Enabled, All, ToSpec, ToSecurity, ToNotification, and ToProviders.
See README.md for merge rules, source-loading order, and top-level field accumulation semantics.
pkg/merger/parse.go
pkg/merger/registry.go
pkg/merger/registry_v2.go
Index ¶
- Variables
- func ExportedGitHubRawURL(repoURL, ref, filePath string) string
- func ExportedGitLabRawURL(repoURL, ref, filePath string) string
- func ExportedIsGitHubURL(u string) bool
- func ExportedIsGitLabURL(u string) bool
- func ExportedLoadRegistrySource(m *Merger, src orktypes.RegistrySource) (map[string]orktypes.CRDEntry, error)
- func ExportedValidatePatternStructure(dir, url, version string) error
- type Merger
- func (m *Merger) APIMetadata() apiMetadata
- func (m *Merger) Add(paths ...string) *Merger
- func (m *Merger) All() map[string]orktypes.CRDEntry
- func (m *Merger) Count() int
- func (m *Merger) Enabled() map[string]orktypes.CRDEntry
- func (m *Merger) EnabledCount() int
- func (m *Merger) Get(name string) (orktypes.CRDEntry, bool)
- func (m *Merger) GetRegistryURL() string
- func (m *Merger) Merge() error
- func (m *Merger) SetRegistryURL(url string)
- func (m *Merger) ToNotification() *orktypes.KatalogNotification
- func (m *Merger) ToProviders() []orktypes.KatalogProviderRequirement
- func (m *Merger) ToSecurity() orktypes.KatalogSecurity
- func (m *Merger) ToSpec() orktypes.KatalogSpec
- func (m *Merger) ToUI() *orktypes.KatalogForUI
Constants ¶
This section is empty.
Variables ¶
var ParseKatalogDoc = parseKatalogDoc
Export
Functions ¶
func ExportedGitHubRawURL ¶
Exported for tests
func ExportedGitLabRawURL ¶
Exported for tests
func ExportedLoadRegistrySource ¶
func ExportedLoadRegistrySource(m *Merger, src orktypes.RegistrySource) (map[string]orktypes.CRDEntry, error)
ExportedLoadRegistrySource loads from the deprecated catalog-map registry protocol (sources.registry with katalog: map[string]RegistryRef). Tests that verify catalog-map-based registry loading use this export.
func ExportedValidatePatternStructure ¶
ExportedValidatePatternStructure
Types ¶
type Merger ¶
type Merger struct {
// contains filtered or unexported fields
}
Merger loads one or more Katalog files, resolves their sources (files, URLs, Helm charts), merges all CRD entries, and exposes the result through Enabled(), All(), and Get().
Entry point: one or more file paths from the CLI or konstructOrkestra. Everything else — source resolution, Helm rendering, deduplication — is internal to the merger.
Merge rules:
- Sources within a Katalog are loaded before spec.crds
- Inline spec.crds win on name conflict (local overrides remote)
- Duplicate names across independent Katalog files are errors
- disabled CRDs are preserved and filtered by Enabled()
func New ¶
New creates a Merger with the given entry point file paths or URLs. Accepts one or more paths — the same as passing --katalog multiple times or comma separated.
func (*Merger) APIMetadata ¶
func (m *Merger) APIMetadata() apiMetadata
APIMetadata returns the merged result as a KatalogMeta with apiversion and kind.
func (*Merger) Add ¶
Add appends additional entry point paths after construction. Returns the Merger for chaining.
func (*Merger) EnabledCount ¶
EnabledCount returns the number of enabled CRDs.
func (*Merger) GetRegistryURL ¶
func (*Merger) Merge ¶
Merge loads all entry points and their declared sources, resolves Helm charts, and produces a single deduplicated CRD map. Safe to call multiple times — re-merges on each call.
func (*Merger) SetRegistryURL ¶
func (*Merger) ToNotification ¶ added in v0.2.5
func (m *Merger) ToNotification() *orktypes.KatalogNotification
ToNotification returns the merged notification configuration of the merged result. When a Komposer references multiple source Katalogs, teams from all sources are merged — source teams are inherited and the Komposer's own teams win on conflict. Used by KomposeKatalogFromYaml to populate Katalog.Notification.
func (*Merger) ToProviders ¶
func (m *Merger) ToProviders() []orktypes.KatalogProviderRequirement
ToProviders returns the top-level provider requirements of the merged result. Used by KomposeKatalogFromYaml to populate Katalog.Providers.
func (*Merger) ToSecurity ¶
func (m *Merger) ToSecurity() orktypes.KatalogSecurity
ToSecurity returns the security config of the merged result as a KatalogSecurity Used by NewKatalog consume the merged result.
func (*Merger) ToSpec ¶
func (m *Merger) ToSpec() orktypes.KatalogSpec
ToSpec returns the merged result as a KatalogSpec. Used by NewKatalog and generate.Registry to consume the merged result.
func (*Merger) ToUI ¶
func (m *Merger) ToUI() *orktypes.KatalogForUI
ToUI returns a UI-friendly representation of the merged Katalog. This method extracts only the fields needed for display in the Control Center:
- API version and kind (always "Katalog" at runtime)
- Metadata (name, description, version, author, license)
- All merged CRD definitions
Internal fields (Scheme, GroupVersionKind, etc.) are excluded because they have `yaml:"-" json:"-"` tags and won't be serialized to JSON.
This method is used by the /katalog/raw endpoint to provide a clean, readable view of the Katalog that created the current operator.