diff --git a/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/deprecated.go b/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/deprecated.go index 0da4465152cf..24f59d6d8695 100644 --- a/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/deprecated.go +++ b/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/deprecated.go @@ -1,17 +1,14 @@ package v1alpha1 import ( - "github.com/kumahq/kuma/v2/api/common/v1alpha1" "github.com/kumahq/kuma/v2/pkg/plugins/policies/core/jsonpatch/validators" "github.com/kumahq/kuma/v2/pkg/util/pointer" ) func (t *MeshFaultInjectionResource) Deprecations() []string { - deprecations := validators.TopLevelTargetRefDeprecations(t.Spec.TargetRef) - for _, f := range pointer.Deref(t.Spec.From) { - if f.GetTargetRef().Kind == v1alpha1.MeshService { - deprecations = append(deprecations, "MeshService value for 'from[].targetRef.kind' is deprecated, use MeshSubset with 'kuma.io/service' instead") - } + var deprecations []string + if len(pointer.Deref(t.Spec.From)) > 0 { + deprecations = append(deprecations, "'from' field is deprecated, use 'rules' with SPIFFE-based 'matches' instead") } - return deprecations + return append(deprecations, validators.TopLevelTargetRefDeprecations(t.Spec.TargetRef)...) }