thedavidweng opened a new pull request, #6667:
URL: https://github.com/apache/camel-k/pull/6667

   ## Summary
   
   - Fix #6663: Auto-inferred trait values like `container.expose` and 
`service.enabled` were appearing in `.status.traits` even though the user never 
explicitly set them.
   - Root cause: `executedTraitCondition()` serializes all non-zero fields from 
the in-memory trait structs (including values set by auto-detection in 
`Configure()`), and the subsequent `Merge()` with `mergo.WithOverride` 
propagated them into `Status.Traits`.
   - Fix: Remove the `Merge()` call in `Apply()`. `Status.Traits` now only 
reflects what the user explicitly configured in `Spec.Traits`.
   
   ## Problem
   
   When an Integration exposes a Service, `.status.traits` included:
   
   ```yaml
   traits:
     container:
       expose: true    # auto-inferred, not user-specified
     service:
       enabled: true   # auto-inferred, not user-specified
   ```
   
   These values are defaults inferred by the operator and should not appear in 
the status.
   
   ## Solution
   
   Changed `pkg/trait/trait.go` to only copy `Spec.Traits` into `Status.Traits` 
without merging the executed (auto-inferred) trait values:
   
   ```go
   // Before:
   integration.Status.Traits = integration.Spec.Traits.DeepCopy()
   integration.Status.Traits.Merge(*traits)  // leaked auto-inferred values
   
   // After:
   integration.Status.Traits = integration.Spec.Traits.DeepCopy()  // 
user-specified only
   ```
   
   This is safe because:
   - `Status.Traits` used in `monitor.go` and `integration_controller.go` for 
mount hot-reload — these are user-specified values in `Spec.Traits`
   - `gitops.go` copies `Status.Traits` to destination `Spec.Traits` — should 
only propagate user-specified values
   - Existing tests already validate this behavior
   
   ## Test plan
   
   - [x] All existing unit tests pass (`go test ./pkg/trait/...`)
   - [x] Integration controller tests pass (`go test 
./pkg/controller/integration/...`)
   - [x] Build compiles cleanly (`go build ./pkg/...`)
   
   _Claude Code on behalf of David_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to