Skip to content

Commit 95eb876

Browse files
authored
feat: set soft anti-affinity rule by default (#180)
This commit sets a soft anti-affinity rule by default to avoid scheduling multiple replicas of `coderd` on the same node.
1 parent d2ef6be commit 95eb876

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ View [our docs](https://coder.com/docs/setup/installation) for detailed installa
2525
| certs | object | Certificate that will be mounted inside Coder services. | `{"secret":{"key":"","name":""}}` |
2626
| certs.secret.key | string | Key pointing to a certificate in the secret. | `""` |
2727
| certs.secret.name | string | Name of the secret. | `""` |
28-
| coderd | object | Primary service responsible for all things Coder! | `{"affinity":{},"builtinProviderServiceAccount":{"annotations":{},"labels":{}},"devurlsHost":"","image":"","oidc":{"enableRefresh":false,"redirectOptions":{}},"podSecurityContext":{"runAsNonRoot":true,"runAsUser":1000,"seccompProfile":{"type":"RuntimeDefault"}},"replicas":1,"resources":{"limits":{"cpu":"250m","memory":"512Mi"},"requests":{"cpu":"250m","memory":"512Mi"}},"satellite":{"accessURL":"","enable":false,"primaryURL":""},"securityContext":{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"seccompProfile":{"type":"RuntimeDefault"}},"serviceAnnotations":{},"serviceNodePorts":{"http":null,"https":null},"serviceSpec":{"externalTrafficPolicy":"Local","loadBalancerIP":"","loadBalancerSourceRanges":[],"type":"LoadBalancer"},"superAdmin":{"passwordSecret":{"key":"password","name":""}},"tls":{"devurlsHostSecretName":"","hostSecretName":""},"trustProxyIP":false}` |
29-
| coderd.affinity | object | Allows specifying an affinity rule for the `coderd` deployment. If you set `coderd.replicas` to a value higher than 1, you may wish to also add a pod anti-affinity definition to ensure that multiple coderd pods are not scheduled on the same node. | `{}` |
28+
| coderd | object | Primary service responsible for all things Coder! | `{"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["coderd"]}]},"topologyKey":"kubernetes.io/hostname"},"weight":1}]}},"builtinProviderServiceAccount":{"annotations":{},"labels":{}},"devurlsHost":"","image":"","oidc":{"enableRefresh":false,"redirectOptions":{}},"podSecurityContext":{"runAsNonRoot":true,"runAsUser":1000,"seccompProfile":{"type":"RuntimeDefault"}},"replicas":1,"resources":{"limits":{"cpu":"250m","memory":"512Mi"},"requests":{"cpu":"250m","memory":"512Mi"}},"satellite":{"accessURL":"","enable":false,"primaryURL":""},"securityContext":{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"seccompProfile":{"type":"RuntimeDefault"}},"serviceAnnotations":{},"serviceNodePorts":{"http":null,"https":null},"serviceSpec":{"externalTrafficPolicy":"Local","loadBalancerIP":"","loadBalancerSourceRanges":[],"type":"LoadBalancer"},"superAdmin":{"passwordSecret":{"key":"password","name":""}},"tls":{"devurlsHostSecretName":"","hostSecretName":""},"trustProxyIP":false}` |
29+
| coderd.affinity | object | Allows specifying an affinity rule for the `coderd` deployment. The default rule prefers to schedule coderd pods on different nodes, which is only applicable if coderd.replicas is greater than 1. | `{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["coderd"]}]},"topologyKey":"kubernetes.io/hostname"},"weight":1}]}}` |
3030
| coderd.builtinProviderServiceAccount | object | Customize the built-in Kubernetes provider service account. | `{"annotations":{},"labels":{}}` |
3131
| coderd.builtinProviderServiceAccount.annotations | object | A KV mapping of annotations. See: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ | `{}` |
3232
| coderd.builtinProviderServiceAccount.labels | object | Add labels to the service account used for the built-in provider. | `{}` |

values.yaml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,20 @@ coderd:
152152
key: "password"
153153

154154
# coderd.affinity -- Allows specifying an affinity rule for the `coderd`
155-
# deployment. If you set `coderd.replicas` to a value higher than 1, you
156-
# may wish to also add a pod anti-affinity definition to ensure that
157-
# multiple coderd pods are not scheduled on the same node.
158-
affinity: {}
159-
# Example:
160-
# ```
161-
# affinity:
162-
# podAntiAffinity:
163-
# preferredDuringSchedulingIgnoredDuringExecution:
164-
# - podAffinityTerm:
165-
# labelSelector:
166-
# matchExpressions:
167-
# - key: app
168-
# operator: In
169-
# values:
170-
# - "coderd"
171-
# topologyKey: kubernetes.io/hostname
172-
# weight: 1
173-
# ```
174-
155+
# deployment. The default rule prefers to schedule coderd pods on different
156+
# nodes, which is only applicable if coderd.replicas is greater than 1.
157+
affinity:
158+
podAntiAffinity:
159+
preferredDuringSchedulingIgnoredDuringExecution:
160+
- podAffinityTerm:
161+
labelSelector:
162+
matchExpressions:
163+
- key: app.kubernetes.io/name
164+
operator: In
165+
values:
166+
- "coderd"
167+
topologyKey: kubernetes.io/hostname
168+
weight: 1
175169
# ingress -- Configure an Ingress to route traffic to Coder services.
176170
ingress:
177171
# ingress.enable -- A boolean controlling whether to create an Ingress.

0 commit comments

Comments
 (0)