Skip to content

Commit

Permalink
Change handler toleration to "operator: exists" (#755)
Browse files Browse the repository at this point in the history
Since nmstate is to be used for configuration of the network
infrastructure, we want the handler to run on all nodes regardless
of taint. If a network config should not run on a given node, the
NNCP nodeSelector field can be used to accomplish that.

For example, a node with a taint of:

[map[effect:NoSchedule key:node.ocs.openshift.io/storage value:true]]

will currently keep the nmstate handler pod from running there.
However, that is not desirable since it prevents the use of nmstate
to configure networking on that storage node.

This changes the handler toleration to "operator: exists", which
will allow the handler to run on all nodes. The webhook toleration
is left alone since there is no need for that to be running on
nodes with a NoSchedule taint.

Signed-off-by: Ben Nemec <[email protected]>
  • Loading branch information
cybertron authored May 26, 2021
1 parent 203e515 commit b2bccf9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/nmstate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ func (r *NMStateReconciler) applyHandler(instance *nmstatev1beta1.NMState) error
Operator: corev1.TolerationOpExists,
Effect: corev1.TaintEffectNoSchedule,
}
operatorExistsToleration := corev1.Toleration{
Key: "",
Operator: corev1.TolerationOpExists,
}
amd64ArchOnMasterNodeSelector := map[string]string{
"beta.kubernetes.io/arch": "amd64",
"node-role.kubernetes.io/master": "",
Expand All @@ -172,7 +176,7 @@ func (r *NMStateReconciler) applyHandler(instance *nmstatev1beta1.NMState) error
data.Data["WebhookTolerations"] = []corev1.Toleration{masterExistsNoScheduleToleration}
data.Data["WebhookAffinity"] = corev1.Affinity{}
data.Data["HandlerNodeSelector"] = amd64AndCRNodeSelector
data.Data["HandlerTolerations"] = []corev1.Toleration{masterExistsNoScheduleToleration}
data.Data["HandlerTolerations"] = []corev1.Toleration{operatorExistsToleration}
data.Data["HandlerAffinity"] = corev1.Affinity{}
// TODO: This is just a place holder to make template renderer happy
// proper variable has to be read from env or CR
Expand Down

0 comments on commit b2bccf9

Please sign in to comment.