ReferenceManifest types

Reference

Manifest types

Every base class a manifest can extend, by area, with the methods it offers, their defaults and the way out to the raw object.

Every abstract base class a manifest can extend, grouped by area. For the concepts — lifecycle, naming, config, escape hatches — see Manifests; this page is the catalog.

The universal contract, inherited from Klass8s\Manifest\AbstractManifest by everything below:

MemberMeaning
public static function shortName(): stringrequired — the only method every manifest must implement
public static function apiVersion(): string / kind(): stringimplemented by each base (values listed per class; final where noted)
public function metadata(MetadataConfigurator $meta): void {}per-manifest labels/annotations
$computedShortName, $computedFullName, $fileNameget-only virtual properties (resolved name, output file name)

Configurator-receiving methods (data(), ports(), rules(), …) are void hooks with empty default bodies — override only what you need. Escape hatches (configure{Kind}()) run after all configurators; a few resource families have none (noted below). And remember: manifest classes must not be final — they are subclassed by runtime proxies.

Generic bases

Klass8s\Manifest\AbstractSelfMakingManifest

Any custom resource — guide. Renders exactly apiVersion + kind + metadata + spec.

GroupMethod
Requiredspec(): array|\JsonSerializable, apiVersion(): string, kind(): string, shortName(): string

Config and Secrets

Klass8s\Core\ConfigMap\AbstractConfigMap — ConfigMap, v1 (final)

GroupMethod (default)
Specdata(StringMap $data), binaryData(StringMap $binaryData), keysPrefix(): string → ''
Escape hatchconfigureConfigMap(K8Schema\Api\Core\V1\ConfigMap $configMap)

Klass8s\Core\Secret\AbstractSecret — Secret, v1 (final)

GroupMethod (default)
Specdata(StringMap $data) (pre-encoded), stringData(StringMap $stringData) (plaintext), keysPrefix(): string → '', type(): SecretType → Opaque
Escape hatchconfigureSecret(K8Schema\Api\Core\V1\Secret $secret)

SecretType: Opaque, ServiceAccountToken, DockerConfig, BasicAuth, SshAuth, TLS.

Three specialized secret bases pin type() and build data() for you (both are final there):

ClassRequired methodsProduces
AbstractBasicAuthSecretprotected username(): string, protected password(): stringkubernetes.io/basic-auth
AbstractDockerConfigSecretprotected auths(): iterable of DockerAuth(string $host, string $username, string $password, ?string $email = null).dockerconfigjson
AbstractServiceAccountSecretprotected serviceAccountName(): string; overridable protected extraData(StringMap $data)SA token secret with the kubernetes.io/service-account.name annotation (call parent::metadata() if you override metadata())

Workloads

All workload bases share this pod-level surface (identical defaults on Deployment, StatefulSet, Job; CronJob inherits via Job):

GroupMethod (default)
Containerscontainers(): iterable — required; auto-satisfied by the AbstractContainer* variants (yield $this); initContainers(): iterable → []
Schedulingaffinity(AffinityConfigurator), nodeSelector(StringMap), tolerations(TolerationsConfigurator), topologySpreadConstraints(TopologySpreadConstraintsConfigurator), priorityClass(PriorityClassConfigurator)
IdentityserviceAccount(): ?ManifestClassReference → null, serviceAccountName(): ?string → null (raw name wins if both set), imagePullSecrets(ImagePullSecretsConfigurator)
Podvolumes(VolumesConfigurator), restartPolicy(): ?RestartPolicy → null (Always|OnFailure|Never), terminationGracePeriodSeconds(): ?int → null
Escape hatchconfigurePodSpec(K8Schema\Api\Core\V1\PodSpec $spec)

Klass8s\Core\Deployment\AbstractDeployment — Deployment, apps/v1 (final)

GroupMethod (default)
Specreplicas(): int → 1, revisionHistoryLimit(): int → 1, selector(SelectorConfigurator), strategy(StrategyConfigurator), minReadySeconds(): ?int, progressDeadlineSeconds(): ?int
Escape hatchconfigureDeployment(K8Schema\Api\Apps\V1\Deployment $deployment)

Klass8s\Core\StatefulSet\AbstractStatefulSet — StatefulSet, apps/v1

GroupMethod (default)
RequiredserviceName(): ManifestClassReference — the governing headless Service
Specreplicas(): int → 1, revisionHistoryLimit(): int → 1, podManagementPolicy(): ?PodManagementPolicy → null (OrderedReady|Parallel), selector(SelectorConfigurator), updateStrategy(UpdateStrategyConfigurator), volumeClaimTemplates(): iterable → [] (of PersistentVolumeClaimInterface)
Escape hatchconfigureStatefulSet(K8Schema\Api\Apps\V1\StatefulSet $statefulSet)

Klass8s\Core\Job\AbstractJob — Job, batch/v1

GroupMethod (default)
SpecbackoffLimit(): ?int, activeDeadlineSeconds(): ?int, ttlSecondsAfterFinished(): ?int, completions(): ?int, parallelism(): ?int, manualSelector(): ?bool, suspend(): bool → false, selector(SelectorConfigurator)
Escape hatchconfigureJob(K8Schema\Api\Batch\V1\Job $job)

Klass8s\Core\CronJob\AbstractCronJob — CronJob, batch/v1 (final); extends AbstractJob

GroupMethod (default)
Requiredschedule(): string
Specjob(): JobInterface → $this, concurrencyPolicy(): ConcurrencyPolicy → Forbid (Allow|Forbid|Replace), timeZone(): ?string, startingDeadlineSeconds(): ?int, successfulJobsHistoryLimit(): ?int, failedJobsHistoryLimit(): ?int, suspendCronJob(): bool → $this->suspend()
Escape hatchconfigureCronJob(K8Schema\Api\Batch\V1\CronJob $cronJob) (+ configureJob, configurePodSpec)

The Container variants

AbstractContainerDeployment, AbstractContainerStatefulSet, AbstractContainerJob, AbstractContainerCronJob each extend their plain counterpart and implement ContainerInterface themselves — the manifest is its own single container (containers() yields $this). They add the full container API and one extra requirement: image(): Image.

Networking (core)

Klass8s\Core\Service\AbstractService — Service, v1 (final)

GroupMethod (default)
Specports(ServicePortsConfigurator), selector(StringMap) (defaults wired by the framework), type(ServiceTypeConfigurator) (ClusterIP default), clusterIP(): ?string, trafficDistribution(): ?TrafficDistribution → PreferClose (PreferClose|PreferSameZone|PreferSameNode)
Escape hatchconfigureService(K8Schema\Api\Core\V1\Service $service)

Klass8s\Core\Ingress\AbstractIngress — Ingress (final), networking.k8s.io/v1

GroupMethod (default)
Requiredrules(IngressRulesConfigurator $rules): void
SpecdefaultBackend(IngressBackendConfigurator), ingressClassName(): ?string
Escape hatchconfigureIngress(K8Schema\Api\Networking\V1\Ingress $ingress)

RBAC and identity

Full guide: RBAC & Service Accounts.

Klass8s\Core\ServiceAccount\AbstractServiceAccount — ServiceAccount, v1 (final)

GroupMethod (default)
SpecautomountServiceAccountToken(): ?bool → false (rendered explicitly; null omits the field), imagePullSecrets(ImagePullSecretsConfigurator) (the SA-level configurator — takes ManifestClassReferences), secrets(SecretsConfigurator)
Escape hatchconfigureServiceAccount(K8Schema\Api\Core\V1\ServiceAccount $serviceAccount)

Roles and bindings

All rbac.authorization.k8s.io/v1.

ClassRequiredExtrasEscape hatch
Klass8s\Core\Rbac\AbstractRolerules(PolicyRulesConfigurator)—configureRole(K8Schema\Api\Rbac\V1\Role)
…\AbstractClusterRolerules(PolicyRulesConfigurator)aggregationRule(AggregationRuleConfigurator)configureClusterRole(…\ClusterRole)
…\AbstractRoleBindingroleRef(RoleRefConfigurator), subjects(SubjectsConfigurator)—none
…\AbstractClusterRoleBindingroleRef(RoleRefConfigurator), subjects(SubjectsConfigurator)—none

The binding makers validate at render time: a configured roleRef and ≥ 1 subject, or the render fails.

Storage and scheduling

Klass8s\Core\Persistence\AbstractPersistentVolumeClaim — renders PersistentVolumeClaim, v1

GroupMethod (default)
RequiredaccessModes(): iterable of AccessMode (ReadWriteOnce|ReadOnlyMany|ReadWriteMany)
Specresources(PvcResourcesConfigurator), storageClassName(): ?string, volumeMode(): VolumeMode → Filesystem (Filesystem|Block), volumeName(): ?string, dataSource(): ?ManifestClassReference, selector(SelectorConfigurator)
Escape hatchnone

