Skip to content

chore(kubernetes): add podAntiAffinity#38954

Merged
mergify[bot] merged 1 commit intomainfrom
chore
Feb 11, 2026
Merged

chore(kubernetes): add podAntiAffinity#38954
mergify[bot] merged 1 commit intomainfrom
chore

Conversation

@hongbo-miao
Copy link
Owner

No description provided.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 11, 2026
@mergify
Copy link
Contributor

mergify bot commented Feb 11, 2026

🧪 CI Insights

Here's what we observed from your CI run for 98f0c92.

🟢 All jobs passed!

But CI Insights is watching 👀

@mergify mergify bot merged commit e89ac66 into main Feb 11, 2026
317 of 318 checks passed
@sonarqubecloud
Copy link

@mergify mergify bot deleted the chore branch February 11, 2026 08:47
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hongbo-miao, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the deployment strategy for Grafana, NATS, and Valkey by adding topology spread constraints to their respective Helm charts. It also removes MLflow configurations. The topology spread constraints ensure that pods are distributed across the cluster to improve availability and resilience. Additionally, the replica count for Valkey has been reduced.

Highlights

  • Grafana Topology Spread Constraints: Added topologySpreadConstraints to Grafana helm charts to control pod placement across the cluster.
  • MLflow Removal: Removed MLflow related files and configurations from the argo-cd project.
  • NATS Topology Spread Constraints: Added topologySpreadConstraints to NATS helm chart to control pod placement across the cluster.
  • Valkey Topology Spread Constraints: Added topologySpreadConstraints to Valkey helm chart to control pod placement across the cluster.
  • Valkey Replica Count: Reduced the number of Valkey replicas from 3 to 2.
Changelog
  • kubernetes/argo-cd/projects/aws/production-hm/grafana/environments/production/helm-chart/values.yaml
    • Updated Grafana helm chart to add topologySpreadConstraints.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/application-set.yaml
    • Removed MLflow application set.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/config.yaml
    • Removed MLflow environment configuration.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/helm-chart/values.yaml
    • Removed MLflow helm chart values.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/justfile
    • Removed MLflow justfile.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/kubernetes-manifests/hm-mlflow-certificate.yaml
    • Removed MLflow certificate manifest.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/kubernetes-manifests/hm-mlflow-ingress.yaml
    • Removed MLflow ingress manifest.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/kubernetes-manifests/hm-mlflow-secret.yaml
    • Removed MLflow secret manifest.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/secrets/hm-mlflow-secret.unsealed.yaml.template
    • Removed MLflow unsealed secret template.
  • kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/set-up/postgres/initialize.sql
    • Removed MLflow postgres initialization script.
  • kubernetes/argo-cd/projects/nebius/production-hm/grafana/environments/production/helm-chart/values.yaml
    • Updated Grafana helm chart to add topologySpreadConstraints.
  • kubernetes/argo-cd/projects/nebius/production-hm/mlflow/environments/production/helm-chart/values.yaml
    • Added podAntiAffinity to the MLflow helm chart.
  • kubernetes/argo-cd/projects/nebius/production-hm/nats/environments/production/helm-chart/values.yaml
    • Added topologySpreadConstraints to the NATS helm chart.
  • kubernetes/argo-cd/projects/nebius/production-hm/skypilot-valkey/environments/production/helm-chart/values.yaml
    • Added topologySpreadConstraints to the Valkey helm chart and reduced the replica count.
Activity
  • The PR author, hongbo-miao, has made changes to improve pod placement and remove MLflow configurations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces pod anti-affinity and topology spread constraints to several services (Grafana, MLflow, NATS, Valkey) to improve their high availability by distributing pods across different nodes. This is a good practice. The PR also removes the MLflow application from the aws/production-hm environment. I've found one critical issue with a typo in a topology key that will likely cause deployment failure, and have also provided a recommendation regarding replica count for a stateful service. Please see the detailed comments.

