NAME

Kubernetes::Comb::Endpoint - Value object for an endpoint a Comb offers

VERSION

version 0.001

SYNOPSIS

my $ep = Kubernetes::Comb::Endpoint->new(
  name     => 'client',
  port     => 4222,
  cluster  => 'nats.platform.svc:4222',
  external => 'nats.example.com:4222'
);
$ep->protocol;   # tcp

my $status_entry = $ep->to_crd;                           # CombEndpoint
my $again = Kubernetes::Comb::Endpoint->from_crd($status_entry);

DESCRIPTION

What a Comb offers under one name: protocol and port as the class declares them, and the addresses it is reached at once resolved -- cluster from inside the cluster, external from outside. With an active upstream both point at the upstream. Immutable; a changed address is a new object.

name

Required. The name the Comb class declares the endpoint under, e.g. client. It names the port of the Service the bridge makes, so it must be a DNS-1123 label (see "name_problem"); construction dies on one that is not.

protocol

Defaults to tcp.

port

Required. The port the endpoint is offered on.

cluster

Optional. Address inside the cluster as host:port; has_cluster tells whether there is one.

external

Optional. Address from outside the cluster as host:port; has_external tells whether there is one.

name_problem

my $problem = Kubernetes::Comb::Endpoint->name_problem($name);

Why $name cannot be the name of an endpoint, or nothing when it can: it must be a DNS-1123 label -- lowercase letters, digits and -, alphanumeric at both ends, at most 63 characters -- because the bridge uses it as the name of a Service port. Works as class and as instance method.

crd_endpoint_class

The status-entry class "to_crd" builds, Kubernetes::Comb::CRD::CombEndpoint. Override it in a subclass to build another.

from_crd

my $ep = Kubernetes::Comb::Endpoint->from_crd($combendpoint);

Builds an endpoint from a Kubernetes::Comb::CRD::CombEndpoint, as found in status.endpoints of a Comb custom resource. A missing protocol becomes tcp. Dies when name or port is missing.

to_crd

$status->endpoints([ map { $_->to_crd } @endpoints ]);

Returns the endpoint as a Kubernetes::Comb::CRD::CombEndpoint for status.endpoints.

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.