Skip to content

Conversation

@dobrerazvan
Copy link

@dobrerazvan dobrerazvan commented Nov 4, 2025

Description

Make koperator tolerate mutating webhooks.

Files Created

1. pkg/k8sutil/patch_options.go

New file containing mutation webhook filter logic:

  • IgnoreMutationWebhookFields() - Filters out Gatekeeper/OPA mutation annotations
  • IgnorePodResourcesIfAnnotated() - Ignores resource diffs for externally managed pods
  • Helper functions for cleaning and filtering pod specifications

2. pkg/k8sutil/patch_options_test.go

Comprehensive unit test suite with 100% passing tests:

  • TestIgnoreMutationWebhookFields - 3 test cases
  • TestIgnorePodResourcesIfAnnotated - 4 test cases
  • TestCombinedIgnoreOptions - Combined filter testing
  • TestShouldIgnoreResources - 5 test cases
  • TestCleanMutationWebhookFields - 2 test cases

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

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.

3 participants