Add support for Kubernetes 1.34 LifecycleHandler.sleep field#2057
Add support for Kubernetes 1.34 LifecycleHandler.sleep field#2057naomi-robusta merged 2 commits intomasterfrom
Conversation
Hikaru's bundled v1 model (rel_1_26) predates the lifecycle.preStop.sleep field that became GA in Kubernetes 1.34. Without a matching field on LifecycleHandler, hikaru silently drops the value when parsing, so a migration from preStop.exec to preStop.sleep was reported as the exec field changing to None with no corresponding new value. Patch LifecycleHandler in place to add an Optional[SleepAction] field so the new value is parsed, round-tripped, and surfaced in change diffs.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
|
✅ Docker image ready for
Use this tag to pull the image for testing. 📋 Copy commandsgcloud auth configure-docker us-central1-docker.pkg.dev
docker pull us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:82eed64
docker tag us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:82eed64 me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:82eed64
docker push me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:82eed64Patch Helm values in one line: helm upgrade --install robusta robusta/robusta \
--reuse-values \
--set runner.image=me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:82eed64 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/robusta/patch/patch.py`:
- Line 2: The import currently pulls the private symbol `_FIELD`; remove
`_FIELD` from the import and instead create any needed template Field by calling
the public factory `field()` (from the existing import) and modifying its
attributes as required; update any code that referenced `_FIELD` to use that
`field()`-derived template (e.g., replace usages of `_FIELD` with a `template =
field()` or `template = field(default=...)` and then adjust
template.metadata/default_factory/etc.), keeping the rest of the dataclasses
usage (InitVar, dataclass, is_dataclass) unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7841576f-3c4c-41a5-9120-86cd121d967a
📒 Files selected for processing (1)
src/robusta/patch/patch.py
dataclasses.fields() filters by `f._field_type is _FIELD`, so the patched field needs the same sentinel. Borrow it from an existing field on the class instead of importing the private symbol from the stdlib.
Summary
This PR adds support for the
sleepfield in Kubernetes 1.34'sLifecycleHandler, which is not present in Hikaru's bundled v1.26 model. The patch ensures that preStop/postStart sleep handlers are correctly parsed and diffed.Key Changes
SleepActiondataclass: Created a dataclass to represent thesleepaction with asecondsfield, matching the Kubernetes 1.34 API specificationpatch_lifecycle_handler_sleep()function: Dynamically patches theLifecycleHandlerclass to add the missingsleepfield by:SleepActionin the v1 package namespaceImplementation Details
sleepfield into the existingLifecycleHandlerclass_field_type,name,type) is properly configured to integrate seamlessly with Hikaru's dataclass infrastructurehttps://claude.ai/code/session_013fifvjn134B8JQUK1EE9tG