Skip to content

Commit

Permalink
feat(k8s): add garden-build toleration to garden-buildkit deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Feb 27, 2021
1 parent b02c4fc commit e4bc2b7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
8 changes: 8 additions & 0 deletions core/src/plugins/kubernetes/container/build/buildkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,14 @@ const baseBuildkitDeployment: KubernetesDeployment = {
emptyDir: {},
},
],
tolerations: [
{
key: "garden-build",
operator: "Equal",
value: "true",
effect: "NoSchedule",
},
],
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,18 @@ describe("ensureBuildkit", () => {
})

// Make sure deployment is there
await api.apps.readNamespacedDeployment(buildkitDeploymentName, namespace)
const deployment = await api.apps.readNamespacedDeployment(buildkitDeploymentName, namespace)

expect(deployed).to.be.true
expect(deployment.spec.template.spec?.tolerations).to.eql([
{
key: "garden-build",
operator: "Equal",
value: "true",
effect: "NoSchedule",
tolerationSeconds: undefined,
},
])
})

it("deploys buildkit with the configured nodeSelector", async () => {
Expand Down
11 changes: 11 additions & 0 deletions docs/guides/in-cluster-building.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ clusterBuildkit:
You should also set the builder resource requests/limits. For this mode, the resource configuration applies to _each BuildKit deployment_, i.e. for _each project namespace_. See the [builder resources](../reference/providers/kubernetes.md#providersresourcesbuilder) reference for details.
The BuildKit deployments will always have the following toleration set:
```yaml
key: "garden-build",
operator: "Equal",
value: "true",
effect: "NoSchedule"
```
This allows you to set corresponding [Taints](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) on cluster nodes to control which nodes builder deployments are deployed to.
### cluster-docker
The `cluster-docker` mode installs a standalone Docker daemon into your cluster, that is then used for builds across all users of the clusters, along with a handful of other supporting services.
Expand Down

0 comments on commit e4bc2b7

Please sign in to comment.