Skip to content

Conversation

@alaye-ms
Copy link
Collaborator

This just adds a passthrough for the already made CNPG node affinity field.

@xgerman
Copy link
Collaborator

xgerman commented Dec 15, 2025

Can you add this to our docs as well


// Affinity/Anti-affinity rules for Pods (cnpg passthrough)
// +optional
Affinity cnpgv1.AffinityConfiguration `json:"affinity,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for now. Affinity is a very k8s specific placement term and we are putting it on the high level. Going forward, we need to group these configs.

Signed-off-by: Alexander Laye <alaye@microsoft.com>
Copilot AI review requested due to automatic review settings January 21, 2026 16:38
Copy link
Contributor

Copilot AI left a 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 passing through CNPG's affinity configuration to allow users to control pod scheduling for DocumentDB clusters. The implementation exposes CNPG's full AffinityConfiguration type, which includes node affinity, pod affinity, pod anti-affinity, node selectors, tolerations, and topology settings.

Changes:

  • Added Affinity field to DocumentDBSpec with CNPG's AffinityConfiguration type
  • Updated CRD definitions to include the complete affinity schema (990+ lines)
  • Added documentation section for scheduling configuration

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
operator/src/api/preview/documentdb_types.go Added Affinity field to DocumentDBSpec with proper kubebuilder tags and comments
operator/src/api/preview/zz_generated.deepcopy.go Added deep copy implementation for the Affinity field
operator/src/internal/cnpg/cnpg_cluster.go Passed through documentdb.Spec.Affinity to CNPG cluster spec
operator/src/config/crd/bases/documentdb.io_dbs.yaml Generated CRD with complete affinity configuration schema
operator/documentdb-helm-chart/crds/documentdb.io_dbs.yaml Generated Helm chart CRD matching the base CRD
docs/operator-public-documentation/preview/advanced-configuration/README.md Added scheduling section with reference to CNPG documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alaye-ms alaye-ms changed the title Feature: Add nodeAffinity passthrough Feature: Add Affinity configuration passthrough Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose CNPG level scheduling through the DocumentDB object

3 participants