Orkestra Notes — Standard Library

2 min read

Notes are pure transformation functions available in every {{ }} expression across a Katalog: conversion paths, status fields, mutation rules, when: conditions, onCreate, and onReconcile. They are the vocabulary of declarative operator behavior.

Contract: pure (same input → same output), safe (nil/empty input never panics, returns a safe zero value), stateless (no I/O, no side effects). Use hooks for anything that requires complex external calls not covered yet in orkestra.


DomainFileNotes
Croncron.mdcronToMap cronFromMap cronFromAny cronNormalize cronDescribe cronValid cronField cronMinute cronHour cronDom cronMonth cronDow cronExpr
Semversemver.mdsemverMajor semverMinor semverPatch semverValid semverCompare semverBump semverConstraint
Stringstring.mdtoLower toUpper trimSpace trim trimPrefix trimSuffix hasPrefix hasSuffix contains replace split join repeat camelToKebab truncate
Mathmath.mdadd sub mul div mod min max clamp abs
Conditionalconditional.mdternary boolTernary boolDefault coalesce default empty notEmpty
Typetype.mdtoInt toFloat toBool toString typeOf typeMap typeList typeString typeNumber typeBool typeNull len isEmpty isScalar isComposite
Datadata.mdtoBase64 fromBase64 toJSON sha256sum slugify truncateName
Randomrandom.mdrandomAlphanumeric randomHex randomBase64
Timetime.mdtimeAgo timeSince timeFormat isExpired durationSeconds durationAdd durationValid
Networknetwork.mdcidrContains ipValid ipIsPrivate
Resource quantitiesquantities.mdparseQuantity formatQuantity sumQuantity
List / Maplistmap.mdlistHas listGet listLen mapGet mapKeys mapValues mapPick mapOmit
Safe accesssafeaccess.mdgetOr getStringOr getIntOr getBoolOr
Type coercioncoercion.mdasList asMap asString
Kuberneteskubernetes.mdget meta name namespace labels annotations spec status phase resourceName resourceNamespace resourceUID resourceVersion creationTimestamp ownerKind ownerName hasCondition conditionReason conditionMessage resourceExists isTerminating generation observedGeneration isSynced
Replicasreplicas.mdreplicasReady desiredReplicas readyReplicas availableReplicas updatedReplicas
Serviceservice.mdserviceClusterIP serviceNodePort serviceLoadBalancerIP serviceLoadBalancerHost endpointsReady
Containercontainer.mdcontainerImage containerEnv containerPort containerPortByName containerPorts containerCount
Jobjob.mdjobSucceeded jobFailed jobActive

Adding a note

  1. Add the function to pkg/note/<domain>.go
  2. Register it in that file’s xxxNotes() FuncMap function
  3. If it is a new file, register it in buildNotes() in pkg/note/note.go
  4. Document it in the domain file above and update this index
  5. Run make build

Contract: handle nil/empty input with a safe zero value, not a panic. Return (value, error) for functions that can meaningfully fail; return just value for infallible ones.