configuration

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package configuration contains structs to accommodate configuration on the application level as well as validation functionality.

Index

Constants

View Source
const (
	EnvBaseConfigPathKey    = "CONFIG_PATH"
	EnvImporterNamespaceKey = "IMPORTER_NAMESPACE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// ExporterHost configures the FQDN under which the exporter will be available for CES data export. The importer
	// will contact the exporter API which returns all required data like data paths etc.
	// The exporter API endpoint is fixed and will be routed on exporter side. This value is required.
	ExporterHost string `yaml:"host"`
	// ExporterApiKey contains the API key to authenticate against the source system's exporter system info endpoint.
	// This value is required.
	ExporterApiKey string `yaml:"apiKey"`
	// SkipTLSVerify controls whether to skip check the server's certificate
	SkipTLSVerify bool `yaml:"skipTLSVerify"`
}

API contains the configuration data for the API connection to the source system.

type ConfigTypes

type ConfigTypes interface {
	API | Logging | Migration | JobContainer | JobConfig | SSH | Smtp
}

type ContainerImage

type ContainerImage struct {
	// Registry specifies the container registry to pull the image from
	Registry string `yaml:"registry"`
	// Repository specifies the image repository
	Repository string `yaml:"repository"`
	// Tag specifies the image version tag
	Tag string `yaml:"tag"`
}

ContainerImage contains the container image information

type Coordinator

type Coordinator struct {
	Logging
	API
	Migration
	SSH
	JobConfig
	JobContainer
	Smtp

	// Namespace contains the k8s namespace in which the importer Cloudogu EcoSystem is running., f. i.
	// "ecosystem". This value is required but inferred from the used Helm chart.
	Namespace string
}

Coordinator consists of configuration data. The most fields are obtained from the Helm chart values file through a configmap, while others are hardcoded or obtained from secrets.

func ReadCoordinatorConfig

func ReadCoordinatorConfig() (Coordinator, error)

type ExcludePattern

type ExcludePattern struct {
	// DoguName specifies the name of the dogu for which the files should not be synchronized.
	DoguName string `yaml:"dogu"`
	// Pattern specifies the file pattern for the excluded files.
	Pattern string `yaml:"pattern"`
}

ExcludePattern defines a pattern for files that should not be synchronized for a specific dogu

type ImagePullSecret

type ImagePullSecret struct {
	Name string `yaml:"name"`
}

ImagePullSecret contains the name of a secret used for pulling images from private registries

type Job

type Job struct {
	Logging
	API
	SSH
	JobConfig

	// Namespace contains the k8s namespace in which the importer Cloudogu EcoSystem is running., f. i.
	// "ecosystem". This value is required but inferred from the used Helm chart.
	Namespace string
}

Job consists of configuration data. The most fields are obtained from the Helm chart values file through the YAML files.

func ReadJobConfig

func ReadJobConfig() (Job, error)

type JobConfig

type JobConfig struct {
	// DoguVolumeBasePath specifies the base path for the Dogu volumes mounted in the job.
	DoguVolumeBasePath string `yaml:"doguVolumeBasePath"`
	// Exclude specifies a list of dogus for which specific files should not be synchronized.
	Exclude []ExcludePattern `yaml:"exclude"`
	// Verbose makes the sync process log in verbose mode
	Verbose bool `yaml:"verbose"`
}

JobConfig contains the configuration data for the job container.

type JobContainer

type JobContainer struct {
	// JobConfigMap specifies the name of the configmap containing the job configuration.
	JobConfigMap string `yaml:"jobConfigMap"`
	// JobServiceAccount specifies the Kubernetes service account to be used for running the migration job pod.
	JobServiceAccount string `yaml:"jobServiceAccount"`
	// Image contains the container image information
	Image ContainerImage `yaml:"image"`
	// ImagePullPolicy defines when the kubelet should pull the image (Always, IfNotPresent, Never)
	ImagePullPolicy string `yaml:"imagePullPolicy"`
	// ImagePullSecrets contains names of secrets used for pulling the image from private registries
	ImagePullSecrets []ImagePullSecret `yaml:"imagePullSecrets"`
	// Resources defines the compute resources required by the container
	Resources ResourceRequirements `yaml:"resources"`
}

