Allow references to groups by name (#195)

Group names are unique so we can safely use the name as a reference
method to groups. This makes assigning resources created in the cluster
to groups that already exist a lot easier.
This commit is contained in:
Philip Laine
2026-04-23 13:12:09 +02:00
committed by GitHub
parent 1a593dafc2
commit 99ef70603f
14 changed files with 139 additions and 71 deletions
@@ -52,10 +52,10 @@ spec:
items:
properties:
id:
description: ID is the id of a resource in the Netbird API.
description: ID is the id of the group.
type: string
localRef:
description: LocalReference is a reference to a object in the
description: LocalReference is a reference to a group in the
same namespace.
properties:
name:
@@ -69,11 +69,13 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
name:
description: Name is the name of the group.
type: string
type: object
x-kubernetes-validations:
- message: exactly one of id or localRef must be set
rule: (has(self.id) && !has(self.localRef)) || (!has(self.id)
&& has(self.localRef))
- message: Exactly one of id, name, or localRef must be set
rule: (has(self.id)?1:0)+(has(self.name)?1:0)+(has(self.localRef)?1:0)==1
type: array
networkRouterRef:
description: NetworkRouterRef is a reference to the network and router
@@ -52,10 +52,10 @@ spec:
items:
properties:
id:
description: ID is the id of a resource in the Netbird API.
description: ID is the id of the group.
type: string
localRef:
description: LocalReference is a reference to a object in the
description: LocalReference is a reference to a group in the
same namespace.
properties:
name:
@@ -69,11 +69,13 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
name:
description: Name is the name of the group.
type: string
type: object
x-kubernetes-validations:
- message: exactly one of id or localRef must be set
rule: (has(self.id) && !has(self.localRef)) || (!has(self.id)
&& has(self.localRef))
- message: Exactly one of id, name, or localRef must be set
rule: (has(self.id)?1:0)+(has(self.name)?1:0)+(has(self.localRef)?1:0)==1
type: array
duration:
description: Duration sets how long the setup key is valid for.