@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Service Removals

    • MLflow deployment removed from AWS production environment
  • Infrastructure Improvements

    • Enhanced pod scheduling constraints across Grafana, NATS, and Valkey to improve reliability and resource distribution
    • Optimized resource allocation for Grafana deployments
    • Adjusted replica counts for better resource efficiency

Walkthrough

The pull request removes the complete MLflow production deployment from AWS infrastructure and configures pod topology spread constraints and scheduling policies across multiple Kubernetes deployments in both AWS and Nebius environments for improved pod distribution.

Changes

Cohort / File(s) Summary
Grafana topology and resource updates (AWS)
kubernetes/argo-cd/projects/aws/production-hm/grafana/environments/production/helm-chart/values.yaml
Added topologySpreadConstraints with hostname-based pod spreading (maxSkew 1, DoNotSchedule), extended resource section with memory requests/limits, and updated chart source URL from grafana to grafana-community.
MLflow removal (AWS)
kubernetes/argo-cd/projects/aws/production-hm/mlflow/application-set.yaml, kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/config.yaml, kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/helm-chart/values.yaml, kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/justfile, kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/kubernetes-manifests/hm-mlflow-*.yaml, kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/secrets/hm-mlflow-secret.unsealed.yaml.template, kubernetes/argo-cd/projects/aws/production-hm/mlflow/environments/production/set-up/postgres/initialize.sql
Complete removal of MLflow production deployment infrastructure including ApplicationSet manifest, configuration files, Helm values, certificate, ingress, sealed secret, secret template, database initialization script, and justfile sealing rule.
Grafana topology updates (Nebius)
kubernetes/argo-cd/projects/nebius/production-hm/grafana/environments/production/helm-chart/values.yaml
Added topologySpreadConstraints with hostname-based pod spreading (maxSkew 1, DoNotSchedule) and updated chart source URL reference.
Pod scheduling constraints (Nebius)
kubernetes/argo-cd/projects/nebius/production-hm/mlflow/environments/production/helm-chart/values.yaml, kubernetes/argo-cd/projects/nebius/production-hm/nats/environments/production/helm-chart/values.yaml, kubernetes/argo-cd/projects/nebius/production-hm/skypilot-valkey/environments/production/helm-chart/values.yaml
MLflow: added pod anti-affinity constraints; NATS: added topologySpreadConstraints to pod template; Valkey: reduced replicas from 3 to 2 and added topologySpreadConstraints with hostname-based spreading.

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
kubernetes/argo-cd/projects/nebius/production-hm/mlflow/environments/production/helm-chart/values.yaml (1)

56-62: Inconsistent scheduling strategy vs. other services in this PR.

All other services (Grafana, NATS, Valkey) use topologySpreadConstraints with maxSkew: 1, while MLflow uses podAntiAffinity with requiredDuringSchedulingIgnoredDuringExecution. The latter is strictly harder — with replicaCount: 3 (Line 5), scheduling will fail if fewer than 3 distinct nodes are available, whereas topologySpreadConstraints allows a skewed distribution (e.g., 2+1 on 2 nodes).

If this is intentional (e.g., the MLflow chart doesn't expose topologySpreadConstraints), consider using preferredDuringSchedulingIgnoredDuringExecution instead of required for more resilient scheduling, or add a comment explaining the rationale.

💡 Softer alternative using preferred anti-affinity
 affinity:
   podAntiAffinity:
-    requiredDuringSchedulingIgnoredDuringExecution:
-      - labelSelector:
-          matchLabels:
-            app.kubernetes.io/name: mlflow
-        topologyKey: kubernetes.io/hostname
+    preferredDuringSchedulingIgnoredDuringExecution:
+      - weight: 100
+        podAffinityTerm:
+          labelSelector:
+            matchLabels:
+              app.kubernetes.io/name: mlflow
+          topologyKey: kubernetes.io/hostname

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant