Skip to content

Conversation

@jerm-dro
Copy link
Contributor

@jerm-dro jerm-dro commented Dec 23, 2025

Summary

The applyPodTemplatePatch function in pkg/container/kubernetes/client.go was only copying Labels from the pod template patch but NOT Annotations.

Fixes #3153

Fix

// Copy annotations from the patched spec to our template
if patchedSpec.ObjectMetaApplyConfiguration != nil && len(patchedSpec.Annotations) > 0 {
    baseTemplate = baseTemplate.WithAnnotations(patchedSpec.Annotations)
}

Tests Created

  1. Unit test (pkg/container/kubernetes/client_test.go):

    • TestApplyPodTemplatePatchAnnotations - Tests the function directly
  2. E2E test (test/e2e/chainsaw/operator/single-tenancy/test-scenarios/pod-annotations/):

    • Creates MCPServer with custom annotations in podTemplateSpec
    • Verifies annotations appear on the StatefulSet's pod template

The chainsaw tests previously failed without the fix:

Screenshot 2025-12-23 at 11 18 04 AM

@jerm-dro jerm-dro changed the title Apply Pod Spec Annotations K8s Client: Apply Pod Spec Annotations Dec 23, 2025
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Dec 23, 2025
@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.15%. Comparing base (4b3fd00) to head (f74c5b3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3152   +/-   ##
=======================================
  Coverage   57.14%   57.15%           
=======================================
  Files         341      341           
  Lines       34053    34055    +2     
=======================================
+ Hits        19459    19463    +4     
+ Misses      12985    12984    -1     
+ Partials     1609     1608    -1     

☔ 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.

@jerm-dro jerm-dro marked this pull request as ready for review December 23, 2025 17:05
@jerm-dro
Copy link
Contributor Author

The failing test is unrelated and is fixed here: #3154

@jerm-dro jerm-dro merged commit 7d67ecf into main Dec 23, 2025
53 of 56 checks passed
@jerm-dro jerm-dro deleted the jerm/2025-12-23-fix-annotation-patching branch December 23, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCPServer PodTemplateSpec annotations not applied to MCP server pods

3 participants