Skip to content

Control which kubernetes nodes chaincode runs on #228

@jt-nti

Description

@jt-nti

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions