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/orkestra-registry (runtime resolution) import this package. It imports only pkg/types and pkg/utils, keeping the dependency graph clean.
Index ¶
- Variables
- func ApplyAutoscalerProfile(name string, b orktypes.AutoscaleBaseline) (*orktypes.AutoscaleSpec, error)
- func ApplyContainerSecurityProfile(name string) (*orktypes.ContainerSecurityContext, error)
- func ApplyPodSecurityProfile(name string) (*orktypes.PodSecurityContext, error)
- func ApplyResourceProfile(name string) (*orktypes.ResourceRequirements, error)
- func IsValidAutoscaleProfile(name string) bool
- func IsValidHPAProfile(name string) bool
- func IsValidPDBProfile(name string) bool
- func IsValidProbeProfile(name string) bool
- func IsValidResourceProfile(name string) bool
- func IsValidRollingUpdateProfile(name string) bool
- func IsValidSecurityProfile(name string) bool
- type AutoscaleProfile
- type HPAProfile
- type HPAProfileResult
- type PDBProfile
- type PDBProfileResult
- type ProbeProfile
- type ProbeTimings
- type ResourceProfile
- type RollingUpdateProfile
- type RollingUpdateProfileResult
- type SecurityProfile
Constants ¶
This section is empty.
Variables ¶
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 ¶
IsValidAutoscaleProfile reports whether name is a recognized autoscale profile.
func IsValidHPAProfile ¶
IsValidHPAProfile reports whether name is a recognized HPA behavior profile.
func IsValidPDBProfile ¶
IsValidPDBProfile reports whether name is a recognized PDB profile.
func IsValidProbeProfile ¶
IsValidProbeProfile reports whether name is a recognized probe profile.
func IsValidResourceProfile ¶
IsValidResourceProfile reports whether name is a recognized resource profile.
func IsValidRollingUpdateProfile ¶
IsValidRollingUpdateProfile reports whether name is a recognized rolling update profile.
func IsValidSecurityProfile ¶
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
// 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
// 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" )