JobContainer defines the configuration for the container that runs migration jobs. It includes image details, pull policy, secrets, and resource requirements.

type Logging

type Logging struct {
	// Level manages to granularity of log output. Values are (all in uppercase) in decreasing verbosity:
	// DEBUG, INFO, WARN, ERROR
	Level string `yaml:"level"`
}

Logging contains the configuration data for the logging.

type MaintenanceModeMessage

type MaintenanceModeMessage struct {
	// Title to be shown in the maintenance mode message.
	Title string `yaml:"title"`
	// Text to be shown in the maintenance mode message.
	Text string `yaml:"text"`
}

MaintenanceModeMessage is the message to be shown at the source system when the maintenance mode gets activated.

type Migration

type Migration struct {
	// RegularCron triggers recurring migration jobs while the whole source system is running.
	// Uses CRON notation f. e. "0 4 * * *"
	// This value is required.
	RegularCron string `yaml:"regularSchedule"`
	// FinalTimestamp triggers the finishing migration job while the source system is supposed to be void of
	// active users.
	// Uses RFC 3339 notation f. e. "2025-04-03 12:34:56Z"
	// This value is optional, but a final migration without this value will then be impossible.
	FinalTimestamp string `yaml:"finalSchedule"`
	// ChangeFQDN triggers a fqdn change.
	// The certificates and the fqdn get migrated from the exporter to the import site.
	// This is only taken into account when the job runs as final migration.
	// Default: False
	ChangeFQDN bool `yaml:"changeFQDN"`
	// MaintenanceModeMessage is the message to be shown at the source system when the maintenance mode gets activated.
	MaintenanceModeMessage MaintenanceModeMessage `yaml:"maintenanceModeMessage"`
}

Migration contains the configuration data for the migration schedule.

type ResourceList

type ResourceList struct {
	// CPU specifies the amount of CPU the container can use
	CPU string `yaml:"cpu"`
	// Memory specifies the amount of memory the container can use
	Memory string `yaml:"memory"`
}

ResourceList specifies CPU and memory resources

type ResourceRequirements

type ResourceRequirements struct {
	// Limits specify the maximum resources that can be consumed
	Limits ResourceList `yaml:"limits"`
	// Requests specify the minimum resources that must be available
	Requests ResourceList `yaml:"requests"`
}

ResourceRequirements defines the compute resources required by the container

type SSH

type SSH struct {
	// User contains the SSH account name that will be used during copying the data from the source to the
	// target system. This is usually the root user. This value is required.
	User string `yaml:"user"`
	// PrivateSSHKeyPath contains the file path inside the container to the SSH private key used to identify
	// against the source system.  This value is required but hardcoded in the respective Helm chart.
	PrivateSSHKeyPath string `yaml:"privateKeyPath"`
	// SecretName specifies the Kubernetes secret name containing private SSH key data for authentication.
	SecretName string `yaml:"secretName"`
	// SecretDataKey specifies the key inside the secret containing the private SSH key data.
	SecretDataKey string `yaml:"secretDataKey"`
}

SSH contains the configuration data for the SSH connection to the source system.

type Smtp

type Smtp struct {
	Server   string   `yaml:"server"`   // SMTP server address (e.g., smtp.example.com)
	Port     string   `yaml:"port"`     // SMTP server port (default is "25" if not specified)
	Username string   `yaml:"username"` // Username for SMTP authentication
	Password string   `yaml:"password"` // Password for SMTP authentication
	From     string   `yaml:"from"`     // Sender's email address
	To       []string `yaml:"to"`       // List of recipient email addresses
}

Smtp holds SMTP server configuration details required for sending emails.

Jump to

Keyboard shortcuts

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