profiles

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

pkg/profiles

profiles is the single source of truth for all named presets in Orkestra. Resource, security, probe, and autoscaler profiles each expand into fully-formed types at katalog load time — the runtime never sees a profile name.

Both pkg/katalog (validation and expansion) and pkg/resources (runtime resolution) import this package. It imports only pkg/types and pkg/utils, keeping the dependency graph clean.

Developer documentation

I want to… Go to
See every profile name and what it expands to docs/01-profiles.md
Understand how profiles fit in the katalog load and runtime flow docs/02-internals.md
Add a new profile name or a new profile kind docs/03-adding-a-profile.md

Documentation

Overview

Package profiles provides named presets — resource, security, probe, and autoscaler — that expand into fully-formed Orkestra types at katalog load time. The runtime never sees profile names; it only ever sees the expanded struct as if the user had written every field manually.

Both pkg/katalog (validation + expansion) and pkg/resources (runtime resolution) import this package. It imports only pkg/types and pkg/utils, keeping the dependency graph clean.

Index

Constants

This section is empty.

Variables

View Source
var DefaultProbeTimings = ProbeTimings{
	InitialDelaySeconds: 15,
	PeriodSeconds:       20,
	FailureThreshold:    3,
	SuccessThreshold:    1,
	TimeoutSeconds:      10,
}

DefaultProbeTimings is used when no profile is declared or the profile name is not recognized. Matches the standard profile values.

Functions

func ApplyAutoscalerProfile

func ApplyAutoscalerProfile(name string, b orktypes.AutoscaleBaseline) (*orktypes.AutoscaleSpec, error)

ApplyAutoscalerProfile expands a named autoscale profile into a complete AutoscaleSpec using the CRD's declared baseline values. Returns an error for unknown profile names.

func ApplyContainerSecurityProfile

func ApplyContainerSecurityProfile(name string) (*orktypes.ContainerSecurityContext, error)

ApplyContainerSecurityProfile expands a named profile into a ContainerSecurityContext. Returns an error for unknown profile names.

func ApplyPodSecurityProfile

func ApplyPodSecurityProfile(name string) (*orktypes.PodSecurityContext, error)

ApplyPodSecurityProfile expands a named profile into a PodSecurityContext. Returns an error for unknown profile names.

func ApplyResourceProfile

func ApplyResourceProfile(name string) (*orktypes.ResourceRequirements, error)

ApplyResourceProfile expands a named resource profile into a complete ResourceRequirements. Returns an error for unknown profile names.

func IsValidAutoscaleProfile

func IsValidAutoscaleProfile(name string) bool

IsValidAutoscaleProfile reports whether name is a recognized autoscale profile.

func IsValidHPAProfile

func IsValidHPAProfile(name string) bool

IsValidHPAProfile reports whether name is a recognized HPA behavior profile.

func IsValidPDBProfile

func IsValidPDBProfile(name string) bool

IsValidPDBProfile reports whether name is a recognized PDB profile.

func IsValidProbeProfile

func IsValidProbeProfile(name string) bool

IsValidProbeProfile reports whether name is a recognized probe profile.

func IsValidResourceProfile

func IsValidResourceProfile(name string) bool

IsValidResourceProfile reports whether name is a recognized resource profile.

func IsValidRollingUpdateProfile

func IsValidRollingUpdateProfile(name string) bool

IsValidRollingUpdateProfile reports whether name is a recognized rolling update profile.

func IsValidSecurityProfile

func IsValidSecurityProfile(name string) bool

IsValidSecurityProfile reports whether name is a recognized security profile.

Types

type AutoscaleProfile

type AutoscaleProfile string

AutoscaleProfile is a named autoscale behavior preset.

const (
	AutoscaleBurst            AutoscaleProfile = "burst"
	AutoscaleSteady           AutoscaleProfile = "steady"
	AutoscaleBatch            AutoscaleProfile = "batch"
	AutoscaleLatencySensitive AutoscaleProfile = "latency-sensitive"
	AutoscaleCostOptimized    AutoscaleProfile = "cost-optimized"
)

type HPAProfile

type HPAProfile string

HPAProfile is a named HPA scaling behavior preset.

  • web — 70% CPU, standard scale-up, 5-min scale-down stabilization.
  • api — 60% CPU, fast scale-up, 10-min scale-down stabilization.
  • latency-sensitive — 50% CPU, very fast scale-up, 15-min scale-down stabilization.
  • batch — 80% CPU, moderate scale-up, 2-min scale-down (jobs end fast).
  • cost-optimized — 80% CPU, slow scale-up (3-min stabilization), aggressive scale-down.
const (
	HPAWeb              HPAProfile = "web"
	HPAAPI              HPAProfile = "api"
	HPALatencySensitive HPAProfile = "latency-sensitive"
	HPABatch            HPAProfile = "batch"
	HPACostOptimized    HPAProfile = "cost-optimized"
)

type HPAProfileResult

type HPAProfileResult struct {
	// CPUTarget is the suggested targetCPUUtilizationPercentage for this profile.
	// Applied only when the user has not declared an explicit value.
	CPUTarget int32

	// Behavior is the fully-expanded behavior block with Profile cleared.
	Behavior orktypes.HPABehavior
}

HPAProfileResult is returned by ApplyHPAProfile. It carries both the CPU utilization target and the fully-formed behavior block so callers can apply them to the HPA template in one step.

