konfig

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

pkg/konfig/katalog.go

Index

Constants

View Source
const (
	// Ork
	Orkestra    = "OrKestra"
	Ork         = "ork"
	OrkOperator = "orkestra-operator"

	// Environment
	DevShort     = "dev"
	StagingShort = "uat"
	Live         = "live"
	ProdShort    = "prod"
	Development  = "development"
	Staging      = "staging"
	Production   = "production"

	// Modes
	DynamicMode = "dynamic"
	TypedMode   = "typed"

	// LabelManaged is patched on every CR Orkestra manages.
	// Used by ork reconcile, ork get, and ork events to scope
	// their operations to exactly what this operator instance manages.
	LabelManaged       = "orkestra.orkspace.io/managed"
	LabelManagedValue  = "true"
	LabelOrkestraOwner = "orkestra-owner"

	// AnnotationManagedBy identifies which Orkestra operator instance
	// is managing this CR. Useful when multiple Orkestra operators
	// run in the same cluster managing different CRD sets.
	AnnotationManagedBy = "orkestra.orkspace.io/managed-by"

	// AnnotationManagedSince records when Orkestra first took ownership.
	AnnotationManagedSince = "orkestra.orkspace.io/managed-since"

	// Finalizers
	FinalizerOrkestra = "orkestra.orkspace.io/finalizer"
)

Variables

This section is empty.

Functions

func ApiVersions

func ApiVersions() []string

ApiVersions returns the list of supported apiVersions.

func GetBoolEnv

func GetBoolEnv(key string, def bool) bool

GetBoolEnv returns the boolean value of an env

func GetDurEnvSeconds

func GetDurEnvSeconds(key string, def int) time.Duration

GetDurEnvSeconds returns the time.duration value of an env

func GetIntEnv

func GetIntEnv(key string, def int) int

GetIntEnv returns the int value of an env

func GetStrEnv

func GetStrEnv(key, def string) string

GetStrEnv returns the string value of an env

func GetStrSliceEnv

func GetStrSliceEnv(key string, def []string) []string

GetStrSliceEnv returns the slice value of an env

func IsKatalogKind

func IsKatalogKind(kind string) bool

IsKatalogKind returns true if the given kind is a Katalog.

func IsKomposerKind

func IsKomposerKind(kind string) bool

IsKomposerKind returns true if the given kind is a Komposer.

func IsValidApiVersion

func IsValidApiVersion(apiVersion string) bool

IsValidApiVersion returns true if the given apiVersion is a supported version.

func IsValidDocumentKind

func IsValidDocumentKind(kind string) bool

IsValidDocumentKind returns true if the kind is either Katalog or Komposer. Used by parseKatalogDoc to accept both kinds before dispatching.

func KatalogKind

func KatalogKind() string

KatalogKind returns the kind string for a Katalog document. Katalogs declare CRDs in spec.crds. No sources block.

func KomposerKind

func KomposerKind() string

KomposerKind returns the kind string for a Komposer document. Komposers compose Katalogs from sources (files, helm).

func OrkestraBaseLabels added in v0.2.5

func OrkestraBaseLabels() map[string]string

OrkestraBaseLabels returns a copy of the standard Orkestra control-plane labels. It can be called without a Konfig instance — useful in generators and CLI commands that do not load the full operator configuration.

func Validate

func Validate() *validator.Validate

-----------------------------------------------------------------------------

Types

type Konfig

type Konfig struct {
	// contains filtered or unexported fields
}

func Init

func Init(filenames ...string) (*Konfig, error)

func NewDefaultKonfig

func NewDefaultKonfig() *Konfig

func (*Konfig) AdmissionEnabled

func (k *Konfig) AdmissionEnabled() bool

AdmissionEnabled reports whether admission webhooks are enabled. Reads from SecurityConfig (populated from ENV at Init).

func (*Konfig) Cluster

func (k *Konfig) Cluster() *clusterKonfig

Cluster returns cluster Konfigurations

func (*Konfig) ConversionEnabled

func (k *Konfig) ConversionEnabled() bool

ConversionEnabled reports whether the conversion webhook is enabled. Reads from SecurityConfig (populated from ENV at Init).

func (*Konfig) Finalizers

func (k *Konfig) Finalizers() []string

Finalizers return a list of default finalizers

func (*Konfig) HTTPSPort

func (k *Konfig) HTTPSPort() string

HTTPSPort returns the HTTPS port string (e.g. ":8443") used by the webhook server.

func (*Konfig) HTTPSPortInt32

func (k *Konfig) HTTPSPortInt32() int32

HTTPSPortInt32 returns the HTTPS port as int32 (8443) used in webhook client configs.

func (*Konfig) Health

func (k *Konfig) Health() *healthServer

Health returns health konfigurations

func (*Konfig) IsDev

func (k *Konfig) IsDev() bool

IsDev returns true for development environment

func (*Konfig) IsProduction

func (c *Konfig) IsProduction() bool

IsDev returns true for production environment

func (*Konfig) IsStaging

func (k *Konfig) IsStaging() bool

IsDev returns true for staging environment

func (*Konfig) Katalog

func (k *Konfig) Katalog() *katalogKonfig

Katalog returns katalog Konfigurations

func (*Konfig) Konductor

func (c *Konfig) Konductor() *konductorElection

Konductor returns konductor Konfigurations

func (*Konfig) Notification

func (k *Konfig) Notification() *NotificationConfig

Notification returns the unified notification configuration. This is the primary accessor for all notification-related settings.

func (*Konfig) Ork

func (k *Konfig) Ork() *orkKonfig

Ork returns Ork Konfigurations

func (*Konfig) OrkestraResourceLabels added in v0.1.8

func (k *Konfig) OrkestraResourceLabels() map[string]string

OrkestraResourceLabels returns the internal labels for orkestra control plane resources

func (*Konfig) OrkestraResourceSelector added in v0.1.8

func (k *Konfig) OrkestraResourceSelector() *metav1.LabelSelector

OrkestraResourceSelector returns the internal label selector for orkestra control plane resources

func (*Konfig) OrkestraServiceName added in v0.2.5

func (k *Konfig) OrkestraServiceName() string

Orkestra service name

func (*Konfig) RegistryConfig

func (k *Konfig) RegistryConfig() *registryConfig

RegistryConfig returns registry configuration.

func (*Konfig) Security

func (k *Konfig) Security() *SecurityConfig

Security returns the unified security configuration. This is the primary accessor for all security-related settings.

func (*Konfig) WebhookConfig

func (k *Konfig) WebhookConfig()

type NotificationConfig

type NotificationConfig struct {
	Email struct {
		Enabled  bool // true when SMTP_* env vars are present
		SMTPHost string
		SMTPPort int
		SMTPUser string
		SMTPPass string
		From     string // optional override for From: header
	}

	Slack struct {
		Enabled bool   // true when SLACK_WEBHOOK_URL is present
		Webhook string // default webhook URL
	}

	// DefaultInterval is the fallback notification interval when neither the
	// team nor the Katalog YAML defines one.
	DefaultInterval time.Duration
}

NotificationConfig is the unified notification configuration populated from ENV vars at Init() time. Katalog YAML values are merged on top via the Katalog loader, so this represents the ENV-level defaults.

Precedence: Katalog YAML > NotificationConfig (ENV) > hard default.

This struct defines *capability* — whether Orkestra is able to send email or Slack notifications at all. Teams and conditions define *intent*.

type SecurityConfig

type SecurityConfig struct {
	// One service name per orkestra instance
	ServiceName string

	DeletionProtection struct {
		Enabled           bool
		CleanupOnShutdown bool
		ServiceName       string
		FailurePolicy     string
	}
	Webhooks struct {
		Admission struct {
			Enabled bool
		}
		CleanupOnShutdown bool
		FailurePolicy     string
		ServiceName       string
		// TLS paths — shared with deletion protection, admission, and conversion.
		// Set by ensureSecurity() after cert generation/loading.
		TLSCert string
		TLSKey  string

		Controller struct {
			Enabled      bool
			SyncInterval time.Duration
		}
	}
	// Conversion is separate from admission webhooks — conversion has its own
	// /convert endpoint, window stats, and CRD patch logic.
	Conversion struct {
		Enabled bool
		// ConversionWindow is the rolling window size for latency/throughput stats.
		ConversionWindow  int
		CleanupOnShutdown bool // TODO
	}

	// NamespaceProtection controls the optional validating webhook that prevents
	// Orkestra-managed CRs from being created or updated in forbidden namespaces.
	//
	// This is an admission-time safeguard only. If disabled, namespace rules are
	// not enforced at apply time. If enabled, the webhook blocks CRs whose target
	// namespace violates the CRD’s declared allowedNamespaces or restrictedNamespaces.
	//
	// The webhook is managed by the WebhookController and will be recreated if
	// deleted, ensuring continuous enforcement when enabled.
	//
	// Precedence: Katalog YAML > SecurityConfig (ENV) > hard default.
	NamespaceProtection struct {
		Enabled           bool
		FailurePolicy     string
		ServiceName       string
		CleanupOnShutdown bool
	}
}

SecurityConfig is the unified security configuration populated from ENV vars at Init() time. Katalog YAML values are merged on top via the Katalog loader, so this represents the ENV-level defaults.

Precedence: Katalog YAML > SecurityConfig (ENV) > hard default.

Jump to

Keyboard shortcuts

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