Skip to content

Commit

Permalink
Merge pull request #62 from MinaFoundation/pm-2039
Browse files Browse the repository at this point in the history
PM-2039 Support custom nodepool
  • Loading branch information
piotr-iohk authored Nov 6, 2024
2 parents 38c343e + 47673df commit 38d6a88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ These environment variables control the program's runtime:
Configuration related to infra/operations.

- `SPREAD_MAX_SKEW` - The degree of the spread of Stateless Verification workers among the nodes, see: [`maxSkew`](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#spread-constraint-definition). Default: `1`.
- `K8S_NODE_POOL` (optional) - Name of the node pool to spin pods on.

### Stateless Verification Tool Configuration

Expand Down
6 changes: 6 additions & 0 deletions uptime_service_validation/coordinator/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ def setUpValidatorPods(time_intervals, logging, worker_image, worker_tag):
volume_mounts=[auth_volume_mount],
)

nodepool = os.environ.get("K8S_NODE_POOL")
node_selector = {"karpenter.sh/nodepool": nodepool} if nodepool else None
tolerations = [{"key": "karpenter.sh/nodepool", "operator": "Exists"}] if nodepool else None

pod_annotations = {"karpenter.sh/do-not-disrupt": "true"}
pod_labels = {"job-group-name": job_group_name}

Expand All @@ -250,6 +254,8 @@ def setUpValidatorPods(time_intervals, logging, worker_image, worker_tag):
annotations=pod_annotations, labels=pod_labels
),
spec=client.V1PodSpec(
node_selector=node_selector,
tolerations=tolerations,
topology_spread_constraints=[
client.V1TopologySpreadConstraint(
max_skew=int(os.environ.get("SPREAD_MAX_SKEW", "1")),
Expand Down

0 comments on commit 38d6a88

Please sign in to comment.