Klass8s\Core\Persistence\AbstractStorageClass — StorageClass (final), storage.k8s.io/v1

GroupMethod (default)
Requiredprovisioner(): string
Specparameters(StringMap), reclaimPolicy(): ReclaimPolicy → Delete (Delete|Retain), volumeBindingMode(): VolumeBindingMode → Immediate (Immediate|WaitForFirstConsumer), allowVolumeExpansion(): bool → false, mountOptions(): iterable of string → [], allowedTopologies(AllowedTopologiesConfigurator)
MetadataisDefaultClass(): bool → false — true adds the storageclass.kubernetes.io/is-default-class: "true" annotation (the class every PVC without a storageClassName binds to)
Escape hatchnone

Cluster-scoped: no namespace is rendered. Implement FullNameAwareInterface when the object must carry a conventional cluster-wide name (gp3, standard) instead of the {app}-{short name} form.

Cloud batteries — ready-to-use classes for the storage a managed Kubernetes product expects, shipped under Klass8s\Cloud\{provider}\; subclass one into the app that should own the object (manifest discovery is per app namespace) and override nothing:

ClassRenders
Klass8s\Cloud\Aws\EksAutoMode\Gp3StorageClassgp3 — the default class EKS Auto Mode does not create: provisioner ebs.csi.eks.amazonaws.com, type=gp3 + encrypted=true, WaitForFirstConsumer, expandable, pinned to Auto Mode nodes (eks.amazonaws.com/compute-type in [auto]), marked default

Klass8s\Core\PriorityClass\AbstractPriorityClass — PriorityClass (final), scheduling.k8s.io/v1

GroupMethod (default)
Requiredvalue(): int
Specdescription(): ?string, globalDefault(): bool → false, preemptionPolicy(): ?PreemptionPolicy → null (Never|PreemptLowerPriority)
Escape hatchnone

Autoscaling

Klass8s\Core\Autoscaling\AbstractHorizontalPodAutoscaler — HorizontalPodAutoscaler, autoscaling/v2

GroupMethod (default)
RequiredmaxReplicas(): int, metrics(MetricsConfigurator), scaleTargetRef(): VersionedManifestClassReference|CrossVersionObjectReference
SpecminReplicas(): int → 1, behavior(BehaviorConfigurator)
Escape hatchconfigureHorizontalPodAutoscaler(K8Schema\Api\Autoscaling\V2\HorizontalPodAutoscaler $hpa)

KEDA

All keda.sh/v1alpha1.

Klass8s\Autoscaling\Keda\Manifest\ScaledObject\AbstractScaledObject — ScaledObject

GroupMethod (default)
RequiredscaleTargetRef(): ScaleTargetReference|WorkloadContainerReference
ScalingminReplicaCount(): int → 0, maxReplicaCount(): int → 100, idleReplicaCount(): ?int, pollingInterval(): int → 30, cooldownPeriod(): int → 300, restoreToOriginalReplicaCount(): ?bool, fallback(): ?Fallback, hpaName(): ?string, behavior(BehaviorConfigurator) (the HPA behavior configurator)
Triggerstriggers(TriggerBuildersRegistry $builders): iterable → [] — yield trigger builders
Escape hatchconfigureScaledObject(Klass8s\Autoscaling\Keda\API\ScaledObject\ScaledObject $scaledObject)

The common case — one scaler per workload — needs no ScaledObject class at all: put #[Autoscale] plus trigger attributes on the workload manifest and the build spawns an AutoscaleScaledObject for it (see Autoscaling).

…\ScaledJob\AbstractScaledJob — ScaledJob

Constructor-injected target: __construct(private readonly JobSpec $jobTargetRef) (K8Schema\Api\Batch\V1\JobSpec); jobTargetRef(): JobSpec overridable.

GroupMethod (default)
ScalingminReplicaCount(): int → 0, maxReplicaCount(): int → 100, pollingInterval(): int → 30, successfulJobsHistoryLimit(): int → 5, failedJobsHistoryLimit(): int → 5, envSourceContainerName(): ?string
Strategyrollout(RolloutConfigurator), scalingStrategy(ScalingStrategyConfigurator), triggers(TriggerBuildersRegistry): iterable → []
Escape hatchconfigureScaledJob(Klass8s\Autoscaling\Keda\API\ScaledJob\ScaledJob $scaledJob)

Monitoring

The Prometheus Operator's kinds, all monitoring.coreos.com/v1.

ArrayObject-assembled (no k8schema classes) — no escape hatches in this family.

Klass8s\Monitoring\Prometheus\AbstractMonitor (shared base, no kind)

GroupMethod (default)
Requiredselector(SelectorConfigurator $selector): void
SpecjobLabel(): ?string, namespaceSelector(NamespaceSelectorConfigurator), podTargetLabels(StringList), sampleLimit(): ?int
ClassKindAdds
…\PodMonitor\AbstractPodMonitorPodMonitorrequired podMetricsEndpoints(EndpointsConfigurator)
…\ServiceMonitor\AbstractServiceMonitorServiceMonitorrequired endpoints(EndpointsConfigurator); overridable targetLabels(StringList)
…\AbstractPrometheusRulePrometheusRulerequired groups(RuleGroupsConfigurator)

Gateway API

All gateway.networking.k8s.io/v1.

Guide: Networking. ArrayObject-assembled — no configure{Kind}() escape hatches in this family. Kind is final in each class.

Class (Klass8s\GatewayApi\…)KindRequiredSpec hooks
Gateway\AbstractGatewayGatewaygatewayClass(): string|ManifestClassReferencelisteners(ListenersConfigurator), addresses(AddressesConfigurator), infrastructure(InfrastructureConfigurator)
GatewayClass\AbstractGatewayClassGatewayClasscontrollerName(): stringdescription(): ?string, parametersRef(): ?ParametersRef
HTTPRoute\AbstractHTTPRouteHTTPRoute—parentRefs(ParentRefsConfigurator), hostnames(StringList), rules(HTTPRouteRulesConfigurator)
GRPCRoute\AbstractGRPCRouteGRPCRoute—parentRefs(ParentRefsConfigurator), hostnames(StringList), rules(GRPCRouteRulesConfigurator)
BackendTLSPolicy\AbstractBackendTLSPolicyBackendTLSPolicy—targetRefs(TargetRefsConfigurator), validation(TLSValidationConfigurator), options(OptionsConfigurator)
ReferenceGrant\AbstractReferenceGrantReferenceGrant—from(ReferenceGrantFromConfigurator), to(ReferenceGrantToConfigurator)

Custom resource definitions

Klass8s\Core\Crd\AbstractCustomResourceDefinition — CustomResourceDefinition (final), apiextensions.k8s.io/v1

Guide: Custom Resources. Implements FullNameAwareInterface: the resource name is fullName() (default {plural}.{group}), not app-prefixed; shortName() is still required for framework identity.

GroupMethod (default)
Requiredgroup(): string, resourceKind(): string, plural(): string, shortName(): string
IdentityfullName(): string → plural().'.'.group()
Specscope(): CrdScope → Namespaced (Namespaced|Cluster), names(CrdNamesConfigurator), versions(CrdVersionsConfigurator), preserveUnknownFields(): ?bool
Escape hatchconfigureCrd(K8Schema\ApiextensionsApiserver\Pkg\Apis\Apiextensions\V1\CustomResourceDefinition $crd)

The container API

Klass8s\Core\Container\AbstractContainer is the base for standalone sidecar/init containers (guide) — not a manifest (no kind, no shortName()), constructed by you, not the container DI. The same surface (via ContainerTrait) is what the four AbstractContainer* workload variants add to their manifests:

GroupMethod (default)
Requiredimage(): Image
IdentitycontainerName(): string → 'app'
Speccommand(StringList), args(StringList), env(EnvConfigurator), ports(PortsConfigurator), resources(ContainerResourcesInterface), probes(ProbesConfigurator), lifecycle(LifecycleConfigurator), securityContext(SecurityContextConfigurator), volumeMounts(VolumeMountsConfigurator), imagePullPolicy(): ImagePullPolicy → IfNotPresent (Always|Never|IfNotPresent), workingDir(): ?string
Escape hatchconfigureContainer(K8Schema\Api\Core\V1\Container $container)

Classes implementing ContainerInterface themselves: AbstractContainer, AbstractContainerDeployment, AbstractContainerStatefulSet, AbstractContainerJob, AbstractContainerCronJob.

Next

  • Configurators — the full API of every builder the methods above receive
  • Manifests — lifecycle, naming, and how to choose a base class