Trait Handlers

OAM Built-in Trait Handlers

Go Reference Go Reference

Package traits implements oam.TraitHandler for the built-in trait types. A trait decorates or augments a component — adding networking, security, storage, scaling, or operational behavior. Handlers are registered with the transformer in pkg/cmd/kurel via RegisterBuiltinTrait(type, handler); each implements CanHandle + Apply. Some traits are capability-aware (CapabilityRequired) and draw platform choices (issuer, gateway, secret store) from the ClusterProfile.

Trait catalog

Networking

typeProducesKey properties
ingressIngressrules[] (host, paths[]), ingressClassName, tls[], annotations
httprouteGateway API HTTPRouteparentRefs[], rules[] (matches/backendRefs/filters/timeouts), hostnames[]
exposeIngress or HTTPRouterules[], hostnames[] — controller chosen by ClusterProfile (controllerType)
networkpolicyNetworkPolicyingress[]/egress[] (from/to, ports)
cilium-networkpolicyCiliumNetworkPolicyname, endpointSelector, ingress/egress (raw Cilium rules)

Security

typeProducesKey properties
certificatecert-manager CertificatesecretName, dnsNames[], duration, renewBefore (issuer from ClusterProfile)
rbacRole/RoleBinding (+ClusterRole/Binding)rules[] (apiGroups/resources/verbs), clusterWide
external-secretESO ExternalSecretsecretName, data[]/dataFrom[], refreshInterval (store from ClusterProfile or provider)

Storage

typeProducesKey properties
pvcPersistentVolumeClaimname, size, storageClassName, accessModes[] (policy: maxStorageSize)
volsyncVolSync ReplicationSourcesourcePVC, schedule, copyMethod, retain.{daily,weekly,monthly}

Configuration & scaling

typeProducesKey properties
configmapConfigMap (+ optional volume mount)name, data, mountPath
scalerHorizontalPodAutoscaler (+ optional PDB)minReplicas, maxReplicas, cpuUtilization, memoryUtilization, enablePDB

Operational (FluxCD)

typeEffectKey properties
fluxcd-patchesAppends Kustomization.spec.patchespatches[] (patch, target)
fluxcd-postbuildSets Kustomization.spec.postBuildsubstitute, substituteFrom[]
prune-protectionAdds kustomize.toolkit.fluxcd.io/prune: disabled(no properties)

Capability-aware traits

These require (or optionally use) a ClusterProfile capability, so the platform — not the app — chooses the implementation:

  • exposecontrollerType (ingress vs gateway) + gateway/ingress details.
  • certificateissuerRef (cert-manager issuer/cluster-issuer).
  • external-secretsecretStoreRef (or the inline provider shorthand).

Auto-synthesized NetworkPolicy

Routing traits (ingress/httproute/expose) can surface platform-reserved networkPolicy.trafficSources, which the OAM layer collects to synthesize a matching NetworkPolicy (see pkg/oam/netpol).

Extending

Custom traits implement oam.TraitHandler (CanHandle + Apply), optionally CapabilityAware + ValidateAndApplyDefaults for capability validation.

See pkg.go.dev for the full config-field reference, the OAM model for the interfaces, and examples/ for runnable applications.