v1

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package v1 provides configuration structures for Caproni v1 format. This package contains the original configuration format where repositories contained type, helm, mirror, and skaffold fields all in one structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaproniConfig

type CaproniConfig struct {
	Cluster      types.ClusterConfig                               `yaml:"cluster"`
	Repositories *orderedmap.OrderedMap[string, *RepositoryConfig] `yaml:"repositories"`

	// ConfigFile is the absolute path to the configuration file.
	// This field is populated by LoadCaproniConfig and is not part of the YAML.
	ConfigFile string `yaml:"-"`

	// ConfigDir is the absolute path to the directory containing the configuration file.
	// This field is populated by LoadCaproniConfig and is not part of the YAML.
	// Use this to resolve relative paths in repository configurations.
	ConfigDir string `yaml:"-"`
}

CaproniConfig is the root configuration for v1 format.

func (*CaproniConfig) AllRepositories

func (c *CaproniConfig) AllRepositories() iter.Seq2[string, *RepositoryConfig]

AllRepositories returns an iterator over all repositories. If Repositories is nil, returns an empty iterator.

func (*CaproniConfig) ApplyDefaults

func (c *CaproniConfig) ApplyDefaults() error

ApplyDefaults applies schema-defined defaults to optional fields.

func (*CaproniConfig) GetRepository

func (c *CaproniConfig) GetRepository(name string) (*RepositoryConfig, bool)

GetRepository retrieves a repository by name. Returns the repository config and true if found, or nil and false if not found or Repositories is nil.

func (*CaproniConfig) RepositoriesLen

func (c *CaproniConfig) RepositoriesLen() int

RepositoriesLen returns the number of repositories. If Repositories is nil, returns 0.

func (*CaproniConfig) ResolvePath

func (c *CaproniConfig) ResolvePath(path string) string

ResolvePath resolves a path relative to the configuration file directory. If the path is already absolute, it is returned unchanged. If the path is relative, it is resolved relative to ConfigDir.

type DynamicOverrideConfig

type DynamicOverrideConfig struct {
	Type             string `yaml:"type"`                         // Required: "gitlab_repo_version_files" or "release_manifest"
	GitLabSourceRepo string `yaml:"gitlab_source_repo,omitempty"` // Required if type=="gitlab_repo_version_files"
	VersionMap       string `yaml:"version_map,omitempty"`        // Required if type=="gitlab_repo_version_files"
}

DynamicOverrideConfig for dynamic value overrides. Conditional requirements based on type per schema.

type FilesystemConfig

type FilesystemConfig struct {
	ReadWrite []string `yaml:"read_write,omitempty"` // Optional: Regex patterns for read-write paths
	ReadOnly  []string `yaml:"read_only,omitempty"`  // Optional: Regex patterns for read-only paths
}

FilesystemConfig specifies filesystem mount configuration for remote filesystems.

type HelmConfig

type HelmConfig struct {
	Namespace        string                  `yaml:"namespace"` // Required
	ValuesFile       string                  `yaml:"values_file,omitempty"`
	DynamicOverrides []DynamicOverrideConfig `yaml:"dynamic_overrides,omitempty"`
	Repository       *HelmRepositoryConfig   `yaml:"repository,omitempty"` // Optional: for non-edit mode
	Release          *HelmReleaseConfig      `yaml:"release,omitempty"`    // Optional: for non-edit mode
}

HelmConfig for Helm chart repositories (namespace required per schema).

type HelmReleaseConfig

type HelmReleaseConfig struct {
	Name  string `yaml:"name"`  // Required: release name
	Chart string `yaml:"chart"` // Required: chart name (e.g., "gitlab/gitlab")
}

HelmReleaseConfig configures the Helm release for non-edit mode deployment.

type HelmRepositoryConfig

type HelmRepositoryConfig struct {
	Name string `yaml:"name"` // Required: name for helm repo add
	URL  string `yaml:"url"`  // Required: URL of the Helm repository
}

HelmRepositoryConfig configures a remote Helm repository for non-edit mode deployment.

type LifecycleHookConfig

type LifecycleHookConfig struct {
	Type         string `yaml:"type"` // Required: "edit_mode_prepare", "edit_mode_start", "edit_mode_stop", "edit_mode_shutdown"
	Script       string `yaml:"script,omitempty"`
	MirrorScript string `yaml:"mirror_script,omitempty"`
	Job          string `yaml:"job,omitempty"`
}

LifecycleHookConfig for lifecycle hooks. Must have exactly one of: script, mirror_script, or job (oneOf in schema).

type MirrorConfig

type MirrorConfig struct {
	Target            *MirrorTargetConfig                            `yaml:"target"`               // Required: Target resource configuration
	Filesystem        *FilesystemConfig                              `yaml:"filesystem,omitempty"` // Optional: Filesystem configuration
	EditModeProcesses *orderedmap.OrderedMap[string, *ProcessConfig] `yaml:"edit_mode_processes,omitempty"`
	LifecycleHooks    []LifecycleHookConfig                          `yaml:"lifecycle_hooks,omitempty"`
}

MirrorConfig for mirror repositories (target required per schema).

type MirrorTargetConfig

type MirrorTargetConfig struct {
	Namespace      string `yaml:"namespace"`       // Required: Kubernetes namespace
	KubernetesType string `yaml:"kubernetes_type"` // Required: "deployment", "statefulset", "daemonset", or "pod"
	Name           string `yaml:"name"`            // Required: Resource name
}

MirrorTargetConfig specifies the target Kubernetes resource for mirroring.

type ProcessConfig

type ProcessConfig struct {
	Command string `yaml:"command"`        // Required
	Port    int    `yaml:"port,omitempty"` // Optional (1-65535)
}

ProcessConfig for edit mode processes (command required per schema).

type RepositoryConfig

type RepositoryConfig struct {
	Repository string          `yaml:"repository"`          // Required (URI format)
	Directory  string          `yaml:"directory"`           // Required
	EditMode   bool            `yaml:"edit_mode,omitempty"` // Default: false
	Type       string          `yaml:"type"`                // Required: "helm", "mirror", "skaffold", or "mock"
	Clone      string          `yaml:"clone,omitempty"`     // Optional: "always" or "on-demand"
	Helm       *HelmConfig     `yaml:"helm,omitempty"`      // Required if type=="helm"
	Mirror     *MirrorConfig   `yaml:"mirror,omitempty"`    // Required if type=="mirror"
	Skaffold   *SkaffoldConfig `yaml:"skaffold,omitempty"`  // Required if type=="skaffold"
}

RepositoryConfig for each named repository (v1 format). Can be either helm, mirror, or skaffold type (oneOf in schema).

type SkaffoldConfig

type SkaffoldConfig struct {
	Namespace  string `yaml:"namespace"`   // Required: Kubernetes namespace
	ConfigFile string `yaml:"config_file"` // Required: Path to skaffold.yaml
}

SkaffoldConfig for skaffold repositories (namespace and config_file required per schema).

Jump to

Keyboard shortcuts

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