1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 07:26:55 +00:00

chore: remove unused deperected patches from RuleResponse (#7450)

Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
This commit is contained in:
Frank Jogeleit 2023-06-07 11:10:57 +02:00 committed by GitHub
parent e358bf3867
commit 5c3da75306
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 13 deletions

View file

@ -5,7 +5,6 @@ import (
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
pssutils "github.com/kyverno/kyverno/pkg/pss/utils"
"github.com/mattbaird/jsonpatch"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/pod-security-admission/api"
@ -31,8 +30,6 @@ type RuleResponse struct {
message string
// status rule status
status RuleStatus
// patches are JSON patches, for mutation rules
patches []jsonpatch.JsonPatchOperation
// stats contains rule statistics
stats ExecutionStats
// generatedResource is the generated by the generate rules of a policy
@ -103,11 +100,6 @@ func (r RuleResponse) WithGeneratedResource(resource unstructured.Unstructured)
return &r
}
func (r RuleResponse) WithPatches(patches ...jsonpatch.JsonPatchOperation) *RuleResponse {
r.patches = patches
return &r
}
func (r RuleResponse) WithStats(stats ExecutionStats) RuleResponse {
r.stats = stats
return r
@ -137,10 +129,6 @@ func (r *RuleResponse) GeneratedResource() unstructured.Unstructured {
return r.generatedResource
}
func (r *RuleResponse) DeprecatedPatches() []jsonpatch.JsonPatchOperation {
return r.patches
}
func (r *RuleResponse) Message() string {
return r.message
}

View file

@ -152,7 +152,6 @@ func buildRuleResponse(rule *kyvernov1.Rule, mutateResp *mutate.Response, info r
mutateResp.Status,
)
if mutateResp.Status == engineapi.RuleStatusPass {
resp = resp.WithPatches(mutateResp.Patches...)
if len(rule.Mutation.Targets) != 0 {
resp = resp.WithPatchedTarget(&mutateResp.PatchedResource, info.parentResourceGVR, info.subresource)
}