Skip to content

Refactor Instance Watcher#1490

Merged
aphralG merged 34 commits intomainfrom
refactor-instance-watcher
Apr 29, 2026
Merged

Refactor Instance Watcher#1490
aphralG merged 34 commits intomainfrom
refactor-instance-watcher

Conversation

@aphralG
Copy link
Copy Markdown
Contributor

@aphralG aphralG commented Jan 15, 2026

Proposed changes

This PR removes each instance having its own Instance operator and health watcher.
It also moves the logic for updating the resource into the instance watcher to reduce the amount of messages being sent on the bus.
The resource plugin has been remnemed to the nginx plugin as it now only has logic to apply, relaod and validate the nginx config.
NAP no longer has its own instance watcher, the nap instance watcher is now started in the instance watcher and is checked for updates when we check for instance updates reducing complexity and the number of messages being sent.

Checklist

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

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@aphralG aphralG requested a review from a team as a code owner January 15, 2026 17:06
@github-actions github-actions Bot added the chore Pull requests for routine tasks label Jan 15, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 79.71919% with 130 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.93%. Comparing base (98dafa3) to head (34d6838).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/nginx/nginx_plugin.go 78.87% 82 Missing and 8 partials ⚠️
...ernal/watcher/instance/instance_watcher_service.go 80.85% 14 Missing and 4 partials ⚠️
internal/nginx/nginx_service.go 72.88% 15 Missing and 1 partial ⚠️
...her/instance/nginx-app-protect-instance-watcher.go 82.85% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1490      +/-   ##
==========================================
- Coverage   85.12%   84.93%   -0.19%     
==========================================
  Files         105      104       -1     
  Lines       13705    13581     -124     
==========================================
- Hits        11666    11535     -131     
- Misses       1524     1531       +7     
  Partials      515      515              
Files with missing lines Coverage Δ
internal/file/file_manager_service.go 75.00% <ø> (ø)
internal/nginx/nginx_instance_operator.go 91.17% <ø> (ø)
internal/nginx/nginx_instance_process_operator.go 61.76% <ø> (ø)
internal/nginx/nginx_log_tailer_operator.go 86.66% <ø> (ø)
internal/nginx/nginx_plus_actions.go 97.60% <100.00%> (ø)
internal/plugin/plugin_manager.go 87.30% <100.00%> (-0.94%) ⬇️
internal/watcher/health/health_watcher_service.go 81.63% <100.00%> (-7.46%) ⬇️
internal/watcher/watcher_plugin.go 69.76% <100.00%> (-3.15%) ⬇️
...her/instance/nginx-app-protect-instance-watcher.go 76.37% <82.85%> (-6.31%) ⬇️
internal/nginx/nginx_service.go 59.74% <72.88%> (ø)
... and 2 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98dafa3...34d6838. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread internal/nginx/nginx_service.go Outdated
Copy link
Copy Markdown
Collaborator

@dhurley dhurley left a comment

Choose a reason for hiding this comment

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

Can we double check the other functions in the nginx-app-protect-instance-watcher.go to make sure we have correct locks in place for the nginxAppProtectInstance field?

Comment thread internal/watcher/instance/instance_watcher_service.go Outdated
Comment thread internal/watcher/instance/instance_watcher_service.go Outdated
@aphralG aphralG merged commit 8419c4a into main Apr 29, 2026
38 checks passed
@aphralG aphralG deleted the refactor-instance-watcher branch April 29, 2026 10:51
@aphralG aphralG mentioned this pull request Apr 29, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Pull requests for routine tasks dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants