Add support for tolerations, nodeSelector, and resources in NBRoutingPeer deployment spec

This commit is contained in:
athul
2025-08-07 21:58:39 +03:00
committed by M. Essam
parent a24beb58d9
commit 877c894248
@@ -158,6 +158,8 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
}, },
}, },
Spec: corev1.PodSpec{ Spec: corev1.PodSpec{
NodeSelector: nbrp.Spec.NodeSelector,
Tolerations: nbrp.Spec.Tolerations,
Containers: []corev1.Container{ Containers: []corev1.Container{
{ {
Name: "netbird", Name: "netbird",
@@ -186,6 +188,7 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
}, },
}, },
}, },
Resources: nbrp.Spec.Resources,
}, },
}, },
}, },
@@ -226,6 +229,8 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
"app.kubernetes.io/name": "netbird-router", "app.kubernetes.io/name": "netbird-router",
}, },
} }
updatedDeployment.Spec.Template.Spec.Tolerations = nbrp.Spec.Tolerations
updatedDeployment.Spec.Template.Spec.NodeSelector = nbrp.Spec.NodeSelector
updatedDeployment.Spec.Template.ObjectMeta.Labels = map[string]string{ updatedDeployment.Spec.Template.ObjectMeta.Labels = map[string]string{
"app.kubernetes.io/name": "netbird-router", "app.kubernetes.io/name": "netbird-router",
} }
@@ -258,6 +263,7 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
}, },
}, },
} }
updatedDeployment.Spec.Template.Spec.Containers[0].Resources = nbrp.Spec.Resources
patch := client.StrategicMergeFrom(&routingPeerDeployment) patch := client.StrategicMergeFrom(&routingPeerDeployment)
bs, _ := patch.Data(updatedDeployment) bs, _ := patch.Data(updatedDeployment)