Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-5423 - fix pod affinity rule for pods with pvc on dev #725

Merged
merged 9 commits into from
Dec 5, 2023
4 changes: 4 additions & 0 deletions ansible/group_vars/all/affinity.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
AFFINITY_ENABLE: true
AFFINITY_MONGO_TOPOLOGY_KEY: kubernetes.io/hostname
AFFINITY_POSTGRES_TOPOLOGY_KEY: kubernetes.io/hostname
AFFINITY_REDIS_TOPOLOGY_KEY: kubernetes.io/hostname
AFFINITY_STORAGE_TOPOLOGY_KEY: kubernetes.io/hostname
ANIT_AFFINITY_NODEPOOL_ENABLE: true
ANIT_AFFINITY_NODEPOOL_TOPOLOGY_KEY: "cloud.ionos.com/nodepool-name"
4 changes: 4 additions & 0 deletions ansible/group_vars/develop/affinity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AFFINITY_MONGO_TOPOLOGY_KEY: kubernetes.io/os
AFFINITY_POSTGRES_TOPOLOGY_KEY: kubernetes.io/os
AFFINITY_REDIS_TOPOLOGY_KEY: kubernetes.io/os
AFFINITY_STORAGE_TOPOLOGY_KEY: kubernetes.io/os
1 change: 1 addition & 0 deletions ansible/roles/dof_mongo/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: deployment.yml.j2
apply: yes
when: WITH_DATABASES

- name: remove Deployment
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/dof_mongo/templates/deployment.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ spec:
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
- weight: 9
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
topologyKey: {{ AFFINITY_MONGO_TOPOLOGY_KEY }}
namespaceSelector: {}
{% endif %}
1 change: 1 addition & 0 deletions ansible/roles/dof_postgresql/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: deployment.yml.j2
apply: yes
when: WITH_DATABASES

- name: remove Deployment
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/dof_postgresql/templates/deployment.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ spec:
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
topologyKey: {{ AFFINITY_POSTGRES_TOPOLOGY_KEY }}
namespaceSelector: {}
{% endif %}
1 change: 1 addition & 0 deletions ansible/roles/storage/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: deployment.yml.j2
apply: yes

- name: Ingress
environment:
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/storage/templates/deployment.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
topologyKey: {{ AFFINITY_STORAGE_TOPOLOGY_KEY }}
namespaceSelector: {}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down