ReferenceEvents

Reference

Events

Every event Klass8s dispatches, its name, its payload and when it fires.

Every event Klass8s dispatches, its payload, and the moment it fires. Concepts and patterns live in The Event System; this page is the catalog.

Subscribe by name. Events are dispatched under their NAME constants, not their class names: subscribe with DeploymentGeneratedEvent::NAME, as the subscribers in the guide do.

All classes live in Klass8s\Event\ unless noted otherwise.

Method events

Fired by the proxy layer around every public method call on a manifest or container — including methods you defined yourself.

EventNAMEFires
ManifestMethodEventklass8s.manifest.before_methodbefore a manifest method's body
ManifestMethodCalledEventklass8s.manifest.method_calledafter a manifest method's body
ContainerMethodEventklass8s.container.before_methodbefore a container method's body
ContainerMethodCalledEventklass8s.container.method_calledafter a container method's body

The shared API (ProxyableMethodEventInterface):

MethodPurpose
proxyable()the manifest/container object (for instanceof filtering)
methodName()the intercepted method's name
methodParams() / methodParam($name)the call's arguments, by parameter name
typedMethodParam($name, $class)argument with an instanceof check — throws on mismatch
setReturnValue($v)before-event: skip the real body, return $v · after-event: replace what the caller receives
getReturnValue() / returnValueHasChanged()inspect what a subscriber has set
returnedValue()(after-events only) what the real method actually returned

The *Called events extend their before-counterparts; ManifestMethodEvent additionally exposes manifest(), the container events container().

Base classes for method subscribers

Extend one, implement supports() and beforeMethod()/afterMethod(), optionally override protected static function priority(): int (default 0):

Base classPhasePinned to
AbstractMethodSubscriberbefore(you list event names via eventNames())
AbstractMethodResultSubscriberafter(same)
AbstractManifestMethodSubscriberbeforemanifest events
AbstractManifestMethodResultSubscriberaftermanifest events
AbstractContainerMethodSubscriberbeforecontainer events
AbstractContainerMethodResultSubscriberaftercontainer events

All in Klass8s\Bundle\EventListener\.

Per-kind generated events

Notification events dispatched by a kind's resource maker once the k8schema object is fully built (after your configurators and configure{Kind}()). Payload: manifest(), apiResource(), a kind-named getter, and app(). Mutate the resource object directly.

EventNAME (klass8s.manifest_generated. +)Kind getter
ConfigMapGeneratedEventconfig_mapconfigMap()
SecretGeneratedEventsecretsecret()
DeploymentGeneratedEventdeploymentdeployment()
StatefulSetGeneratedEventstateful_setstatefulSet()
JobGeneratedEventjobjob()
CronJobGeneratedEventcron_jobcronJob()
ServiceGeneratedEventserviceservice()
ServiceAccountGeneratedEventservice_accountserviceAccount()
IngressGeneratedEventingressingress()
CustomResourceDefinitionGeneratedEventcustom_resource_definitioncrd()
GatewayGeneratedEventgatewaygateway()
GatewayClassGeneratedEventgateway_classgatewayClass()
HTTPRouteGeneratedEventhttp_routehttpRoute()
GRPCRouteGeneratedEventgrpc_routegrpcRoute()
BackendTLSPolicyGeneratedEventbackend_tls_policybackendTLSPolicy()
ReferenceGrantGeneratedEventreference_grantreferenceGrant()
ScaledObjectGeneratedEvent *scaled_objectscaledObject()
ScaledJobGeneratedEvent *scaled_jobscaledJob()

* KEDA events live in Klass8s\Autoscaling\Keda\Event\.

Kinds with no dedicated event — only the generic ManifestGeneratedEvent (below) fires for: HorizontalPodAutoscaler, PriorityClass, Role, ClusterRole, RoleBinding, ClusterRoleBinding, PersistentVolumeClaim, Prometheus monitors/rules, and all self-making manifests.

The generic manifest event

EventNAMEFires
ManifestGeneratedEventklass8s.manifest_generatedfor every manifest of every kind, after the per-kind event

Payload: manifest(), apiResource(), and the mutable flag public bool $preventProcessing — set true to drop the manifest from the output entirely (conditional existence). This is the event to use for rules spanning all kinds (the built-in klass8s.dev/* annotations use it).

Component events

Readonly events with public properties (no getters), fired while pods are assembled — for every workload kind at once:

EventNAMEPayload
ContainerGeneratedEventklass8s.container.generated$container (k8schema Container), $builder (ContainerInterface)
PodSpecGeneratedEventklass8s.pod_spec.generated$podSpec, $builder
PodTemplateSpecGeneratedEventklass8s.pod_template_spec.generated$templateSpec, $builder — note the property is $templateSpec

Env-source events

Fired by EnvConfigurator when a container consumes a ConfigMap/Secret by class reference. The non-Added pair is stoppable — stopPropagation() vetoes the source before it's added; the Added pair notifies afterwards:

EventNAMEVeto?
ConfigMapEnvSourceEventklass8s.env_source.config_mapyes — stopPropagation()
ConfigMapEnvSourceAddedEventklass8s.env_source.config_map.addedno
SecretEnvSourceEventklass8s.env_source.secretyes
SecretEnvSourceAddedEventklass8s.env_source.secret.addedno

Payload (public readonly): the source class name, the AppInterface, and the EnvConfigurator itself.

Lifecycle events

EventNAMEFires
ManifestsProcessedEventklass8s.manifests.processedonce per generation, after all Apps are built, before output — payload $outputDir. The whole-build vantage point (checksums hook here).
ManifestsDumpedEventklass8s.manifests.dumpedafter files are written, by every k8s:dump:* command

Helm

EventNAMEFires
Helm\HelmManifestProcessedEventklass8s.helm.manifest_processedonce per YAML document produced by helm template, before it's added to the release's output

Payload (public readonly): $kind, $name, $release (HelmReleaseInterface), and $resource — a mutable \stdClass parsed from the chart's output. Vendor YAML isn't schema-typed; mutate the tree directly (example).

Framework subscriber priorities

For ordering your own subscribers around the built-ins (all others run at 0):

Built-inEventPriority
EnvSuffixedMethodsSubscribermethod-called events-1024 — env-suffixed overrides get the last word
TrackAPIResourcesSubscribersix generated events-1024 — tracks resources for checksum lookups
ChecksumsSubscriberManifestsProcessedEvent-1024
AutoscaleSubscriberDeploymentGeneratedEvent / ManifestsProcessedEvent0 / 512 — spawns #[Autoscale] ScaledObjects before the late listeners

Rule of thumb: subscribe below -1024 to observe truly final values; at 0 to contribute values that env-suffixed methods may still override.

See also