NAME

Kubernetes::Comb::CRD::CombSpec - Spec of the Comb custom resource

VERSION

version 0.001

SYNOPSIS

my $spec = Kubernetes::Comb::CRD::CombSpec->new(
  class     => 'MyApp::Comb::NATS',
  dependsOn => [ 'db' ],
  config    => { cluster_size => 3 },
  upstream  => {
    class   => 'Kubernetes::Comb::Upstream::K8s',
    context => 'dev'
  }
);

# explicit "local": the key exists, its value is null
my $local = Kubernetes::Comb::CRD::CombSpec->new(
  class    => 'MyApp::Comb::NATS',
  upstream => undef
);
$local->has_upstream;   # true
$local->upstream;       # undef

DESCRIPTION

The spec of a Kubernetes::Comb::CRD::Comb, an IO::K8s class like any other with one addition: upstream keeps the difference between a key that is absent and a key that is present with null. The upstream is resolved from the first source that exists, and an explicit upstream: null in the custom resource is the answer "local" that ends the lookup.

IO::K8s drops a JSON null on the way in and never writes one on the way out -- nullable is a schema-only option there. So this class inflates itself through FROM_STRUCT, the hook "struct_to_object" in IO::K8s documents for classes the generic path would lose data of, and adds the null back in TO_JSON. The schema marks upstream nullable, so the API server keeps the null too.

class

Required. The Perl class that implements the Comb. Pointing it at a stub class selects the stub.

dependsOn

ArrayRef of the Combs this one depends on, each name or namespace/name.

config

Free-form hashref for the Comb class. Never credentials.

enabled

Tri-state: undef is automatic, false switches the Comb off, true on.

upstream

Hashref naming the upstream: class, always the fully qualified class name, plus the keys that class takes -- for Kubernetes::Comb::Upstream::K8s context, namespace and name. undef while "has_upstream" is true is the explicit "local".

has_upstream

True when the spec carries an upstream key at all, an explicit null included. This, not the truth of "upstream", says whether the custom resource has a say in the upstream resolution.

FROM_STRUCT

my $spec = Kubernetes::Comb::CRD::CombSpec->FROM_STRUCT($hashref);

Called by IO::K8s whenever a CombSpec is built from a plain structure. Behaves like the generic inflation -- a null field counts as absent, containers are copied one level -- except that upstream: null is kept. Croaks on anything but a hashref.

TO_JSON

The inherited serialization, plus upstream => undef (JSON null) when the spec holds the explicit "local".

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.