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 - Inter-pod affinity and anti-affinity #4600

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: amqp-files
app.kubernetes.io/part-of: schulcloud-verbund
spec:
replicas: {{ AMQP_FILE_STORAGE_REPLICAS|default("1", true) }}
strategy:
Expand All @@ -21,12 +22,26 @@ spec:
metadata:
labels:
app: amqp-files
app.kubernetes.io/part-of: schulcloud-verbund
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: amqp-files
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
app: api
cronjob: delete-s3-files
app.kubernetes.io/part-of: schulcloud-verbund
name: api-delete-s3-files-cronjob
spec:
concurrencyPolicy: Forbid
Expand All @@ -13,9 +14,27 @@ spec:
labels:
app: api
cronjob: delete-s3-files
app.kubernetes.io/part-of: schulcloud-verbund
spec:
template:
labels:
app: api
cronjob: delete-s3-files
app.kubernetes.io/part-of: schulcloud-verbund
spec:
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: delete-s3-files-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api-files
app.kubernetes.io/part-of: schulcloud-verbund
spec:
replicas: {{ API_FILE_STORAGE_REPLICAS|default("1", true) }}
strategy:
Expand All @@ -21,12 +22,26 @@ spec:
metadata:
labels:
app: api-files
app.kubernetes.io/part-of: schulcloud-verbund
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api-files
image: {{ SCHULCLOUD_SERVER_IMAGE }}:file-storage-{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api-fwu
app.kubernetes.io/part-of: schulcloud-verbund
spec:
replicas: {{ API_FWU_LEARNING_CONTENTS_REPLICAS|default("1", true) }}
strategy:
Expand All @@ -21,12 +22,26 @@ spec:
metadata:
labels:
app: api-fwu
app.kubernetes.io/part-of: schulcloud-verbund
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api-fwu
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
15 changes: 15 additions & 0 deletions ansible/roles/schulcloud-server-core/templates/deployment.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api
app.kubernetes.io/part-of: schulcloud-verbund
spec:
replicas: {{ API_REPLICAS|default("1", true) }}
strategy:
Expand All @@ -21,12 +22,26 @@ spec:
metadata:
labels:
app: api
app.kubernetes.io/part-of: schulcloud-verbund
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: management-deployment
app.kubernetes.io/part-of: schulcloud-verbund
spec:
replicas: {{ API_MANAGEMENT_REPLICAS|default("1", true) }}
strategy:
Expand All @@ -20,12 +21,26 @@ spec:
metadata:
labels:
app: management-deployment
app.kubernetes.io/part-of: schulcloud-verbund
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api-ldapsync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
name: api-ldapsync-full-cronjob
spec:
schedule: "{{ SERVER_LDAP_SYNC_FULL_CRONJOB|default("0 3 * * 3,6", true) }}"
Expand All @@ -12,7 +13,24 @@ spec:
spec:
activeDeadlineSeconds: {{ SERVER_LDAP_SYNC_FULL_CRONJOB_TIMEOUT|default("39600", true) }}
template:
metadata:
labels:
app: api-ldapsync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
spec:
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api-ldapsync-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api-worker
app.kubernetes.io/part-of: schulcloud-verbund
spec:
replicas: {{ API_WORKER_REPLICAS|default("2", true) }}
strategy:
Expand All @@ -21,12 +22,26 @@ spec:
metadata:
labels:
app: api-worker
app.kubernetes.io/part-of: schulcloud-verbund
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api-worker
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,35 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api-tsp-sync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
name: api-tsp-sync-base-cronjob
spec:
schedule: "{{ SERVER_TSP_SYNC_BASE_CRONJOB|default("9 3 * * *", true) }}"
jobTemplate:
metadata:
labels:
app: api-tsp-sync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
spec:
template:
metadata:
labels:
app: api-tsp-sync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
spec:
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api-tsp-sync-base-cronjob
image: schulcloud/infra-tools:latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api-tsp-sync
app.kubernetes.io/part-of: schulcloud-verbund
spec:
replicas: {{ API_TSP_REPLICAS|default("1", true) }}
strategy:
Expand All @@ -21,12 +22,26 @@ spec:
metadata:
labels:
app: api-tsp-sync
app.kubernetes.io/part-of: schulcloud-verbund
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api-tsp-sync
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,35 @@ metadata:
namespace: {{ NAMESPACE }}
labels:
app: api-tsp-sync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
name: api-tsp-sync-school-cronjob
spec:
schedule: "{{ SERVER_TSP_SYNC_SCHOOL_CRONJOB|default("39 3 * * *", true) }}"
jobTemplate:
metadata:
labels:
app: api-tsp-sync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
spec:
template:
metadata:
labels:
app: api-tsp-sync-cronjob
app.kubernetes.io/part-of: schulcloud-verbund
spec:
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
containers:
- name: api-tsp-sync-school-cronjob
image: schulcloud/infra-tools:latest
Expand Down