-
Notifications
You must be signed in to change notification settings - Fork 6
Custom affinities and tolerations #758
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds support for custom Kubernetes affinities and tolerations to the Drupal Helm chart, improving deployment flexibility and node scheduling control.
- Moves default Drupal affinity rules from templates to values.yaml for better configurability
- Adds tolerations and affinity configuration options to php, shell, backup, and cron components
- Conditionally renders resource blocks only when values are present, avoiding empty configurations
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
values.yaml | Adds tolerations and affinity configuration sections with default pod affinity rules moved from templates |
values.schema.json | Updates JSON schema to validate new tolerations and affinity fields |
drupal_tolerations_test.yaml | New test suite covering custom tolerations functionality |
drupal_node_selector_test.yaml | Updates existing tests to verify conditional rendering of node selectors |
drupal_affinity_test.yaml | New test suite covering custom affinity functionality |
shell-deployment.yaml | Implements conditional rendering for tolerations and affinity with fallback to php values |
drupal-deployment.yaml | Moves hardcoded affinity to values-based configuration with conditional rendering |
drupal-cron.yaml | Adds tolerations and affinity support to cron jobs with proper precedence |
backup-cron.yaml | Adds tolerations and affinity support to backup jobs |
}, | ||
"tolerations": { | ||
"type": ["array", "null"], | ||
"additionalProperties": { "type": "string" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tolerations field should not have additionalProperties set to string type. Tolerations is an array of objects with specific properties like key, operator, value, and effect.
"additionalProperties": { "type": "string" } | |
"items": { | |
"type": "object", | |
"properties": { | |
"key": { "type": "string" }, | |
"operator": { "type": "string" }, | |
"value": { "type": "string" }, | |
"effect": { "type": "string" } | |
}, | |
"additionalProperties": false | |
} |
Copilot uses AI. Check for mistakes.
}, | ||
"affinity": { | ||
"type": ["object", "null"], | ||
"additionalProperties": { "type": "string" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The affinity field should not have additionalProperties set to string type. Affinity is an object with complex nested structures for nodeAffinity, podAffinity, and podAntiAffinity.
"additionalProperties": { "type": "string" } | |
"properties": { | |
"nodeAffinity": { | |
"type": ["object", "null"], | |
"properties": { | |
"requiredDuringSchedulingIgnoredDuringExecution": { | |
"type": ["object", "null"], | |
"properties": { | |
"nodeSelectorTerms": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"matchExpressions": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"key": { "type": "string" }, | |
"operator": { "type": "string" }, | |
"values": { "type": "array", "items": { "type": "string" } } | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"podAffinity": { | |
"type": ["object", "null"], | |
"properties": { | |
"requiredDuringSchedulingIgnoredDuringExecution": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"labelSelector": { | |
"type": "object", | |
"properties": { | |
"matchLabels": { | |
"type": "object", | |
"additionalProperties": { "type": "string" } | |
} | |
} | |
}, | |
"topologyKey": { "type": "string" } | |
} | |
} | |
} | |
} | |
}, | |
"podAntiAffinity": { | |
"type": ["object", "null"], | |
"properties": { | |
"requiredDuringSchedulingIgnoredDuringExecution": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"labelSelector": { | |
"type": "object", | |
"properties": { | |
"matchLabels": { | |
"type": "object", | |
"additionalProperties": { "type": "string" } | |
} | |
} | |
}, | |
"topologyKey": { "type": "string" } | |
} | |
} | |
} | |
} | |
} | |
} |
Copilot uses AI. Check for mistakes.
operator: In | ||
values: | ||
- drupal | ||
{{- tpl ( .Values.php.affinity | toYaml ) . | nindent 8 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a trailing space at the end of line 189 that should be removed.
{{- tpl ( .Values.php.affinity | toYaml ) . | nindent 8 }} | |
{{- tpl ( .Values.php.affinity | toYaml ) . | nindent 8 }} |
Copilot uses AI. Check for mistakes.
Allows definition of custom node and pod affinities, along with tolerations.
nodeSelector
rulesresources
sections when no value present, instead of setting them to{}
Testing done with
helm unittest
and manually, by definingphp.nodeSelector
,php.tolerations
,php.affinity
,php.cron.nodeSelector
,php.cron.tolerations
, andphp.cron.affinity
values in various combinations, confirming expected output withhelm template
command.