NAME
Kubernetes::Comb::Upstream::K8s - Borrow a Comb's service from its peer Comb in another kube context
VERSION
version 0.001
SYNOPSIS
# the controlling code: every Comb borrows from its peer in dev
my $comb = Kubernetes::Comb->from_crd($cr,
upstream => sub { K8s => ( context => 'dev' ) }
);
# the same in the custom resource
upstream:
class: Kubernetes::Comb::Upstream::K8s
context: dev
namespace: platform # default: the Comb's own
name: nats # default: the Comb's own
DESCRIPTION
The layering upstream: the service comes from the peer Comb -- the same Comb, one layer up -- in another kube context. It reads the peer's Comb custom resource and nothing else, so get on combs in that namespace is all the access it needs. The custom resource only names the context; the credentials are those of the local kubeconfig.
The client for the context comes from the Comb's own ("for_context" in Kubernetes::Comb::Role::Client), synchronous or asynchronous alike. The peer is read as the Comb's "crd_class" in Kubernetes::Comb.
What cannot be read -- a context that is missing or broken, a custom resource that is not there or not accessible -- is no error: "status" reports it unreachable, and the Comb goes Blocked with the reason.
Because every Comb publishes its already resolved endpoints in status.endpoints, the peer's addresses are the right ones however many layers are behind it, and "status" reports them in via.
context
Required. The kube context the peer lives in, from the kubeconfig the Comb's own client uses.
namespace
Namespace of the peer. Default: the Comb's own.
name
Name of the peer. Default: the Comb's own.
endpoint_class
The class "endpoints" builds, Kubernetes::Comb::Endpoint.
status
my $seen = $upstream->status($comb)->get;
Future of { reachable, phase, via, context, message }: phase is the peer's, via this "context" followed by the peer's own via. Never fails: whatever keeps the peer from being read makes it unreachable, with the reason in message. So does a peer that is the Comb itself. A message also names the peer's endpoints that have no address reachable from here.
endpoints
my $endpoints = $upstream->endpoints($comb)->get;
Future of the arrayref of the peer's published endpoints that have an address reachable from here, as Kubernetes::Comb::Endpoint. When both contexts point at the same API server ("server_url" in Kubernetes::Comb::Role::Client) cluster is the peer's cluster address, else its external one; external stays the peer's. Fails with the reason when the peer cannot be read.
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.