func ApplyHPAProfile

func ApplyHPAProfile(name string) (HPAProfileResult, error)

ApplyHPAProfile expands a named HPA profile into a CPUTarget and behavior block. Returns an error for unknown profile names.

type PDBProfile

type PDBProfile string

PDBProfile is a named PodDisruptionBudget disruption limit preset.

  • zero-downtime — minAvailable: 100%. No pod may be voluntarily disrupted. Use for stateful services, databases, anything where partial availability is unacceptable.
  • rolling — maxUnavailable: 1. Exactly one pod at a time. Safe default for production.
  • relaxed — maxUnavailable: 25%. Up to a quarter of pods may be disrupted. Use for stateless services where brief capacity reduction is acceptable.
const (
	PDBZeroDowntime PDBProfile = "zero-downtime"
	PDBRolling      PDBProfile = "rolling"
	PDBRelaxed      PDBProfile = "relaxed"
)

type PDBProfileResult

type PDBProfileResult struct {
	// MinAvailable — minimum pods that must remain available.
	// Non-empty only for profiles that use minAvailable semantics.
	MinAvailable string

	// MaxUnavailable — maximum pods that may be unavailable.
	// Non-empty only for profiles that use maxUnavailable semantics.
	MaxUnavailable string
}

PDBProfileResult is returned by ApplyPDBProfile.

func ApplyPDBProfile

func ApplyPDBProfile(name string) (PDBProfileResult, error)

ApplyPDBProfile expands a named PDB profile into disruption limit values. Returns an error for unknown profile names.

type ProbeProfile

type ProbeProfile string

ProbeProfile is a named set of Kubernetes probe timing parameters.

  • fast — quick detection, low tolerance. HTTP APIs that start fast.
  • standard — balanced defaults for most web services.
  • patient — tolerant of slow operations. Batch workers.
  • slow-start — 5-minute startup window for JVM apps, databases.
const (
	ProbeFast      ProbeProfile = "fast"
	ProbeStandard  ProbeProfile = "standard"
	ProbePatient   ProbeProfile = "patient"
	ProbeSlowStart ProbeProfile = "slow-start"
)

type ProbeTimings

type ProbeTimings struct {
	InitialDelaySeconds int32
	PeriodSeconds       int32
	FailureThreshold    int32
	SuccessThreshold    int32
	TimeoutSeconds      int32
}

ProbeTimings holds the Kubernetes probe timing parameters for a profile.

func ApplyProbeProfile

func ApplyProbeProfile(name string) (ProbeTimings, bool)

ApplyProbeProfile returns the ProbeTimings for the named profile. The second return value is false when the name is not recognized — callers should fall back to DefaultProbeTimings in that case.

type ResourceProfile

type ResourceProfile string

ResourceProfile is a named CPU/memory preset.

const (
	ResourceTiny         ResourceProfile = "tiny"
	ResourceSmall        ResourceProfile = "small"
	ResourceMedium       ResourceProfile = "medium"
	ResourceLarge        ResourceProfile = "large"
	ResourceBurst        ResourceProfile = "burst"
	ResourceSteady       ResourceProfile = "steady"
	ResourceComputeHeavy ResourceProfile = "compute-heavy"
	ResourceMemoryHeavy  ResourceProfile = "memory-heavy"
)

type RollingUpdateProfile

type RollingUpdateProfile string

RollingUpdateProfile is a named Deployment rolling update strategy preset.

  • safe — maxSurge: 1, maxUnavailable: 0. Adds one pod before removing one. Zero capacity drop during rollout. Default for production services.
  • fast — maxSurge: 25%, maxUnavailable: 25%. Removes and adds pods in parallel. Faster rollout with brief capacity reduction. Kubernetes default behaviour.
  • blue-green — maxSurge: 100%, maxUnavailable: 0. Full duplicate capacity during rollout, then removes old pods. Most expensive but cleanest cutover.
const (
	RollingUpdateSafe      RollingUpdateProfile = "safe"
	RollingUpdateFast      RollingUpdateProfile = "fast"
	RollingUpdateBlueGreen RollingUpdateProfile = "blue-green"
)

type RollingUpdateProfileResult

type RollingUpdateProfileResult struct {
	// MaxSurge — maximum pods above desired replica count during rollout.
	// Integer string ("1") or percentage string ("25%").
	MaxSurge string

	// MaxUnavailable — maximum pods that can be unavailable during rollout.
	// Integer string ("0") or percentage string ("25%").
	MaxUnavailable string
}

RollingUpdateProfileResult is returned by ApplyRollingUpdateProfile.

func ApplyRollingUpdateProfile

func ApplyRollingUpdateProfile(name string) (RollingUpdateProfileResult, error)

ApplyRollingUpdateProfile expands a named rolling update profile into MaxSurge and MaxUnavailable. Returns an error for unknown profile names.

type SecurityProfile

type SecurityProfile string

SecurityProfile is a named security preset.

  • baseline — prevents privilege escalation, drops NET_RAW.
  • restricted — drops all capabilities, requires non-root. Matches the Kubernetes "restricted" Pod Security Standard.
  • hardened — restricted plus read-only root filesystem.
const (
	SecurityBaseline   SecurityProfile = "baseline"
	SecurityRestricted SecurityProfile = "restricted"
	SecurityHardened   SecurityProfile = "hardened"
)

Jump to

Keyboard shortcuts

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