Skip to content

feat: support for status subresource patches via annotation#2699

Closed
bakito wants to merge 10 commits into
kyverno:mainfrom
bakito:subresource-annotation
Closed

feat: support for status subresource patches via annotation#2699
bakito wants to merge 10 commits into
kyverno:mainfrom
bakito:subresource-annotation

Conversation

@bakito

@bakito bakito commented May 1, 2026

Copy link
Copy Markdown
Contributor

Explanation

This is an alternative solution for #2654 where the subresource to be patched is defined as an annotation.

This PR adds the possibility to patch subresoruces. This can be helpful when the tests need to simulate updates done by external controllers.

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

with 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"

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

  • I have read the contributing guidelines.
  • I have read the PR documentation guide and followed the process including adding proof manifests to this PR.
  • This is a bug fix and I have added unit tests that prove my fix is effective.

Further Comments

It was cool meeting the maintainers on Contribfest at KubeCon Amsterdam!

@bakito bakito changed the title Subresource annotation feat: support for status subresource patches via annotation May 1, 2026
@bakito
bakito force-pushed the subresource-annotation branch 2 times, most recently from e31aecb to 113790e Compare May 1, 2026 12:41
@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.70%. Comparing base (2a96ee7) to head (95d1de5).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2699      +/-   ##
==========================================
+ Coverage   67.00%   67.70%   +0.69%     
==========================================
  Files         149      149              
  Lines        5710     5753      +43     
==========================================
+ Hits         3826     3895      +69     
+ Misses       1624     1598      -26     
  Partials      260      260              

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

Signed-off-by: bakito <[email protected]>
@bakito
bakito force-pushed the subresource-annotation branch from 113790e to ce91fd4 Compare May 1, 2026 12:53
@bakito
bakito force-pushed the subresource-annotation branch 2 times, most recently from 4f21d85 to 504ed35 Compare May 1, 2026 13:46
Signed-off-by: bakito <[email protected]>
@bakito
bakito force-pushed the subresource-annotation branch from 504ed35 to 51c9f4e Compare May 1, 2026 13:50
@bakito
bakito force-pushed the subresource-annotation branch from f0d67af to 95d1de5 Compare May 1, 2026 14:05
@eddycharly

Copy link
Copy Markdown
Member

Closing, implemented in #2654

@eddycharly eddycharly closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants