Repository: kumahq/kuma
Pull request #12829 (2025-02-12 07:41:32)

feat(api): apply defaults using k8s defaulter
## Motivation

Motivation is best described in the issue: https://github.com/kumahq/kuma/issues/6070

## Implementation information

This takes care of everything apart from mesh_defaulter.

## Supporting documentation

part of https://github.com/kumahq/kuma/issues/6070


github-actions[bot]: ## Reviewer Checklist
:mag: Each of these sections need to be checked by the reviewer of the PR :mag::
If something doesn't apply please check the box and add a justification if the reason is non obvious.
- [ ] Is the PR title satisfactory? Is this part of a larger feature and should be grouped using `> Changelog`?
- [ ] PR description is clear and complete. It [Links to relevant issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) as well as docs and UI issues
- [ ] This will not break child repos: it doesn't hardcode values (.e.g "kumahq" as an image registry)
- [ ] IPv6 is taken into account (.e.g: no string concatenation of host port)
- [ ] Tests (Unit test, E2E tests, manual test on universal and k8s)
    - Don't forget `ci/` labels to run additional/fewer tests
- [ ] Does this contain a change that needs to be notified to users? In this case, [`UPGRADE.md`](../blob/master/UPGRADE.md) should be updated.
- [ ] Does it need to be backported according to the [backporting policy](../blob/master/CONTRIBUTING.md#backporting)? ([this](https://github.com/kumahq/kuma/actions/workflows/auto-backport.yaml) GH action will add "backport" label based on these [file globs](https://github.com/kumahq/kuma/blob/master/.github/workflows/auto-backport.yaml#L6), if you want to prevent it from adding the "backport" label use [no-backport-autolabel](https://github.com/kumahq/kuma/blob/master/.github/workflows/auto-backport.yaml#L8) label)
<!-- Sticky Pull Request CommentPR reviewer checklist -->

Patch:
diff --git a/deployments/charts/kuma/crds/kuma.io_meshservices.yaml b/deployments/charts/kuma/crds/kuma.io_meshservices.yaml
index c64b0c061..7ae3a7c86 100644
--- a/deployments/charts/kuma/crds/kuma.io_meshservices.yaml
+++ b/deployments/charts/kuma/crds/kuma.io_meshservices.yaml
@@ -98,6 +98,7 @@ spec:
                     type: object
                 type: object
               state:
+                default: Unavailable
                 description: |-
                   State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
                   It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/docs/generated/openapi.yaml b/docs/generated/openapi.yaml
index 2e7fc8220..d0ed63827 100644
--- a/docs/generated/openapi.yaml
+++ b/docs/generated/openapi.yaml
@@ -14654,6 +14654,7 @@ components:
                   type: object
               type: object
             state:
+              default: Unavailable
               description: >-
                 State of MeshService. Available if there is at least one healthy
                 endpoint. Otherwise, Unavailable.
diff --git a/docs/generated/raw/crds/kuma.io_meshservices.yaml b/docs/generated/raw/crds/kuma.io_meshservices.yaml
index c64b0c061..7ae3a7c86 100644
--- a/docs/generated/raw/crds/kuma.io_meshservices.yaml
+++ b/docs/generated/raw/crds/kuma.io_meshservices.yaml
@@ -98,6 +98,7 @@ spec:
                     type: object
                 type: object
               state:
+                default: Unavailable
                 description: |-
                   State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
                   It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/go.mod b/go.mod
index fc218b72d..2d2a62ccf 100644
--- a/go.mod
+++ b/go.mod
@@ -273,6 +273,15 @@ require (
 	sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
 )
 
+require (
+	github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
+	github.com/blang/semver/v4 v4.0.0 // indirect
+	github.com/google/cel-go v0.22.0 // indirect
+	github.com/stoewer/go-strcase v1.3.0 // indirect
+	k8s.io/apiserver v0.32.1 // indirect
+	k8s.io/component-base v0.32.1 // indirect
+)
+
 replace github.com/envoyproxy/go-control-plane/envoy => github.com/kumahq/go-control-plane/envoy v1.32.3-kong-1
 
 replace github.com/envoyproxy/go-control-plane/contrib => github.com/kumahq/go-control-plane/contrib v1.32.3-kong-1
diff --git a/go.sum b/go.sum
index 5150929eb..82f843b40 100644
--- a/go.sum
+++ b/go.sum
@@ -25,6 +25,8 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo
 github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
 github.com/Nordix/simple-ipam v1.0.0 h1:oMyASgx2EEH0ccjAEBgCgCviu7z4uB+Od7UUCBxqcFE=
 github.com/Nordix/simple-ipam v1.0.0/go.mod h1:7d9TR/lF/zpNDHYhT43qhewce8vNdzVG5kCk7K9dPac=
+github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
+github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
 github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
@@ -108,6 +110,8 @@ github.com/bakito/go-log-logr-adapter v0.0.3-0.20240527124623-de85860b7d21/go.mo
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
+github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
 github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
 github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs=
 github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
@@ -129,6 +133,10 @@ github.com/containernetworking/cni v1.2.3 h1:hhOcjNVUQTnzdRJ6alC5XF+wd9mfGIUaj8F
 github.com/containernetworking/cni v1.2.3/go.mod h1:DuLgF+aPd3DzcTQTtp/Nvl1Kim23oFKdm2okJzBQA5M=
 github.com/containernetworking/plugins v1.6.2 h1:pqP8Mq923TLyef5g97XfJ/xpDeVek4yF8A4mzy9Tc4U=
 github.com/containernetworking/plugins v1.6.2/go.mod h1:SP5UG3jDO9LtmfbBJdP+nl3A1atOtbj2MBOYsnaxy64=
+github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
+github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
+github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
+github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
 github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA=
 github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
 github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
@@ -228,6 +236,8 @@ github.com/gonvenience/ytbx v1.4.4 h1:jQopwyaLsVGuwdxSiN4WkXjsEaFNPJ3V4lUj7eyEpz
 github.com/gonvenience/ytbx v1.4.4/go.mod h1:w37+MKCPcCMY/jpPNmEklD4xKqrOAVBO6kIWW2+uI6M=
 github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
 github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
+github.com/google/cel-go v0.22.0 h1:b3FJZxpiv1vTMo2/5RDUqAHPxkT8mmMfJIrq1llbf7g=
+github.com/google/cel-go v0.22.0/go.mod h1:BuznPXXfQDpXKWQ9sPW3TzlAJN5zzFe+i9tIs0yC4s8=
 github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
 github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
 github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -445,6 +455,8 @@ github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
 github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
 github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE=
 github.com/spiffe/go-spiffe/v2 v2.5.0/go.mod h1:P+NxobPc6wXhVtINNtFjNWGBTreew1GBUCwT2wPmb7g=
+github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
+github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
@@ -499,6 +511,12 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
 github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
 github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
 github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
+go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0=
+go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28=
+go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q=
+go.etcd.io/etcd/client/pkg/v3 v3.5.16/go.mod h1:V8acl8pcEK0Y2g19YlOV9m9ssUe6MgiDSobSoaBAM0E=
+go.etcd.io/etcd/client/v3 v3.5.16 h1:sSmVYOAHeC9doqi0gv7v86oY/BTld0SEFGaxsU9eRhE=
+go.etcd.io/etcd/client/v3 v3.5.16/go.mod h1:X+rExSGkyqxvu276cr2OwPLBaeqFu1cIl4vmRjAD/50=
 go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
 go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
 go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful v0.59.0 h1:J33qkG35/jZyungLQCg2il54MwsGtMnE8r+VkFpffa8=
@@ -641,8 +659,12 @@ k8s.io/apiextensions-apiserver v0.32.1 h1:hjkALhRUeCariC8DiVmb5jj0VjIc1N0DREP32+
 k8s.io/apiextensions-apiserver v0.32.1/go.mod h1:sxWIGuGiYov7Io1fAS2X06NjMIk5CbRHc2StSmbaQto=
 k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs=
 k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
+k8s.io/apiserver v0.32.1 h1:oo0OozRos66WFq87Zc5tclUX2r0mymoVHRq8JmR7Aak=
+k8s.io/apiserver v0.32.1/go.mod h1:UcB9tWjBY7aryeI5zAgzVJB/6k7E97bkr1RgqDz0jPw=
 k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU=
 k8s.io/client-go v0.32.1/go.mod h1:aTTKZY7MdxUaJ/KiUs8D+GssR9zJZi77ZqtzcGXIiDg=
+k8s.io/component-base v0.32.1 h1:/5IfJ0dHIKBWysGV0yKTFfacZ5yNV1sulPh3ilJjRZk=
+k8s.io/component-base v0.32.1/go.mod h1:j1iMMHi/sqAHeG5z+O9BFNCF698a1u0186zkjMZQ28w=
 k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
 k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
 k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 h1:hcha5B1kVACrLujCKLbr8XWMxCxzQx42DY8QKYJrDLg=
@@ -651,6 +673,8 @@ k8s.io/kubectl v0.32.1 h1:/btLtXLQUU1rWx8AEvX9jrb9LaI6yeezt3sFALhB8M8=
 k8s.io/kubectl v0.32.1/go.mod h1:sezNuyWi1STk4ZNPVRIFfgjqMI6XMf+oCVLjZen/pFQ=
 k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0=
 k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
+sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
+sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
 sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE=
 sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
 sigs.k8s.io/controller-tools v0.17.2 h1:jNFOKps8WnaRKZU2R+4vRCHnXyJanVmXBWqkuUPFyFg=
diff --git a/pkg/core/resources/apis/donothingresource/api/v1alpha1/zz_generated.resource.go b/pkg/core/resources/apis/donothingresource/api/v1alpha1/zz_generated.resource.go
index 9bccff415..7bbca814b 100644
--- a/pkg/core/resources/apis/donothingresource/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/core/resources/apis/donothingresource/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -18,14 +22,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	DoNothingResourceResourceTypeDescriptor.Schema = &schema
+	DoNothingResourceResourceTypeDescriptor.Validator = validator
+	DoNothingResourceResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/core/resources/apis/hostnamegenerator/api/v1alpha1/zz_generated.resource.go b/pkg/core/resources/apis/hostnamegenerator/api/v1alpha1/zz_generated.resource.go
index 43ba87e11..38c175478 100644
--- a/pkg/core/resources/apis/hostnamegenerator/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/core/resources/apis/hostnamegenerator/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	HostnameGeneratorResourceTypeDescriptor.Schema = &schema
+	HostnameGeneratorResourceTypeDescriptor.Validator = validator
+	HostnameGeneratorResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/core/resources/apis/meshexternalservice/api/v1alpha1/zz_generated.resource.go b/pkg/core/resources/apis/meshexternalservice/api/v1alpha1/zz_generated.resource.go
index 8378cde98..88037cd2f 100644
--- a/pkg/core/resources/apis/meshexternalservice/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/core/resources/apis/meshexternalservice/api/v1alpha1/zz_generated.resource.go
@@ -8,7 +8,11 @@ import (
 	_ "embed"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -18,14 +22,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshExternalServiceResourceTypeDescriptor.Schema = &schema
+	MeshExternalServiceResourceTypeDescriptor.Validator = validator
+	MeshExternalServiceResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/core/resources/apis/meshmultizoneservice/api/v1alpha1/zz_generated.resource.go b/pkg/core/resources/apis/meshmultizoneservice/api/v1alpha1/zz_generated.resource.go
index 362d21455..cca0792ae 100644
--- a/pkg/core/resources/apis/meshmultizoneservice/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/core/resources/apis/meshmultizoneservice/api/v1alpha1/zz_generated.resource.go
@@ -8,7 +8,11 @@ import (
 	_ "embed"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -18,14 +22,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshMultiZoneServiceResourceTypeDescriptor.Schema = &schema
+	MeshMultiZoneServiceResourceTypeDescriptor.Validator = validator
+	MeshMultiZoneServiceResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/core/resources/apis/meshservice/api/v1alpha1/helpers.go b/pkg/core/resources/apis/meshservice/api/v1alpha1/helpers.go
index d37582ba6..107d7f86a 100644
--- a/pkg/core/resources/apis/meshservice/api/v1alpha1/helpers.go
+++ b/pkg/core/resources/apis/meshservice/api/v1alpha1/helpers.go
@@ -94,13 +94,6 @@ func (t *MeshServiceResource) SNIName(systemNamespace string) string {
 	return t.GetMeta().GetName()
 }
 
-func (t *MeshServiceResource) Default() error {
-	if t.Spec.State == "" {
-		t.Spec.State = StateUnavailable
-	}
-	return nil
-}
-
 func (t *MeshServiceResource) AsOutbounds() xds_types.Outbounds {
 	var outbounds xds_types.Outbounds
 	for _, vip := range t.Status.VIPs {
diff --git a/pkg/core/resources/apis/meshservice/api/v1alpha1/meshservice.go b/pkg/core/resources/apis/meshservice/api/v1alpha1/meshservice.go
index 7076c304e..100e74f11 100644
--- a/pkg/core/resources/apis/meshservice/api/v1alpha1/meshservice.go
+++ b/pkg/core/resources/apis/meshservice/api/v1alpha1/meshservice.go
@@ -39,6 +39,7 @@ const maxNameLength = 63
 type MeshService struct {
 	// State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
 	// It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
+	// +kubebuilder:default=Unavailable
 	State    State    `json:"state,omitempty"`
 	Selector Selector `json:"selector,omitempty"`
 	// +patchMergeKey=port
diff --git a/pkg/core/resources/apis/meshservice/api/v1alpha1/schema.yaml b/pkg/core/resources/apis/meshservice/api/v1alpha1/schema.yaml
index acd6c8336..73766437d 100644
--- a/pkg/core/resources/apis/meshservice/api/v1alpha1/schema.yaml
+++ b/pkg/core/resources/apis/meshservice/api/v1alpha1/schema.yaml
@@ -73,6 +73,7 @@ properties:
             type: object
         type: object
       state:
+        default: Unavailable
         description: |-
           State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
           It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/pkg/core/resources/apis/meshservice/api/v1alpha1/zz_generated.resource.go b/pkg/core/resources/apis/meshservice/api/v1alpha1/zz_generated.resource.go
index b4aacbb5f..8adfa4534 100644
--- a/pkg/core/resources/apis/meshservice/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/core/resources/apis/meshservice/api/v1alpha1/zz_generated.resource.go
@@ -8,7 +8,11 @@ import (
 	_ "embed"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -18,14 +22,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshServiceResourceTypeDescriptor.Schema = &schema
+	MeshServiceResourceTypeDescriptor.Validator = validator
+	MeshServiceResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/core/resources/apis/meshservice/k8s/crd/kuma.io_meshservices.yaml b/pkg/core/resources/apis/meshservice/k8s/crd/kuma.io_meshservices.yaml
index c64b0c061..7ae3a7c86 100644
--- a/pkg/core/resources/apis/meshservice/k8s/crd/kuma.io_meshservices.yaml
+++ b/pkg/core/resources/apis/meshservice/k8s/crd/kuma.io_meshservices.yaml
@@ -98,6 +98,7 @@ spec:
                     type: object
                 type: object
               state:
+                default: Unavailable
                 description: |-
                   State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
                   It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/pkg/core/resources/model/resource.go b/pkg/core/resources/model/resource.go
index 5d1b2b90f..b40a4250f 100644
--- a/pkg/core/resources/model/resource.go
+++ b/pkg/core/resources/model/resource.go
@@ -8,7 +8,8 @@ import (
 	"time"
 
 	"github.com/pkg/errors"
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 
 	common_api "github.com/kumahq/kuma/api/common/v1alpha1"
 	mesh_proto "github.com/kumahq/kuma/api/mesh/v1alpha1"
@@ -194,8 +195,10 @@ type ResourceTypeDescriptor struct {
 	HasStatus bool
 	// IsProxy indicates if this resource is a proxy
 	IsProxy bool
-	// Schema contains an unmarshalled OpenAPI schema of the resource
-	Schema *spec.Schema
+	// Validator contains an OpenAPI validator for this resource
+	Validator *validate.SchemaValidator
+	// StructuralSchema contains an unmarshalled OpenAPI schema of the resource
+	StructuralSchema *schema.Structural
 	// Insight contains the insight type attached to this resourceType
 	Insight Resource
 	// Overview contains the overview type attached to this resourceType
diff --git a/pkg/core/resources/model/rest/unmarshaller.go b/pkg/core/resources/model/rest/unmarshaller.go
index e60b5f8f3..0cfea366f 100644
--- a/pkg/core/resources/model/rest/unmarshaller.go
+++ b/pkg/core/resources/model/rest/unmarshaller.go
@@ -7,7 +7,7 @@ import (
 	"strings"
 
 	"github.com/pkg/errors"
-	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema/defaulting"
 	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
@@ -17,13 +17,21 @@ import (
 	"github.com/kumahq/kuma/pkg/core/validators"
 )
 
-var YAML = &unmarshaler{unmarshalFn: func(bytes []byte, i interface{}) error {
-	return yaml.Unmarshal(bytes, i)
-}}
-var JSON = &unmarshaler{unmarshalFn: json.Unmarshal}
+var YAML = &unmarshaler{
+	unmarshalFn: func(bytes []byte, i interface{}) error {
+		return yaml.Unmarshal(bytes, i)
+	},
+	marshalFn: yaml.Marshal,
+}
+
+var JSON = &unmarshaler{
+	unmarshalFn: json.Unmarshal,
+	marshalFn:   json.Marshal,
+}
 
 type unmarshaler struct {
 	unmarshalFn func([]byte, interface{}) error
+	marshalFn   func(v any) ([]byte, error)
 }
 
 type InvalidResourceError struct {
@@ -65,21 +73,30 @@ func (u *unmarshaler) UnmarshalCore(bytes []byte) (core_model.Resource, error) {
 func (u *unmarshaler) Unmarshal(bytes []byte, desc core_model.ResourceTypeDescriptor) (Resource, error) {
 	resource := desc.NewObject()
 	restResource := From.Resource(resource)
-	if desc.IsPluginOriginated {
+	defaultedBytes := bytes
+	if desc.Validator != nil && desc.StructuralSchema != nil {
+		var err error
 		// desc.Schema is set only for new plugin originated policies
 		rawObj := map[string]interface{}{}
 		// Unfortunately to validate new policies we must first unmarshal into a rawObj
-		if err := u.unmarshalFn(bytes, &rawObj); err != nil {
+		if err = u.unmarshalFn(bytes, &rawObj); err != nil {
 			return nil, &InvalidResourceError{Reason: fmt.Sprintf("invalid %s object: %q", desc.Name, err.Error())}
 		}
-		validator := validate.NewSchemaValidator(desc.Schema, nil, "", strfmt.Default)
-		res := validator.Validate(rawObj)
+
+		// Apply defaulting
+		defaulting.Default(rawObj, desc.StructuralSchema)
+
+		res := desc.Validator.Validate(rawObj)
 		if !res.IsValid() {
 			return nil, toValidationError(res)
 		}
+		defaultedBytes, err = u.marshalFn(rawObj)
+		if err != nil {
+			return nil, err
+		}
 	}
 
-	if err := u.unmarshalFn(bytes, restResource); err != nil {
+	if err := u.unmarshalFn(defaultedBytes, restResource); err != nil {
 		return nil, &InvalidResourceError{Reason: fmt.Sprintf("invalid %s object: %q", desc.Name, err.Error())}
 	}
 
diff --git a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/zz_generated.resource.go
index 8d6953bcf..397b8f845 100644
--- a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -18,14 +22,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	DoNothingPolicyResourceTypeDescriptor.Schema = &schema
+	DoNothingPolicyResourceTypeDescriptor.Validator = validator
+	DoNothingPolicyResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/zz_generated.resource.go
index 1f36d971f..3b7ecd1a4 100644
--- a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshAccessLogResourceTypeDescriptor.Schema = &schema
+	MeshAccessLogResourceTypeDescriptor.Validator = validator
+	MeshAccessLogResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/zz_generated.resource.go
index b6b52c97c..1efaa58e1 100644
--- a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshCircuitBreakerResourceTypeDescriptor.Schema = &schema
+	MeshCircuitBreakerResourceTypeDescriptor.Validator = validator
+	MeshCircuitBreakerResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/zz_generated.resource.go
index 1087d22d4..e4fb3336c 100644
--- a/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshfaultinjection/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshFaultInjectionResourceTypeDescriptor.Schema = &schema
+	MeshFaultInjectionResourceTypeDescriptor.Validator = validator
+	MeshFaultInjectionResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/zz_generated.resource.go
index 62c074bd3..86d3d59b8 100644
--- a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshHealthCheckResourceTypeDescriptor.Schema = &schema
+	MeshHealthCheckResourceTypeDescriptor.Validator = validator
+	MeshHealthCheckResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshhttproute/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshhttproute/api/v1alpha1/zz_generated.resource.go
index a6aac2869..80bd85438 100644
--- a/pkg/plugins/policies/meshhttproute/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshhttproute/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshHTTPRouteResourceTypeDescriptor.Schema = &schema
+	MeshHTTPRouteResourceTypeDescriptor.Validator = validator
+	MeshHTTPRouteResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshloadbalancingstrategy/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshloadbalancingstrategy/api/v1alpha1/zz_generated.resource.go
index 980462c27..a7f184c5e 100644
--- a/pkg/plugins/policies/meshloadbalancingstrategy/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshloadbalancingstrategy/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshLoadBalancingStrategyResourceTypeDescriptor.Schema = &schema
+	MeshLoadBalancingStrategyResourceTypeDescriptor.Validator = validator
+	MeshLoadBalancingStrategyResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshmetric/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshmetric/api/v1alpha1/zz_generated.resource.go
index d90a446c3..47b3dde55 100644
--- a/pkg/plugins/policies/meshmetric/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshmetric/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshMetricResourceTypeDescriptor.Schema = &schema
+	MeshMetricResourceTypeDescriptor.Validator = validator
+	MeshMetricResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshpassthrough/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshpassthrough/api/v1alpha1/zz_generated.resource.go
index bbe63f01f..14b74f3ee 100644
--- a/pkg/plugins/policies/meshpassthrough/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshpassthrough/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshPassthroughResourceTypeDescriptor.Schema = &schema
+	MeshPassthroughResourceTypeDescriptor.Validator = validator
+	MeshPassthroughResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshproxypatch/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshproxypatch/api/v1alpha1/zz_generated.resource.go
index 00ee9461a..90f41e65f 100644
--- a/pkg/plugins/policies/meshproxypatch/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshproxypatch/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshProxyPatchResourceTypeDescriptor.Schema = &schema
+	MeshProxyPatchResourceTypeDescriptor.Validator = validator
+	MeshProxyPatchResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshratelimit/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshratelimit/api/v1alpha1/zz_generated.resource.go
index 76e7b3ad4..f179c0039 100644
--- a/pkg/plugins/policies/meshratelimit/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshratelimit/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshRateLimitResourceTypeDescriptor.Schema = &schema
+	MeshRateLimitResourceTypeDescriptor.Validator = validator
+	MeshRateLimitResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshretry/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshretry/api/v1alpha1/zz_generated.resource.go
index f75300a11..bcb8bbd1c 100644
--- a/pkg/plugins/policies/meshretry/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshretry/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshRetryResourceTypeDescriptor.Schema = &schema
+	MeshRetryResourceTypeDescriptor.Validator = validator
+	MeshRetryResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshtcproute/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshtcproute/api/v1alpha1/zz_generated.resource.go
index 4d0167da1..93820e99f 100644
--- a/pkg/plugins/policies/meshtcproute/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshtcproute/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshTCPRouteResourceTypeDescriptor.Schema = &schema
+	MeshTCPRouteResourceTypeDescriptor.Validator = validator
+	MeshTCPRouteResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshtimeout/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshtimeout/api/v1alpha1/zz_generated.resource.go
index 90701f33b..dad5bdfbd 100644
--- a/pkg/plugins/policies/meshtimeout/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshtimeout/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshTimeoutResourceTypeDescriptor.Schema = &schema
+	MeshTimeoutResourceTypeDescriptor.Validator = validator
+	MeshTimeoutResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshtls/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshtls/api/v1alpha1/zz_generated.resource.go
index eac2011b2..be9442c9f 100644
--- a/pkg/plugins/policies/meshtls/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshtls/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshTLSResourceTypeDescriptor.Schema = &schema
+	MeshTLSResourceTypeDescriptor.Validator = validator
+	MeshTLSResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshtrace/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshtrace/api/v1alpha1/zz_generated.resource.go
index 6ec9e6cac..a93fa91fd 100644
--- a/pkg/plugins/policies/meshtrace/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshtrace/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshTraceResourceTypeDescriptor.Schema = &schema
+	MeshTraceResourceTypeDescriptor.Validator = validator
+	MeshTraceResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/zz_generated.resource.go b/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/zz_generated.resource.go
index 679bfd697..7394da502 100644
--- a/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/zz_generated.resource.go
+++ b/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/zz_generated.resource.go
@@ -9,7 +9,11 @@ import (
 	"errors"
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -19,14 +23,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	MeshTrafficPermissionResourceTypeDescriptor.Schema = &schema
+	MeshTrafficPermissionResourceTypeDescriptor.Validator = validator
+	MeshTrafficPermissionResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (
diff --git a/tools/policy-gen/generator/cmd/core_resource.go b/tools/policy-gen/generator/cmd/core_resource.go
index 75d8d0c29..2fdfe12d5 100644
--- a/tools/policy-gen/generator/cmd/core_resource.go
+++ b/tools/policy-gen/generator/cmd/core_resource.go
@@ -51,7 +51,11 @@ import (
 {{- end }}
 	"fmt"
 
-	"k8s.io/kube-openapi/pkg/validation/spec"
+	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
+	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+	"k8s.io/apiextensions-apiserver/pkg/apiserver/schema"
+	"k8s.io/kube-openapi/pkg/validation/strfmt"
+	"k8s.io/kube-openapi/pkg/validation/validate"
 	"sigs.k8s.io/yaml"
 
 	"github.com/kumahq/kuma/pkg/core/resources/model"
@@ -63,14 +67,28 @@ import (
 var rawSchema []byte
 
 func init() {
-	var schema spec.Schema
+	var structuralSchema *schema.Structural
+	var v1JsonSchemaProps *apiextensionsv1.JSONSchemaProps
+	var validator *validate.SchemaValidator
 	if rawSchema != nil {
-		if err := yaml.Unmarshal(rawSchema, &schema); err != nil {
+		if err := yaml.Unmarshal(rawSchema, &v1JsonSchemaProps); err != nil {
 			panic(err)
 		}
+		var jsonSchemaProps apiextensions.JSONSchemaProps
+		err := apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps(v1JsonSchemaProps, &jsonSchemaProps, nil)
+		if err != nil {
+			panic(err)
+		}
+		structuralSchema, err = schema.NewStructural(&jsonSchemaProps)
+		if err != nil {
+			panic(err)
+		}
+		schemaObject := structuralSchema.ToKubeOpenAPI()
+		validator = validate.NewSchemaValidator(schemaObject, nil, "", strfmt.Default)
 	}
 	rawSchema = nil
-	{{.Name}}ResourceTypeDescriptor.Schema = &schema
+	{{.Name}}ResourceTypeDescriptor.Validator = validator
+	{{.Name}}ResourceTypeDescriptor.StructuralSchema = structuralSchema
 }
 
 const (


Test patch:
diff --git a/app/kumactl/cmd/install/testdata/install-control-plane.defaults.golden.yaml b/app/kumactl/cmd/install/testdata/install-control-plane.defaults.golden.yaml
index 227312253..979a3bf81 100644
--- a/app/kumactl/cmd/install/testdata/install-control-plane.defaults.golden.yaml
+++ b/app/kumactl/cmd/install/testdata/install-control-plane.defaults.golden.yaml
@@ -5892,6 +5892,7 @@ spec:
                     type: object
                 type: object
               state:
+                default: Unavailable
                 description: |-
                   State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
                   It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present.yaml b/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present.yaml
index 3ac04320b..5bfe8aa52 100644
--- a/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present.yaml
+++ b/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present.yaml
@@ -5892,6 +5892,7 @@ spec:
                     type: object
                 type: object
               state:
+                default: Unavailable
                 description: |-
                   State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
                   It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/app/kumactl/cmd/install/testdata/install-control-plane.with-helm-set.yaml b/app/kumactl/cmd/install/testdata/install-control-plane.with-helm-set.yaml
index 51fe668bd..97b53e3ca 100644
--- a/app/kumactl/cmd/install/testdata/install-control-plane.with-helm-set.yaml
+++ b/app/kumactl/cmd/install/testdata/install-control-plane.with-helm-set.yaml
@@ -5912,6 +5912,7 @@ spec:
                     type: object
                 type: object
               state:
+                default: Unavailable
                 description: |-
                   State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
                   It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml b/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml
index a90f43f3f..e9ae99406 100644
--- a/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml
+++ b/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml
@@ -7895,6 +7895,7 @@ spec:
                     type: object
                 type: object
               state:
+                default: Unavailable
                 description: |-
                   State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
                   It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
diff --git a/pkg/api-server/testdata/resources/crud/list_meshservices.golden.json b/pkg/api-server/testdata/resources/crud/list_meshservices.golden.json
index b791cc48e..281fc9c23 100644
--- a/pkg/api-server/testdata/resources/crud/list_meshservices.golden.json
+++ b/pkg/api-server/testdata/resources/crud/list_meshservices.golden.json
@@ -8,6 +8,7 @@
    "creationTime": "0001-01-01T00:00:00Z",
    "modificationTime": "0001-01-01T00:00:00Z",
    "spec": {
+    "state": "Unavailable",
     "selector": {
      "dataplaneTags": {
       "app": "redis"
@@ -38,6 +39,7 @@
    "creationTime": "0001-01-01T00:00:00Z",
    "modificationTime": "0001-01-01T00:00:00Z",
    "spec": {
+    "state": "Unavailable",
     "selector": {
      "dataplaneTags": {
       "app": "redis"
diff --git a/pkg/api-server/testdata/resources/crud/put_meshaccesslog.input.yaml b/pkg/api-server/testdata/resources/crud/put_meshaccesslog.input.yaml
new file mode 100644
index 000000000..624e2d5e6
--- /dev/null
+++ b/pkg/api-server/testdata/resources/crud/put_meshaccesslog.input.yaml
@@ -0,0 +1,4 @@
+#/meshes/default/meshaccesslogs/my-access-log 201 method=PUT
+#/meshes/default/meshaccesslogs/my-access-log 200
+type: Mesh
+name: default
diff --git a/pkg/api-server/testdata/resources/crud/put_meshaccesslog_00.golden.json b/pkg/api-server/testdata/resources/crud/put_meshaccesslog_00.golden.json
new file mode 100644
index 000000000..0967ef424
--- /dev/null
+++ b/pkg/api-server/testdata/resources/crud/put_meshaccesslog_00.golden.json
@@ -0,0 +1,1 @@
+{}
diff --git a/pkg/api-server/testdata/resources/crud/put_meshaccesslog_00.request.json b/pkg/api-server/testdata/resources/crud/put_meshaccesslog_00.request.json
new file mode 100644
index 000000000..43aeca50d
--- /dev/null
+++ b/pkg/api-server/testdata/resources/crud/put_meshaccesslog_00.request.json
@@ -0,0 +1,27 @@
+{
+  "type": "MeshAccessLog",
+  "name": "my-access-log",
+  "spec": {
+    "to": [
+      {
+        "default": {
+          "backends": [
+            {
+              "file": {
+                "format": {
+                  "plain": "[%START_TIME%] %KUMA_SOURCE_SERVICE% -> %KUMA_DESTINATION_SERVICE%",
+                  "type": "Plain"
+                },
+                "path": "/var/log/mesh_access.log"
+              },
+              "type": "File"
+            }
+          ]
+        },
+        "targetRef": {
+          "kind": "Mesh"
+        }
+      }
+    ]
+  }
+}
diff --git a/pkg/api-server/testdata/resources/crud/put_meshaccesslog_01.golden.json b/pkg/api-server/testdata/resources/crud/put_meshaccesslog_01.golden.json
new file mode 100644
index 000000000..f0db083af
--- /dev/null
+++ b/pkg/api-server/testdata/resources/crud/put_meshaccesslog_01.golden.json
@@ -0,0 +1,37 @@
+{
+ "type": "MeshAccessLog",
+ "mesh": "default",
+ "name": "my-access-log",
+ "creationTime": "0001-01-01T00:00:00Z",
+ "modificationTime": "0001-01-01T00:00:00Z",
+ "labels": {
+  "kuma.io/env": "universal",
+  "kuma.io/mesh": "default",
+  "kuma.io/origin": "zone",
+  "kuma.io/zone": "default"
+ },
+ "spec": {
+  "to": [
+   {
+    "targetRef": {
+     "kind": "Mesh"
+    },
+    "default": {
+     "backends": [
+      {
+       "type": "File",
+       "file": {
+        "format": {
+         "type": "Plain",
+         "plain": "[%START_TIME%] %KUMA_SOURCE_SERVICE% -> %KUMA_DESTINATION_SERVICE%",
+         "omitEmptyValues": false
+        },
+        "path": "/var/log/mesh_access.log"
+       }
+      }
+     ]
+    }
+   }
+  ]
+ }
+}
diff --git a/pkg/api-server/testdata/resources/crud/put_meshservice_01.golden.json b/pkg/api-server/testdata/resources/crud/put_meshservice_01.golden.json
index f14735dbc..c0283464b 100644
--- a/pkg/api-server/testdata/resources/crud/put_meshservice_01.golden.json
+++ b/pkg/api-server/testdata/resources/crud/put_meshservice_01.golden.json
@@ -20,7 +20,8 @@
   "ports": [
    {
     "port": 6379,
-    "targetPort": 6379
+    "targetPort": 6379,
+    "appProtocol": "tcp"
    }
   ]
  },
diff --git a/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/meshhttproute.golden.json b/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/meshhttproute.golden.json
index 4ea3b404a..2d30cc2c9 100644
--- a/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/meshhttproute.golden.json
+++ b/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/meshhttproute.golden.json
@@ -42,7 +42,8 @@
            "name": "backend_kuma-demo_svc_3001",
            "tags": {
             "version": "1.0"
-           }
+           },
+           "weight": 1
           }
          ]
         }
@@ -84,14 +85,16 @@
            "name": "other-svc",
            "tags": {
             "version": "1.0"
-           }
+           },
+           "weight": 1
           },
           {
            "kind": "MeshServiceSubset",
            "name": "other-svc-2",
            "tags": {
             "version": "1.0"
-           }
+           },
+           "weight": 1
           }
          ]
         }
diff --git a/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/overriding_meshtrace.golden.json b/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/overriding_meshtrace.golden.json
index 89d3683ef..d9b1bd204 100644
--- a/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/overriding_meshtrace.golden.json
+++ b/pkg/api-server/testdata/resources/inspect/dataplanes/_rules/overriding_meshtrace.golden.json
@@ -15,7 +15,10 @@
       {
        "type": "Zipkin",
        "zipkin": {
-        "url": "http://jaeger-collector:9411/api/v2/spans"
+        "url": "http://jaeger-collector:9411/api/v2/spans",
+        "traceId128bit": false,
+        "apiVersion": "httpJson",
+        "sharedSpanContext": true
        }
       }
      ],
diff --git a/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshgateway2.golden.json b/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshgateway2.golden.json
index 511d11d57..60fbc3e15 100644
--- a/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshgateway2.golden.json
+++ b/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshgateway2.golden.json
@@ -79,7 +79,8 @@
             "name": "backend_kuma-demo_svc_3001",
             "tags": {
              "version": "v0"
-            }
+            },
+            "weight": 1
            }
           ]
          }
@@ -110,7 +111,8 @@
             "name": "backend_kuma-demo_svc_3001",
             "tags": {
              "version": "v0"
-            }
+            },
+            "weight": 1
            }
           ]
          }
@@ -134,7 +136,8 @@
             "name": "backend_kuma-demo_svc_3001",
             "tags": {
              "version": "v0"
-            }
+            },
+            "weight": 1
            }
           ]
          }
@@ -212,7 +215,8 @@
            "name": "backend_kuma-demo_svc_3001",
            "tags": {
             "version": "v0"
-           }
+           },
+           "weight": 1
           }
          ]
         }
@@ -236,7 +240,8 @@
            "name": "backend_kuma-demo_svc_3001",
            "tags": {
             "version": "v0"
-           }
+           },
+           "weight": 1
           }
          ]
         }
