-
Notifications
You must be signed in to change notification settings - Fork 23
Description
It may be desirable to control which kubernetes nodes chaincode runs on. For example, to use a pool of nodes specifically for running chaincode on, or to run the chaincode on the same node as the peer.
Covering all possible use cases is outside the scope of the k8s builder and should be handled with a Dynamic Admission Control using a Mutating Webhook. For example, it looks like the namespace-node-affinity webhook could be used to assign node affinity and tolerations to all pods in the FABRIC_K8S_BUILDER_NAMESPACE namespace.
Developing and deploying a webhook is not trivial though, so optionally adding basic affinity and toleration to chaincode pods may be useful for simple deployments. For example,
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
– matchExpressions:
– key: hlf-node-role/chaincode
operator: Exists
tolerations:
- key: "hlf-node-role/chaincode"
operator: "Exists"
effect: "NoSchedule"Chaincode nodes would then need a corresponding label and taint. For example,
kubectl label nodes node1 hlf-node-role/chaincode
kubectl taint nodes node1 hlf-node-role/chaincode:NoSchedule