Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
feat: Add anti-affinity labels to ensure 1 GPU-enabled pod per node
Browse files Browse the repository at this point in the history
Due to the lack of support for GPU virtualization by Weaviate (see
weaviate/t2v-transformers-models#39
for details), we need to ensure each pod that uses the GPU, utilizes the
full pod without sharing it.

The way to ensure this is to schedule each GPU enabled pod to its own
dedicated node using Kubernetes's anti-affinity feature.

This addresses this to make it easy to run clusters with GPU support.
  • Loading branch information
gauthamchandra committed Dec 29, 2022
1 parent 08e3d5e commit c0f815b
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
weaviate/charts
weaviate/weaviate-*.tgz
#weaviate/weaviate-*.tgz
weaviate/weaviate.tgz
weaviate/out.yml
tmp/*
Expand Down
13 changes: 13 additions & 0 deletions weaviate/templates/contextionaryDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
name: contextionary
app: contextionary
requiresSoleAccessToGpu: 'true'
spec:
replicas: {{ index .Values "modules" "text2vec-contextionary" "replicas" }}
selector:
Expand All @@ -16,6 +17,18 @@ spec:
labels:
app: contextionary
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: requiresSoleAccessToGpu
operator: In
values:
- 'true'
topologyKey: kubernetes.io/hostname
containers:
- name: contextionary
image: {{ index .Values "modules" "text2vec-contextionary" "registry" }}/{{ index .Values "modules" "text2vec-contextionary" "repo" }}:{{ index .Values "modules" "text2vec-contextionary" "tag" }}
Expand Down
13 changes: 13 additions & 0 deletions weaviate/templates/img2vecNeuralDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
name: {{ index .Values "modules" "img2vec-neural" "fullnameOverride" }}
app: {{ index .Values "modules" "img2vec-neural" "fullnameOverride" }}
requiresSoleAccessToGpu: 'true'
spec:
replicas: {{ index .Values "modules" "img2vec-neural" "replicas" }}
selector:
Expand All @@ -16,6 +17,18 @@ spec:
labels:
app: {{ index .Values "modules" "img2vec-neural" "fullnameOverride" }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: requiresSoleAccessToGpu
operator: In
values:
- 'true'
topologyKey: kubernetes.io/hostname
containers:
- name: {{ index .Values "modules" "img2vec-neural" "fullnameOverride" }}
image: {{ index .Values "modules" "img2vec-neural" "registry" }}/{{ index .Values "modules" "img2vec-neural" "repo" }}:{{ index .Values "modules" "img2vec-neural" "tag" }}
Expand Down
13 changes: 13 additions & 0 deletions weaviate/templates/multi2vecClipDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
name: {{ index .Values "modules" "multi2vec-clip" "fullnameOverride" }}
app: {{ index .Values "modules" "multi2vec-clip" "fullnameOverride" }}
requiresSoleAccessToGpu: 'true'
spec:
replicas: {{ index .Values "modules" "multi2vec-clip" "replicas" }}
selector:
Expand All @@ -16,6 +17,18 @@ spec:
labels:
app: {{ index .Values "modules" "multi2vec-clip" "fullnameOverride" }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: requiresSoleAccessToGpu
operator: In
values:
- 'true'
topologyKey: kubernetes.io/hostname
containers:
- name: {{ index .Values "modules" "multi2vec-clip" "fullnameOverride" }}
image: {{ index .Values "modules" "multi2vec-clip" "registry" }}/{{ index .Values "modules" "multi2vec-clip" "repo" }}:{{ index .Values "modules" "multi2vec-clip" "tag" }}
Expand Down
13 changes: 13 additions & 0 deletions weaviate/templates/nerTransformersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
name: {{ index .Values "modules" "ner-transformers" "fullnameOverride" }}
app: {{ index .Values "modules" "ner-transformers" "fullnameOverride" }}
requiresSoleAccessToGpu: 'true'
spec:
replicas: {{ index .Values "modules" "ner-transformers" "replicas" }}
selector:
Expand All @@ -16,6 +17,18 @@ spec:
labels:
app: {{ index .Values "modules" "ner-transformers" "fullnameOverride" }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: requiresSoleAccessToGpu
operator: In
values:
- 'true'
topologyKey: kubernetes.io/hostname
containers:
- name: {{ index .Values "modules" "ner-transformers" "fullnameOverride" }}
image: {{ index .Values "modules" "ner-transformers" "registry" }}/{{ index .Values "modules" "ner-transformers" "repo" }}:{{ index .Values "modules" "ner-transformers" "tag" }}
Expand Down
13 changes: 13 additions & 0 deletions weaviate/templates/qnaTransformersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
name: {{ index .Values "modules" "qna-transformers" "fullnameOverride" }}
app: {{ index .Values "modules" "qna-transformers" "fullnameOverride" }}
requiresSoleAccessToGpu: 'true'
spec:
replicas: {{ index .Values "modules" "qna-transformers" "replicas" }}
selector:
Expand All @@ -16,6 +17,18 @@ spec:
labels:
app: {{ index .Values "modules" "qna-transformers" "fullnameOverride" }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: requiresSoleAccessToGpu
operator: In
values:
- 'true'
topologyKey: kubernetes.io/hostname
containers:
- name: {{ index .Values "modules" "qna-transformers" "fullnameOverride" }}
image: {{ index .Values "modules" "qna-transformers" "registry" }}/{{ index .Values "modules" "qna-transformers" "repo" }}:{{ index .Values "modules" "qna-transformers" "tag" }}
Expand Down
13 changes: 13 additions & 0 deletions weaviate/templates/sumTransformersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
name: {{ index .Values "modules" "sum-transformers" "fullnameOverride" }}
app: {{ index .Values "modules" "sum-transformers" "fullnameOverride" }}
requiresSoleAccessToGpu: 'true'
spec:
replicas: {{ index .Values "modules" "sum-transformers" "replicas" }}
selector:
Expand All @@ -16,6 +17,18 @@ spec:
labels:
app: {{ index .Values "modules" "sum-transformers" "fullnameOverride" }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: requiresSoleAccessToGpu
operator: In
values:
- 'true'
topologyKey: kubernetes.io/hostname
containers:
- name: {{ index .Values "modules" "sum-transformers" "fullnameOverride" }}
image: {{ index .Values "modules" "sum-transformers" "registry" }}/{{ index .Values "modules" "sum-transformers" "repo" }}:{{ index .Values "modules" "sum-transformers" "tag" }}
Expand Down
13 changes: 13 additions & 0 deletions weaviate/templates/transformersInferenceDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
name: {{ index .Values "modules" "text2vec-transformers" "fullnameOverride" }}
app: {{ index .Values "modules" "text2vec-transformers" "fullnameOverride" }}
requiresSoleAccessToGpu: 'true'
spec:
replicas: {{ index .Values "modules" "text2vec-transformers" "replicas" }}
selector:
Expand All @@ -16,6 +17,18 @@ spec:
labels:
app: {{ index .Values "modules" "text2vec-transformers" "fullnameOverride" }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: requiresSoleAccessToGpu
operator: In
values:
- 'true'
topologyKey: kubernetes.io/hostname
containers:
- name: {{ index .Values "modules" "text2vec-transformers" "fullnameOverride" }}
image: {{ index .Values "modules" "text2vec-transformers" "registry" }}/{{ index .Values "modules" "text2vec-transformers" "repo" }}:{{ index .Values "modules" "text2vec-transformers" "tag" }}
Expand Down
Binary file added weaviate/weaviate-15.2.0.tgz
Binary file not shown.

0 comments on commit c0f815b

Please sign in to comment.