@@ -296,7 +301,8 @@
            "name": "backend_kuma-demo_svc_3001",
            "tags": {
             "version": "v0"
-           }
+           },
+           "weight": 1
           }
          ]
         }
diff --git a/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshhttproute.golden.json b/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshhttproute.golden.json
index 5dbbde022..b67d666b5 100644
--- a/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshhttproute.golden.json
+++ b/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshhttproute.golden.json
@@ -56,7 +56,8 @@
             "name": "backend_kuma-demo_svc_3001",
             "tags": {
              "version": "1.0"
-            }
+            },
+            "weight": 1
            }
           ]
          }
@@ -77,14 +78,16 @@
             "name": "other-svc",
             "tags": {
              "version": "1.0"
-            }
+            },
+            "weight": 1
            },
            {
             "kind": "MeshServiceSubset",
             "name": "other-svc-2",
             "tags": {
              "version": "1.0"
-            }
+            },
+            "weight": 1
            }
           ]
          }
@@ -147,7 +150,8 @@
            "name": "backend_kuma-demo_svc_3001",
            "tags": {
             "version": "1.0"
-           }
+           },
+           "weight": 1
           }
          ]
         }
@@ -168,14 +172,16 @@
            "name": "other-svc",
            "tags": {
             "version": "1.0"
-           }
+           },
+           "weight": 1
           },
           {
            "kind": "MeshServiceSubset",
            "name": "other-svc-2",
            "tags": {
             "version": "1.0"
-           }
+           },
+           "weight": 1
           }
          ]
         }
