feat: support for status subresource patches#2654
Conversation
11f75a4 to
bdd30d5
Compare
Signed-off-by: bakito <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2654 +/- ##
==========================================
+ Coverage 67.08% 67.70% +0.62%
==========================================
Files 149 149
Lines 5723 5757 +34
==========================================
+ Hits 3839 3898 +59
+ Misses 1624 1599 -25
Partials 260 260 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b372c16 to
154646f
Compare
Signed-off-by: bakito <[email protected]>
|
@eddycharly is test coverage ok like this? |
|
I have an alternative approach here: This approach works with an annotation instated of an attribute in Patch action struct. This allows only using one patch action fit a file that contain resources with normal patches as well as suresoruce patches. @eddycharly what would you prefer? Sample: apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: basic-deployment
spec:
steps:
- name: deploy-application
- description: Simulate Readiness of provider resources
patch:
file: 02-patch-provider-resources.yamlwith the patch file: 02-patch-provider-resources.yaml apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: basic-deployment-dev-app
namespace: basic-deployment-dev
status:
sync:
status: OutOfSync
---
apiVersion: identity.vault.m.upbound.io/v1alpha1
kind: GroupAlias
metadata:
name: basic-deployment-owner
namespace: crossplane-resources
annotations:
chainsaw.kyverno.io/patch-subresource: status
status:
conditions:
- type: Ready
status: "True"
reason: ManuallySet
message: Patched via chainsaw
lastTransitionTime: "2026-03-28T10:51:35Z" |
Signed-off-by: bakito <[email protected]>
Signed-off-by: bakito <[email protected]>
Signed-off-by: bakito <[email protected]>
Explanation
This PR adds the possibility to patch subresoruces. This can be helpful when the tests need to simulate updates done by external controllers.
Related issue
Discussed with @eddycharly on Contribfest
Proposed Changes
An additional filed 'subresource' is added to the Patch operation. The subresource filed defines the name of the subresource, that will be patched.
Checklist
Further Comments
It was cool meeting the maintainers on Contribfest at KubeCon Amsterdam!