Skip to content

Conversation

@salonichf5
Copy link
Contributor

@salonichf5 salonichf5 commented Dec 15, 2025

Proposed changes

Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:

Problem: Users want that deployments and daemonSet preserve external annotations like how we do for services

Solution: Adds a solution to track internal annotations and preserver external annotations.

Testing: I verified the behavior by manually adding an annotation to both to deployment and waiting if controller overwrites it and watching the generation

kubectl annotate deploy gateway-nginx \
  field.cattle.io/publicEndpoints='[{"addresses":["x"],"port":80}]' --overwrite
deployment.apps/gateway-nginx annotated


 kubectl describe deploy gateway-nginx | sed -n '/Annotations:/,/Selector:/p'

Annotations:            deployment.kubernetes.io/revision: 1
                        field.cattle.io/publicEndpoints: [{"addresses":["x"],"port":80}]
Selector:               app.kubernetes.io/instance=nginx-gateway,app.kubernetes.io/managed-by=nginx-gateway-nginx,app.kubernetes.io/name=gateway-nginx,gateway.networking.k8s.io/gateway-name=gateway
  Annotations:      prometheus.io/port: 9113
                    prometheus.io/scrape: true

kubectl get deploy gateway-nginx -o jsonpath="{.metadata.generation}  {.metadata.resourceVersion}  {.metadata.annotations.field\.cattle\.io/publicEndpoints}{\"\n\"}" --watch
2  2046  [{"addresses":["x"],"port":80}]

Daemonset

 kubectl annotate daemonsets.apps gateway-nginx \ 
  field.cattle.io/publicEndpoints='[{"addresses":["x"],"port":80}]' --overwrite
daemonset.apps/gateway-nginx annotated

kubectl describe daemonsets.apps gateway-nginx | sed -n '/Annotations:/,/Selector:/p' 
Annotations:    deprecated.daemonset.template.generation: 1
                field.cattle.io/publicEndpoints: [{"addresses":["x"],"port":80}]
Desired Number of Nodes Scheduled: 1
Current Number of Nodes Scheduled: 1

controller  Created pod: gateway-nginx-gdvd7
sa.choudhary@N9939CQ4P0 nginx-gateway-fabric % kubectl get daemonsets.apps gateway-nginx -o jsonpath="{.metadata.generation}  {.metadata.resourceVersion}  {.metadata.annotations.field\.cattle\.io/publicEndpoints}{\"\n\"}" --watch 
1  26427  [{"addresses":["x"],"port":80}]

Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.

Closes #4447

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

Fixes a bug to preserve external controller annotations for Deployment and DaemonSets to avoid constant updates. 

@salonichf5 salonichf5 requested a review from a team as a code owner December 15, 2025 19:10
@github-actions github-actions bot added the bug Something isn't working label Dec 15, 2025
@salonichf5 salonichf5 moved this from 🆕 New to 🏗 In Progress in NGINX Gateway Fabric Dec 15, 2025
@salonichf5 salonichf5 moved this from 🏗 In Progress to 👀 In Review in NGINX Gateway Fabric Dec 15, 2025
@salonichf5 salonichf5 moved this from 👀 In Review to 🆕 New in NGINX Gateway Fabric Dec 15, 2025
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.20%. Comparing base (3424d94) to head (a26f7d6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4468      +/-   ##
==========================================
- Coverage   86.23%   86.20%   -0.04%     
==========================================
  Files         132      132              
  Lines       14557    14560       +3     
  Branches       35       35              
==========================================
- Hits        12553    12551       -2     
- Misses       1792     1794       +2     
- Partials      212      215       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sjberman
Copy link
Collaborator

At this point, we could cherrypick this into 2.3 since we haven't released yet.

Copy link
Contributor

@bjee19 bjee19 left a comment

Choose a reason for hiding this comment

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

nice job

@salonichf5 salonichf5 force-pushed the bug/fix-deployment-annotations branch from 2610d91 to 274e713 Compare December 16, 2025 19:15
@salonichf5 salonichf5 enabled auto-merge (squash) December 16, 2025 19:16
@sjberman sjberman disabled auto-merge December 16, 2025 20:27
@sjberman sjberman enabled auto-merge (squash) December 16, 2025 20:27
@salonichf5 salonichf5 force-pushed the bug/fix-deployment-annotations branch from 6821a8d to a26f7d6 Compare December 16, 2025 20:49
@sjberman sjberman merged commit 5824970 into main Dec 16, 2025
61 checks passed
@sjberman sjberman deleted the bug/fix-deployment-annotations branch December 16, 2025 21:22
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in NGINX Gateway Fabric Dec 16, 2025
salonichf5 added a commit that referenced this pull request Dec 16, 2025
…#4468)

Problem: Users want that deployments and daemonSet preserve external annotations like how we do for services

Solution: Adds a solution to track internal annotations and preserver external annotations.
salonichf5 added a commit that referenced this pull request Dec 16, 2025
…#4468) (#4473)

Problem: Users want that deployments and daemonSet preserve external annotations like how we do for services

Solution: Adds a solution to track internal annotations and preserver external annotations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working release-notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Deployment gateway-nginx generation and resourceVersion numbers skyrocketing

4 participants