diff --git a/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshtrace_on_mesh.golden.json b/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshtrace_on_mesh.golden.json
index 8d6a5f33d..a2d4ee3fe 100644
--- a/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshtrace_on_mesh.golden.json
+++ b/pkg/api-server/testdata/resources/inspect/meshgateways/_rules/meshtrace_on_mesh.golden.json
@@ -18,7 +18,10 @@
       {
        "type": "Zipkin",
        "zipkin": {
-        "url": "http://jaeger-collector:9411/api/v2/spans"
+        "url": "http://jaeger-collector:9411/api/v2/spans",
+        "traceId128bit": false,
+        "apiVersion": "httpJson",
+        "sharedSpanContext": true
        }
       }
      ]
diff --git a/pkg/core/resources/manager/manager_test.go b/pkg/core/resources/manager/manager_test.go
index 812b68aaa..3d0dc3654 100644
--- a/pkg/core/resources/manager/manager_test.go
+++ b/pkg/core/resources/manager/manager_test.go
@@ -8,12 +8,10 @@ import (
 
 	mesh_proto "github.com/kumahq/kuma/api/mesh/v1alpha1"
 	core_mesh "github.com/kumahq/kuma/pkg/core/resources/apis/mesh"
-	"github.com/kumahq/kuma/pkg/core/resources/apis/meshservice/api/v1alpha1"
 	"github.com/kumahq/kuma/pkg/core/resources/manager"
 	"github.com/kumahq/kuma/pkg/core/resources/model"
 	"github.com/kumahq/kuma/pkg/core/resources/store"
 	"github.com/kumahq/kuma/pkg/plugins/resources/memory"
-	"github.com/kumahq/kuma/pkg/test/resources/samples"
 )
 
 var _ = Describe("Resource Manager", func() {
@@ -75,20 +73,6 @@ var _ = Describe("Resource Manager", func() {
 			// then
 			Expect(err.Error()).To(Equal("mesh of name mesh-1 is not found"))
 		})
-
-		It("should default if a resource has a defaulter", func() {
-			// given
-			Expect(samples.MeshDefaultBuilder().Create(resManager)).To(Succeed())
-
-			// when
-			err := samples.MeshServiceBackendBuilder().WithState("").Create(resManager)
-
-			// then
-			Expect(err).ToNot(HaveOccurred())
-			getMs := v1alpha1.NewMeshServiceResource()
-			Expect(resManager.Get(context.Background(), getMs, store.GetByKey("backend", "default"))).To(Succeed())
-			Expect(getMs.Spec.State).To(Equal(v1alpha1.StateUnavailable))
-		})
 	})
 
 	Describe("DeleteAll()", func() {
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-k8s.golden.yaml
index fbffab34e..86cd88017 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-uni.golden.yaml
index 295126d2d..e10c650a4 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s-2-zone-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s.golden.yaml
index e96bc71fa..598799427 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-k8s.golden.yaml
index 42d38320e..bc850f974 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-uni.golden.yaml
index b3bf4c69c..884a71470 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni-2-zone-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni.golden.yaml
index cc17a5c02..b64c0eee9 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.global-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-k8s.golden.yaml
index 367816829..ef2263875 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-k8s:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-uni.golden.yaml
index 24c35ad4c..db6c499ea 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-global-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-k8s:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-k8s.golden.yaml
index 367816829..ef2263875 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-k8s:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-uni.golden.yaml
index 24c35ad4c..db6c499ea 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s-2-zone-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-k8s:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s.golden.yaml
index b81d1f9c0..62553bf37 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-k8s:namespace/ns-k8s:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-k8s.golden.yaml
index d281ef953..7326e6c4c 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-uni:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-uni.golden.yaml
index 026de5fb2..5690c34bc 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-global-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-uni:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-k8s.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-k8s.golden.yaml
index d281ef953..7326e6c4c 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-k8s.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-k8s.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-uni:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-uni.golden.yaml
index 026de5fb2..5690c34bc 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni-2-zone-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-uni:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni.golden.yaml b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni.golden.yaml
index dc364261a..254d4447e 100644
--- a/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni.golden.yaml
+++ b/pkg/plugins/policies/core/rules/outbound/testdata/resourcerules/mhr_backendrefs.zone-uni.golden.yaml
@@ -20,6 +20,7 @@ meshservice:mesh/mesh-1:zone/zone-uni:name/backend:
         backendRefs:
         - kind: MeshService
           name: backend-v1
+          weight: 1
       matches:
       - path:
           type: PathPrefix
diff --git a/pkg/plugins/policies/core/rules/testdata/rules/single/06.golden.yaml b/pkg/plugins/policies/core/rules/testdata/rules/single/06.golden.yaml
index af2be6b1e..6bb17788c 100644
--- a/pkg/plugins/policies/core/rules/testdata/rules/single/06.golden.yaml
+++ b/pkg/plugins/policies/core/rules/testdata/rules/single/06.golden.yaml
@@ -4,6 +4,9 @@ Rules:
     backends:
     - type: Zipkin
       zipkin:
+        apiVersion: httpJson
+        sharedSpanContext: true
+        traceId128bit: false
         url: http://jaeger-collector.mesh-observability:9411/api/v2/spans
     tags:
     - literal: core
diff --git a/pkg/plugins/policies/core/rules/testdata/rules/single/07.golden.yaml b/pkg/plugins/policies/core/rules/testdata/rules/single/07.golden.yaml
index cadd366b4..90742809f 100644
--- a/pkg/plugins/policies/core/rules/testdata/rules/single/07.golden.yaml
+++ b/pkg/plugins/policies/core/rules/testdata/rules/single/07.golden.yaml
@@ -3,6 +3,7 @@ Rules:
   Conf:
     backends:
     - datadog:
+        splitService: false
         url: http://ingest.datadoghq.eu:8126
       type: Datadog
     tags:
diff --git a/pkg/plugins/policies/core/rules/testdata/rules/to/meshtcproute.golden.yaml b/pkg/plugins/policies/core/rules/testdata/rules/to/meshtcproute.golden.yaml
index 31da5804f..38d73cac2 100644
--- a/pkg/plugins/policies/core/rules/testdata/rules/to/meshtcproute.golden.yaml
+++ b/pkg/plugins/policies/core/rules/testdata/rules/to/meshtcproute.golden.yaml
@@ -16,10 +16,12 @@ Rules:
         weight: 20
   Origin:
   - creationTime: "0001-01-01T00:00:00Z"
+    mesh: default
     modificationTime: "0001-01-01T00:00:00Z"
     name: split-90-10
     type: MeshTCPRoute
   - creationTime: "0001-01-01T00:00:00Z"
+    mesh: default
     modificationTime: "0001-01-01T00:00:00Z"
     name: split-40-40-20
     type: MeshTCPRoute