Skip to content

Commit

Permalink
Merge pull request #61 from foomo/topologySpreadConstraints
Browse files Browse the repository at this point in the history
feat: add scheduling topologySpreadConstraints
  • Loading branch information
franklinkim authored Feb 5, 2025
2 parents 9162cf3 + 767550b commit 38d9a6a
Show file tree
Hide file tree
Showing 37 changed files with 1,058 additions and 51 deletions.
2 changes: 1 addition & 1 deletion charts/contentserver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ annotations:
- name: Image Source
url: https://github.com/foomo/contentserver
version: 0.2.1
version: 0.3.0
appVersion: 1.11.2
5 changes: 3 additions & 2 deletions charts/contentserver/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# contentserver

![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.2](https://img.shields.io/badge/AppVersion-1.11.2-informational?style=flat-square)
![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.2](https://img.shields.io/badge/AppVersion-1.11.2-informational?style=flat-square)

Helm chart for the foomo Content Server.

Expand Down Expand Up @@ -150,11 +150,12 @@ Helm chart for the foomo Content Server.

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| scheduling.affinity | object | `{}` | Affinity for pod assignment |
| scheduling.affinity | object | `{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"node-role.kubernetes.io/master","operator":"In","values":[""]}]}]}}` | Affinity for pod assignment |
| scheduling.enabled | bool | `false` | Indicates wether scheduling is enabled or not |
| scheduling.nodeSelector | object | `{}` | Node labels for pod assignment |
| scheduling.priorityClass | string | `nil` | Priority class name |
| scheduling.tolerations | list | `[]` | Tolerations for pod assignment |
| scheduling.topologySpreadConstraints | list | `[{"matchLabelKeys":["pod-template-hash"],"maxSkew":1,"topologyKey":"kubernetes.io/hostname","whenUnsatisfiable":"DoNotSchedule"},{"maxSkew":1,"topologyKey":"topology.kubernetes.io/zone","whenUnsatisfiable":"ScheduleAnyway"}]` | Tolerations for pod assignment |

### Security Context

Expand Down
11 changes: 11 additions & 0 deletions charts/contentserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ spec:
{{- with .Values.scheduling.tolerations }}
tolerations:{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scheduling.topologySpreadConstraints }}
topologySpreadConstraints:
{{- $labelSelector := dict
"labelSelector" (dict
"matchLabels" (fromYaml (include "contentserver.selectorLabels" $))
)
}}
{{- range . }}
- {{ toYaml (mergeOverwrite $labelSelector .) | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}
volumes:
{{- if .Values.persistence.enabled }}
Expand Down
93 changes: 92 additions & 1 deletion charts/contentserver/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,87 @@
"affinity": {
"additionalProperties": true,
"description": "Affinity for pod assignment",
"required": [],
"properties": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"additionalProperties": false,
"properties": {
"nodeSelectorTerms": {
"items": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"matchExpressions": {
"items": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"key": {
"default": "node-role.kubernetes.io/master",
"required": [],
"title": "key",
"type": "string"
},
"operator": {
"default": "In",
"required": [],
"title": "operator",
"type": "string"
},
"values": {
"items": {
"anyOf": [
{
"required": [],
"type": "string"
}
],
"required": []
},
"required": [],
"title": "values",
"type": "array"
}
},
"required": [
"key",
"operator",
"values"
],
"type": "object"
}
],
"required": []
},
"required": [],
"title": "matchExpressions",
"type": "array"
}
},
"required": [
"matchExpressions"
],
"type": "object"
}
],
"required": []
},
"required": [],
"title": "nodeSelectorTerms",
"type": "array"
}
},
"required": [
"nodeSelectorTerms"
],
"title": "requiredDuringSchedulingIgnoredDuringExecution",
"type": "object"
}
},
"required": [
"requiredDuringSchedulingIgnoredDuringExecution"
],
"title": "affinity",
"type": "object"
},
Expand Down Expand Up @@ -873,6 +953,17 @@
"required": [],
"title": "tolerations",
"type": "array"
},
"topologySpreadConstraints": {
"description": "Tolerations for pod assignment",
"items": {
"additionalProperties": true,
"required": [],
"type": "object"
},
"required": [],
"title": "topologySpreadConstraints",
"type": "array"
}
},
"required": [],
Expand Down
27 changes: 25 additions & 2 deletions charts/contentserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ routing:
# -- Parent references
# @section -- Routing
parentRefs: []

# @schema
# type: object
# @schema
Expand Down Expand Up @@ -753,7 +753,13 @@ scheduling:
# @schema
# -- Affinity for pod assignment
# @section -- Scheduling
affinity: {}
affinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: In
values: [""]
# @schema
# type: object
# additionalProperties: true
Expand All @@ -776,6 +782,23 @@ scheduling:
# -- Priority class name
# @section -- Scheduling
priorityClass: null
# @schema
# type: array
# items:
# type: object
# additionalProperties: true
# @schema
# -- Tolerations for pod assignment
# @section -- Scheduling
topologySpreadConstraints:
- maxSkew: 1
topologyKey: "kubernetes.io/hostname"
whenUnsatisfiable: DoNotSchedule
matchLabelKeys:
- pod-template-hash
- maxSkew: 1
topologyKey: "topology.kubernetes.io/zone"
whenUnsatisfiable: ScheduleAnyway

# @schema
# type: object
Expand Down
2 changes: 1 addition & 1 deletion charts/sesamy-gtm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ annotations:
url: https://github.com/foomo/helm-charts/tree/main/charts/sesamy-gtm
- name: GTM Changelog
url: https://developers.google.com/tag-platform/tag-manager/server-side/release-notes
version: 0.2.1
version: 0.3.0
appVersion: 2.4.0
5 changes: 3 additions & 2 deletions charts/sesamy-gtm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# sesamy-gtm

![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.4.0](https://img.shields.io/badge/AppVersion-2.4.0-informational?style=flat-square)
![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.4.0](https://img.shields.io/badge/AppVersion-2.4.0-informational?style=flat-square)

Helm chart for the Sesamy GTM tagging & preview service.

Expand Down Expand Up @@ -175,11 +175,12 @@ Helm chart for the Sesamy GTM tagging & preview service.

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| scheduling.affinity | object | `{}` | Affinity for pod assignment |
| scheduling.affinity | object | `{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"node-role.kubernetes.io/master","operator":"In","values":[""]}]}]}}` | Affinity for pod assignment |
| scheduling.enabled | bool | `false` | Indicates wether scheduling is enabled or not |
| scheduling.nodeSelector | object | `{}` | Node labels for pod assignment |
| scheduling.priorityClass | string | `nil` | Priority class name |
| scheduling.tolerations | list | `[]` | Tolerations for pod assignment |
| scheduling.topologySpreadConstraints | list | `[{"matchLabelKeys":["pod-template-hash"],"maxSkew":1,"topologyKey":"kubernetes.io/hostname","whenUnsatisfiable":"DoNotSchedule"},{"maxSkew":1,"topologyKey":"topology.kubernetes.io/zone","whenUnsatisfiable":"ScheduleAnyway"}]` | Tolerations for pod assignment |

### Service Account

Expand Down
11 changes: 11 additions & 0 deletions charts/sesamy-gtm/templates/collect/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ spec:
{{- with .Values.scheduling.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scheduling.topologySpreadConstraints }}
topologySpreadConstraints:
{{ $labelSelector := dict
"labelSelector" (dict
"matchLabels" (include "sesamy.gtm.collect.selectorLabels" $)
)
}}
{{- range . }}
- {{ toYaml (mergeOverwrite $labelSelector .) | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.collect.extraVolumes }}
volumes: {{- toYaml . | nindent 8 }}
Expand Down
11 changes: 11 additions & 0 deletions charts/sesamy-gtm/templates/preview/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ spec:
{{- with .Values.scheduling.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scheduling.topologySpreadConstraints }}
topologySpreadConstraints:
{{ $labelSelector := dict
"labelSelector" (dict
"matchLabels" (include "sesamy.gtm.preview.selectorLabels" $)
)
}}
{{- range . }}
- {{ toYaml (mergeOverwrite $labelSelector .) | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}
volumes:
- name: gtm-preview-proxy-config
Expand Down
12 changes: 12 additions & 0 deletions charts/sesamy-gtm/templates/tagging/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ spec:
{{- with .Values.scheduling.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scheduling.topologySpreadConstraints }}
topologySpreadConstraints:
{{ $labelSelector := dict
"labelSelector" (dict
"matchLabels" (include "sesamy.gtm.tagging.selectorLabels" $)
)
}}
{{- range . }}
- {{ toYaml (mergeOverwrite $labelSelector .) | nindent 10 }}
{{- end }}
{{- end }}

{{- end }}
{{- if or .Values.gtm.googleApplicationCredentials .Values.tagging.extraVolumes }}
volumes:
Expand Down
93 changes: 92 additions & 1 deletion charts/sesamy-gtm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,87 @@
"affinity": {
"additionalProperties": true,
"description": "Affinity for pod assignment",
"required": [],
"properties": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"additionalProperties": false,
"properties": {
"nodeSelectorTerms": {
"items": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"matchExpressions": {
"items": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"key": {
"default": "node-role.kubernetes.io/master",
"required": [],
"title": "key",
"type": "string"
},
"operator": {
"default": "In",
"required": [],
"title": "operator",
"type": "string"
},
"values": {
"items": {
"anyOf": [
{
"required": [],
"type": "string"
}
],
"required": []
},
"required": [],
"title": "values",
"type": "array"
}
},
"required": [
"key",
"operator",
"values"
],
"type": "object"
}
],
"required": []
},
"required": [],
"title": "matchExpressions",
"type": "array"
}
},
"required": [
"matchExpressions"
],
"type": "object"
}
],
"required": []
},
"required": [],
"title": "nodeSelectorTerms",
"type": "array"
}
},
"required": [
"nodeSelectorTerms"
],
"title": "requiredDuringSchedulingIgnoredDuringExecution",
"type": "object"
}
},
"required": [
"requiredDuringSchedulingIgnoredDuringExecution"
],
"title": "affinity",
"type": "object"
},
Expand Down Expand Up @@ -1444,6 +1524,17 @@
"required": [],
"title": "tolerations",
"type": "array"
},
"topologySpreadConstraints": {
"description": "Tolerations for pod assignment",
"items": {
"additionalProperties": true,
"required": [],
"type": "object"
},
"required": [],
"title": "topologySpreadConstraints",
"type": "array"
}
},
"required": [],
Expand Down
Loading

0 comments on commit 38d9a6a

Please sign in to comment.