Anonymous - 2025-09-15

Originally posted by: coderabbitai[bot]

Walkthrough

Expanded the mutating webhook to handle UPDATE events for core v1 resources and added a new rule to mutate cozystack.io/v1alpha1 WorkloadMonitor resources on CREATE and UPDATE. No other fields in the MutatingWebhookConfiguration were changed.

Changes

Cohort / File(s) Summary of Changes
Webhook rules update
packages/system/cozystack-controller/templates/mutatingwebhookconfiguration.yaml
- Extended operations for core v1 resources (pods, secrets, services, persistentvolumeclaims) from CREATE to CREATE and UPDATE.
- Added a new rule to mutate cozystack.io/v1alpha1 workloadmonitors on CREATE and UPDATE.
- No other fields modified.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User/Controller
  participant K as Kubernetes API Server
  participant MW as CozyStack Mutating Webhook

  rect rgb(230,245,255)
    note over U,K: Object CREATE or UPDATE (Pod/Secret/Service/PVC/WorkloadMonitor)
    U->>K: submit object (create/update)
    K->>MW: AdmissionReview (mutate)
    MW-->>K: AdmissionResponse (patch)
    K-->>U: Response (created/updated)
  end

  note right of MW: Now handles UPDATE for core v1 resources<br/>and CREATE/UPDATE for cozystack.io/v1alpha1 WorkloadMonitor

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my whiskers at UPDATE’s call,
From pods to secrets, I patch them all.
A WorkloadMonitor hops in line—
v1alpha1, mutations fine.
In YAML burrows, neat and slight,
This bunny tunes the cluster right. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed) | Check name | Status | Explanation | | :----------------: | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title Check | ✅ Passed | The title accurately and concisely summarizes the primary changes in the changeset: it identifies the cozystack-controller, states that workloadmonitors are being added to the lineage webhook, and notes that UPDATE operations will now be tracked. The wording is specific to the main modification in mutatingwebhookconfiguration.yaml and is not vague or noisy. This makes the title clear to reviewers scanning the repository history. | | Docstring Coverage | ✅ Passed | No functions found in the changes. Docstring coverage check skipped. |
✨ Finishing touches
🧪 Generate unit tests - [ ] Create PR with unit tests - [ ] Post copyable unit tests in a comment - [ ] Commit unit tests in branch `webhook-track-workloadmonitors`

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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

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