NAME

Kubernetes::Comb::Role::Static - Comb manifests loaded from .pk8s and YAML files

VERSION

version 0.001

SYNOPSIS

# A stub that is just a file: it inherits the contract of the Mailer and
# swaps the implementation.
package MyApp::Comb::Mailer::Stub;
use Moo;
extends 'MyApp::Comb::Mailer';
with 'Kubernetes::Comb::Role::Static';

use File::ShareDir qw( dist_dir );

sub manifest_dir   { dist_dir('MyApp-Combs') }
sub manifest_files { 'mailer-stub.pk8s' }

# mailer-stub.pk8s, in the share dir of MyApp-Combs
Deployment {
  name => 'mailer',
  spec => { ... }
};
Service { name => 'mailer', spec => { ... } };

DESCRIPTION

Makes "manifests" in Kubernetes::Comb of the consuming class the resources declared in files: .pk8s files (the Perl DSL of "load" in IO::K8s) and .yaml/.yml files, multi-document YAML included ("load_yaml" in IO::K8s). The class names the files with "manifest_files", the directory relative names are resolved against with "manifest_dir".

The role goes into any Kubernetes::Comb subclass, the stub of an existing Comb class included: its manifests replaces the inherited one. A class that is only files extends Kubernetes::Comb::Static instead.

The files are parsed with the Comb's "io_k8s" in Kubernetes::Comb, so its CRD providers (or unknown_kinds => 'unstructured') decide which custom resource Kinds they may contain. They are read once per instance, on the first call of manifests; a failed read is tried again on the next call. They are static: namespace and Comb labels come from "deploy" in Kubernetes::Comb, anything that depends on "config" in Kubernetes::Comb belongs into a manifests of Perl code (an around works).

A .pk8s file is Perl code, run in-process: name only files that ship with your code, never a path from a custom resource or its config. YAML files are read as UTF-8; a .pk8s file is Perl source, so one with non-ASCII text starts with use utf8;.

manifests

The objects of all "manifest_files", in the order of the files and, within a file, in the order they are declared. Dies naming the file when one does not exist, has neither extension or does not parse.

manifest_files

Required from the consuming class: the list of the files, each a .pk8s, .yaml or .yml file, absolute or relative to "manifest_dir".

manifest_dir

The directory relative "manifest_files" are resolved against, for example the share dir of the distribution with the Comb classes. Default: none, they are taken from the current directory.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-kubernetes-comb/issues.

IRC

Join #kubernetes on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.