mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Add groups option to cluster proxy (#297)
This change adds an option to specify groups a cluster proxy peer is a member of. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added optional `spec.groups` to the ClusterProxy custom resource to associate group references by `id`, `name`, or `localRef`. * CRD schema includes OpenAPI validation to enforce that each group reference specifies exactly one selector. * **Bug Fixes** * Improved deep-copy behavior for ClusterProxy spec so group references are copied safely and don’t share underlying slices. * **Documentation** * Updated API reference docs and README API table to include the new `groups` field. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -67,6 +67,16 @@ func (r *ClusterProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request
|
||||
WithEphemeral(true).
|
||||
WithAllowExtraDnsLabels(true),
|
||||
)
|
||||
for _, group := range clusterProxy.Spec.Groups {
|
||||
switch {
|
||||
case group.ID != nil:
|
||||
setupKeyAC.Spec.AutoGroups = append(setupKeyAC.Spec.AutoGroups, *nbv1alpha1ac.GroupReference().WithID(*group.ID))
|
||||
case group.Name != nil:
|
||||
setupKeyAC.Spec.AutoGroups = append(setupKeyAC.Spec.AutoGroups, *nbv1alpha1ac.GroupReference().WithName(*group.Name))
|
||||
case group.LocalRef != nil:
|
||||
setupKeyAC.Spec.AutoGroups = append(setupKeyAC.Spec.AutoGroups, *nbv1alpha1ac.GroupReference().WithLocalRef(*group.LocalRef))
|
||||
}
|
||||
}
|
||||
err = r.Client.Apply(ctx, setupKeyAC, client.ForceOwnership)
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
|
||||
Reference in New Issue
Block a user