derive an agent's backend hosts into the egress allow list at the controller
This commit is contained in:
parent
4f32948a97
commit
c5a876b845
1 changed files with 950 additions and 25 deletions
|
|
@ -7,6 +7,11 @@ export interface AllowedDomain {
|
|||
domain: string;
|
||||
/** Absent for an entry that holds for every agent in the swarm. */
|
||||
agent?: string;
|
||||
/**
|
||||
* Kept by the controller from the agent's backend environment: shown as
|
||||
* automatic, and the route refuses to remove it.
|
||||
*/
|
||||
derived?: boolean;
|
||||
}
|
||||
|
||||
export const ALLOWED_DOMAINS_URL = "/api/egress/allowed-domains";
|
||||
|
|
@ -28,10 +33,12 @@ export function entriesFor(
|
|||
export function allowedSummary(shown: AllowedDomain[]): string {
|
||||
if (shown.length === 0) return "none added";
|
||||
const swarmWide = shown.filter((e) => e.agent === undefined).length;
|
||||
const own = shown.length - swarmWide;
|
||||
const automatic = shown.filter((e) => e.derived === true).length;
|
||||
const own = shown.length - swarmWide - automatic;
|
||||
return [
|
||||
swarmWide > 0 ? `${swarmWide} swarm-wide` : null,
|
||||
own > 0 ? `${own} for this agent` : null,
|
||||
automatic > 0 ? `${automatic} automatic` : null,
|
||||
]
|
||||
.filter((part) => part !== null)
|
||||
.join(", ");
|
||||
|
|
|
|||
Loading…
Reference in a new issue