From 5ee74f4af69033fccae7ce111971461db5c41d3f Mon Sep 17 00:00:00 2001 From: AyushSenapati Date: Sat, 7 Jan 2023 21:30:52 +0530 Subject: [PATCH 1/5] fix: TargetRef is omitempty Remove omitempty for all TargetRefs and regenerate the policies Signed-off-by: AyushSenapati --- deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml | 4 ++++ .../charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml | 4 ++++ deployments/charts/kuma/crds/kuma.io_meshhealthchecks.yaml | 4 ++++ deployments/charts/kuma/crds/kuma.io_meshratelimits.yaml | 4 ++++ deployments/charts/kuma/crds/kuma.io_meshretries.yaml | 4 ++++ deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml | 4 ++++ deployments/charts/kuma/crds/kuma.io_meshtraces.yaml | 2 ++ .../charts/kuma/crds/kuma.io_meshtrafficpermissions.yaml | 4 ++++ .../donothingpolicy/api/v1alpha1/donothingpolicy.go | 4 ++-- .../policies/donothingpolicy/api/v1alpha1/schema.yaml | 4 ++++ .../donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml | 4 ++++ .../policies/meshaccesslog/api/v1alpha1/meshaccesslog.go | 4 ++-- pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml | 4 ++++ .../meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml | 4 ++++ .../meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go | 4 ++-- .../policies/meshcircuitbreaker/api/v1alpha1/schema.yaml | 4 ++++ .../k8s/crd/kuma.io_meshcircuitbreakers.yaml | 4 ++++ .../meshhealthcheck/api/v1alpha1/meshhealthcheck.go | 4 ++-- .../policies/meshhealthcheck/api/v1alpha1/schema.yaml | 4 ++++ .../meshhealthcheck/k8s/crd/kuma.io_meshhealthchecks.yaml | 4 ++++ .../policies/meshratelimit/api/v1alpha1/meshratelimit.go | 4 ++-- pkg/plugins/policies/meshratelimit/api/v1alpha1/schema.yaml | 4 ++++ .../meshratelimit/k8s/crd/kuma.io_meshratelimits.yaml | 4 ++++ pkg/plugins/policies/meshretry/api/v1alpha1/meshretry.go | 4 ++-- pkg/plugins/policies/meshretry/api/v1alpha1/schema.yaml | 4 ++++ .../policies/meshretry/k8s/crd/kuma.io_meshretries.yaml | 4 ++++ .../policies/meshtimeout/api/v1alpha1/meshtimeout.go | 4 ++-- pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml | 4 ++++ .../policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml | 4 ++++ pkg/plugins/policies/meshtrace/api/v1alpha1/meshtrace.go | 2 +- pkg/plugins/policies/meshtrace/api/v1alpha1/schema.yaml | 2 ++ .../policies/meshtrace/k8s/crd/kuma.io_meshtraces.yaml | 2 ++ .../api/v1alpha1/meshtrafficpermission.go | 6 +++--- .../policies/meshtrafficpermission/api/v1alpha1/schema.yaml | 4 ++++ .../k8s/crd/kuma.io_meshtrafficpermissions.yaml | 4 ++++ 35 files changed, 116 insertions(+), 18 deletions(-) diff --git a/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml b/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml index d89d41f96a13..92b6ffe45962 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml @@ -261,8 +261,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml b/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml index 0a576d5518d6..d8ee84b761f3 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml @@ -638,8 +638,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/deployments/charts/kuma/crds/kuma.io_meshhealthchecks.yaml b/deployments/charts/kuma/crds/kuma.io_meshhealthchecks.yaml index b090b7bdd4e3..d62b30ecd9ac 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshhealthchecks.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshhealthchecks.yaml @@ -262,8 +262,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/deployments/charts/kuma/crds/kuma.io_meshratelimits.yaml b/deployments/charts/kuma/crds/kuma.io_meshratelimits.yaml index 23e8ee1a9e21..98c7b18149e9 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshratelimits.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshratelimits.yaml @@ -146,6 +146,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -177,6 +179,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true diff --git a/deployments/charts/kuma/crds/kuma.io_meshretries.yaml b/deployments/charts/kuma/crds/kuma.io_meshretries.yaml index 16606dab4bb8..15d13b4f9baa 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshretries.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshretries.yaml @@ -235,8 +235,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml b/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml index ff65eb113688..f697711fc6a5 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml @@ -229,8 +229,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/deployments/charts/kuma/crds/kuma.io_meshtraces.yaml b/deployments/charts/kuma/crds/kuma.io_meshtraces.yaml index 9aff71fa399a..e0daaa2becda 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshtraces.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshtraces.yaml @@ -174,6 +174,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true diff --git a/deployments/charts/kuma/crds/kuma.io_meshtrafficpermissions.yaml b/deployments/charts/kuma/crds/kuma.io_meshtrafficpermissions.yaml index e3b161779340..137078d1e5be 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshtrafficpermissions.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshtrafficpermissions.yaml @@ -84,6 +84,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -115,6 +117,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go index b518accd320c..3196fc308792 100644 --- a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go +++ b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go @@ -11,7 +11,7 @@ type DoNothingPolicy struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // To list makes a match between the consumed services and corresponding configurations To []To `json:"to,omitempty"` // From list makes a match between clients and corresponding configurations @@ -21,7 +21,7 @@ type DoNothingPolicy struct { type To struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of destinations referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml index f14fc00ee7c0..9afd7c9bbfad 100644 --- a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml @@ -110,6 +110,10 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object diff --git a/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml b/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml index fab3e46bc643..13f9c9c52dc7 100644 --- a/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml +++ b/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml @@ -153,8 +153,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go index da423894f3bf..a08d47be5edb 100644 --- a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go +++ b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go @@ -11,7 +11,7 @@ type MeshAccessLog struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // To list makes a match between the consumed services and corresponding configurations To []To `json:"to,omitempty"` // From list makes a match between clients and corresponding configurations @@ -21,7 +21,7 @@ type MeshAccessLog struct { type To struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of destinations referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml index e16439d7aa06..50fbaa62d4dc 100644 --- a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml @@ -212,6 +212,10 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml b/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml index d89d41f96a13..92b6ffe45962 100644 --- a/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml +++ b/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml @@ -261,8 +261,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go index 565b52aefe38..c71d391a0a0a 100644 --- a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go +++ b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go @@ -12,7 +12,7 @@ type MeshCircuitBreaker struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined in place. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // To list makes a match between the consumed services and corresponding // configurations @@ -25,7 +25,7 @@ type MeshCircuitBreaker struct { type To struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of destinations // referenced in 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml index 334c71fe9338..d357cce95eae 100644 --- a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml @@ -312,6 +312,10 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml b/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml index 0a576d5518d6..d8ee84b761f3 100644 --- a/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml +++ b/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml @@ -638,8 +638,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/meshhealthcheck.go b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/meshhealthcheck.go index 73303ad5ff18..c21607477c4c 100644 --- a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/meshhealthcheck.go +++ b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/meshhealthcheck.go @@ -13,7 +13,7 @@ type MeshHealthCheck struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // To list makes a match between the consumed services and corresponding configurations To []To `json:"to,omitempty"` @@ -22,7 +22,7 @@ type MeshHealthCheck struct { type To struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of destinations referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/schema.yaml index 9edcfaeb8aea..3461400ae46f 100644 --- a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/schema.yaml @@ -176,6 +176,10 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshhealthcheck/k8s/crd/kuma.io_meshhealthchecks.yaml b/pkg/plugins/policies/meshhealthcheck/k8s/crd/kuma.io_meshhealthchecks.yaml index b090b7bdd4e3..d62b30ecd9ac 100644 --- a/pkg/plugins/policies/meshhealthcheck/k8s/crd/kuma.io_meshhealthchecks.yaml +++ b/pkg/plugins/policies/meshhealthcheck/k8s/crd/kuma.io_meshhealthchecks.yaml @@ -262,8 +262,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshratelimit/api/v1alpha1/meshratelimit.go b/pkg/plugins/policies/meshratelimit/api/v1alpha1/meshratelimit.go index dc62c4f07d93..6b66deb41526 100644 --- a/pkg/plugins/policies/meshratelimit/api/v1alpha1/meshratelimit.go +++ b/pkg/plugins/policies/meshratelimit/api/v1alpha1/meshratelimit.go @@ -12,7 +12,7 @@ type MeshRateLimit struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // From list makes a match between clients and corresponding configurations From []From `json:"from,omitempty"` } @@ -20,7 +20,7 @@ type MeshRateLimit struct { type From struct { // TargetRef is a reference to the resource that represents a group of // clients. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of clients referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshratelimit/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshratelimit/api/v1alpha1/schema.yaml index 04649fe32223..c81e31b9b67f 100644 --- a/pkg/plugins/policies/meshratelimit/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshratelimit/api/v1alpha1/schema.yaml @@ -105,6 +105,8 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -131,4 +133,6 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshratelimit/k8s/crd/kuma.io_meshratelimits.yaml b/pkg/plugins/policies/meshratelimit/k8s/crd/kuma.io_meshratelimits.yaml index 23e8ee1a9e21..98c7b18149e9 100644 --- a/pkg/plugins/policies/meshratelimit/k8s/crd/kuma.io_meshratelimits.yaml +++ b/pkg/plugins/policies/meshratelimit/k8s/crd/kuma.io_meshratelimits.yaml @@ -146,6 +146,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -177,6 +179,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshretry/api/v1alpha1/meshretry.go b/pkg/plugins/policies/meshretry/api/v1alpha1/meshretry.go index 0d1b49e2a56d..5474db68e28f 100644 --- a/pkg/plugins/policies/meshretry/api/v1alpha1/meshretry.go +++ b/pkg/plugins/policies/meshretry/api/v1alpha1/meshretry.go @@ -12,7 +12,7 @@ type MeshRetry struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // To list makes a match between the consumed services and corresponding configurations To []To `json:"to,omitempty"` } @@ -20,7 +20,7 @@ type MeshRetry struct { type To struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of destinations referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshretry/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshretry/api/v1alpha1/schema.yaml index 673475610bb2..3786f34404d9 100644 --- a/pkg/plugins/policies/meshretry/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshretry/api/v1alpha1/schema.yaml @@ -162,6 +162,10 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshretry/k8s/crd/kuma.io_meshretries.yaml b/pkg/plugins/policies/meshretry/k8s/crd/kuma.io_meshretries.yaml index 16606dab4bb8..15d13b4f9baa 100644 --- a/pkg/plugins/policies/meshretry/k8s/crd/kuma.io_meshretries.yaml +++ b/pkg/plugins/policies/meshretry/k8s/crd/kuma.io_meshretries.yaml @@ -235,8 +235,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go b/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go index 240491aca012..6a40bbf59b8a 100644 --- a/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go +++ b/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go @@ -12,7 +12,7 @@ type MeshTimeout struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // To list makes a match between the consumed services and corresponding configurations To []To `json:"to,omitempty"` // From list makes a match between clients and corresponding configurations @@ -22,7 +22,7 @@ type MeshTimeout struct { type To struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of destinations referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml index 03a5ead337e0..6f29c6274ad7 100644 --- a/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml @@ -148,6 +148,10 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml b/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml index ff65eb113688..f697711fc6a5 100644 --- a/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml +++ b/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml @@ -229,8 +229,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshtrace/api/v1alpha1/meshtrace.go b/pkg/plugins/policies/meshtrace/api/v1alpha1/meshtrace.go index e542c337d677..badbc2df8a1e 100644 --- a/pkg/plugins/policies/meshtrace/api/v1alpha1/meshtrace.go +++ b/pkg/plugins/policies/meshtrace/api/v1alpha1/meshtrace.go @@ -11,7 +11,7 @@ type MeshTrace struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // MeshTrace configuration. Default Conf `json:"default,omitempty"` } diff --git a/pkg/plugins/policies/meshtrace/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshtrace/api/v1alpha1/schema.yaml index 452641ae3568..546d0e60563d 100644 --- a/pkg/plugins/policies/meshtrace/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshtrace/api/v1alpha1/schema.yaml @@ -116,4 +116,6 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshtrace/k8s/crd/kuma.io_meshtraces.yaml b/pkg/plugins/policies/meshtrace/k8s/crd/kuma.io_meshtraces.yaml index 9aff71fa399a..e0daaa2becda 100644 --- a/pkg/plugins/policies/meshtrace/k8s/crd/kuma.io_meshtraces.yaml +++ b/pkg/plugins/policies/meshtrace/k8s/crd/kuma.io_meshtraces.yaml @@ -174,6 +174,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true diff --git a/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/meshtrafficpermission.go b/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/meshtrafficpermission.go index de3e51e88338..69e9b1667834 100644 --- a/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/meshtrafficpermission.go +++ b/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/meshtrafficpermission.go @@ -11,7 +11,7 @@ type MeshTrafficPermission struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // From list makes a match between clients and corresponding configurations From []From `json:"from,omitempty"` } @@ -19,7 +19,7 @@ type MeshTrafficPermission struct { type From struct { // TargetRef is a reference to the resource that represents a group of // clients. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of clients referenced in // 'targetRef' Default Conf `json:"default,omitempty"` @@ -34,7 +34,7 @@ var ALLOW Action = "ALLOW" var DENY Action = "DENY" // ALLOW_WITH_SHADOW_DENY action lets the requests pass but emits logs as if -// requests are denied +// requests are denied var ALLOW_WITH_SHADOW_DENY Action = "ALLOW_WITH_SHADOW_DENY" type Conf struct { diff --git a/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/schema.yaml index c3c3d69036bf..95ed59d3724f 100644 --- a/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshtrafficpermission/api/v1alpha1/schema.yaml @@ -53,6 +53,8 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -79,4 +81,6 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object diff --git a/pkg/plugins/policies/meshtrafficpermission/k8s/crd/kuma.io_meshtrafficpermissions.yaml b/pkg/plugins/policies/meshtrafficpermission/k8s/crd/kuma.io_meshtrafficpermissions.yaml index e3b161779340..137078d1e5be 100644 --- a/pkg/plugins/policies/meshtrafficpermission/k8s/crd/kuma.io_meshtrafficpermissions.yaml +++ b/pkg/plugins/policies/meshtrafficpermission/k8s/crd/kuma.io_meshtrafficpermissions.yaml @@ -84,6 +84,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -115,6 +117,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true From 66158706d4c62f9d4e6e4be66fe37fd005a415cd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 08:25:59 +0000 Subject: [PATCH 2/5] fix(ci): format files Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- ...install-control-plane.defaults.golden.yaml | 30 +++++++++++++++++++ ...plane.gateway-api-present-not-enabled.yaml | 30 +++++++++++++++++++ ...all-control-plane.gateway-api-present.yaml | 30 +++++++++++++++++++ .../install-control-plane.with-helm-set.yaml | 30 +++++++++++++++++++ .../testdata/install-crds.all.golden.yaml | 30 +++++++++++++++++++ ...l-crds.experimental-gatewayapi.golden.yaml | 30 +++++++++++++++++++ 6 files changed, 180 insertions(+) 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 b17391448109..d58746a151b9 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 @@ -799,8 +799,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -998,6 +1002,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1029,6 +1035,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1270,8 +1278,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1507,8 +1519,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1689,6 +1705,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1779,6 +1797,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1810,6 +1830,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -3023,8 +3045,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -3669,8 +3695,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true diff --git a/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml b/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml index b17391448109..d58746a151b9 100644 --- a/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml +++ b/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml @@ -799,8 +799,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -998,6 +1002,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1029,6 +1035,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1270,8 +1278,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1507,8 +1519,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1689,6 +1705,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1779,6 +1797,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1810,6 +1830,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -3023,8 +3045,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -3669,8 +3695,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true 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 b771fea3d85d..a2b8f22f5671 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 @@ -931,8 +931,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1130,6 +1134,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1161,6 +1167,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1402,8 +1410,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1639,8 +1651,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1821,6 +1837,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1956,6 +1974,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1987,6 +2007,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -3155,8 +3177,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -3801,8 +3827,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true 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 ce2860f57f7d..7ab78a115cd3 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 @@ -819,8 +819,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1018,6 +1022,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1049,6 +1055,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1290,8 +1298,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1527,8 +1539,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1709,6 +1725,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -1799,6 +1817,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -1830,6 +1850,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -3043,8 +3065,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -3689,8 +3715,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true 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 a16e083acc4c..2e77069be823 100644 --- a/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml +++ b/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml @@ -642,8 +642,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1288,8 +1292,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1952,8 +1960,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -2151,6 +2163,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2182,6 +2196,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -2423,8 +2439,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -2660,8 +2680,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -2842,6 +2866,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -2932,6 +2958,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2963,6 +2991,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true diff --git a/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml b/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml index 73f52b1c1da8..71939996fd2a 100644 --- a/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml +++ b/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml @@ -642,8 +642,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -1288,8 +1292,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -2084,8 +2092,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -2283,6 +2295,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2314,6 +2328,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -2555,8 +2571,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -2792,8 +2812,12 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array + required: + - targetRef type: object type: object served: true @@ -2974,6 +2998,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true @@ -3064,6 +3090,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -3095,6 +3123,8 @@ spec: Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: object served: true From 0ff7c879d90bb8a8b9b721f7c40e240acb98b5e8 Mon Sep 17 00:00:00 2001 From: Mike Beaumont Date: Mon, 9 Jan 2023 10:00:24 +0100 Subject: [PATCH 3/5] refactor: don't use omitempty when generating targetRef Signed-off-by: Mike Beaumont --- tools/policy-gen/bootstrap/root.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/policy-gen/bootstrap/root.go b/tools/policy-gen/bootstrap/root.go index 84ba01d32e3f..1e300a0ff81c 100644 --- a/tools/policy-gen/bootstrap/root.go +++ b/tools/policy-gen/bootstrap/root.go @@ -176,7 +176,7 @@ type {{ .name }} struct { // TargetRef is a reference to the resource the policy takes an effect on. // The resource could be either a real store object or virtual resource // defined inplace. - TargetRef common_api.TargetRef` + " `json:\"targetRef,omitempty\"`" + ` + TargetRef common_api.TargetRef` + " `json:\"targetRef\"`" + ` {{- end }} {{- if .generateTo }} // To list makes a match between the consumed services and corresponding configurations @@ -192,7 +192,7 @@ type {{ .name }} struct { type To struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef` + " `json:\"targetRef,omitempty\"`" + ` + TargetRef common_api.TargetRef` + " `json:\"targetRef\"`" + ` // Default is a configuration specific to the group of destinations referenced in // 'targetRef' Default Conf` + " `json:\"default,omitempty\"`" + ` @@ -204,7 +204,7 @@ type To struct { type From struct { // TargetRef is a reference to the resource that represents a group of // clients. - TargetRef common_api.TargetRef` + " `json:\"targetRef,omitempty\"`" + ` + TargetRef common_api.TargetRef` + " `json:\"targetRef\"`" + ` // Default is a configuration specific to the group of clients referenced in // 'targetRef' Default Conf` + " `json:\"default,omitempty\"`" + ` From c1ed57afe155170cb8a2a9bfb04cccd32e39accd Mon Sep 17 00:00:00 2001 From: Mike Beaumont Date: Mon, 9 Jan 2023 10:07:22 +0100 Subject: [PATCH 4/5] chore: remove remaining omitempty Signed-off-by: Mike Beaumont --- deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml | 2 ++ deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml | 2 ++ deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml | 2 ++ .../policies/donothingpolicy/api/v1alpha1/donothingpolicy.go | 2 +- pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml | 2 ++ .../donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml | 2 ++ .../policies/meshaccesslog/api/v1alpha1/meshaccesslog.go | 2 +- pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml | 2 ++ .../policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml | 2 ++ .../meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go | 2 +- .../policies/meshcircuitbreaker/api/v1alpha1/schema.yaml | 2 ++ .../meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml | 2 ++ pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go | 2 +- pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml | 2 ++ .../policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml | 2 ++ 15 files changed, 26 insertions(+), 4 deletions(-) diff --git a/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml b/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml index 92b6ffe45962..a23cdb8046ca 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshaccesslogs.yaml @@ -133,6 +133,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml b/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml index d8ee84b761f3..8cf8d1b4a398 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshcircuitbreakers.yaml @@ -322,6 +322,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml b/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml index f697711fc6a5..a4cfefec9182 100644 --- a/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml +++ b/deployments/charts/kuma/crds/kuma.io_meshtimeouts.yaml @@ -117,6 +117,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go index 3196fc308792..ef73f55e61bb 100644 --- a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go +++ b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/donothingpolicy.go @@ -30,7 +30,7 @@ type To struct { type From struct { // TargetRef is a reference to the resource that represents a group of // clients. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of clients referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml index 9afd7c9bbfad..e8546803014e 100644 --- a/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/donothingpolicy/api/v1alpha1/schema.yaml @@ -49,6 +49,8 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml b/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml index 13f9c9c52dc7..fad44fbcaa7d 100644 --- a/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml +++ b/pkg/plugins/policies/donothingpolicy/k8s/crd/kuma.io_donothingpolicies.yaml @@ -79,6 +79,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go index a08d47be5edb..5309f17014fe 100644 --- a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go +++ b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/meshaccesslog.go @@ -30,7 +30,7 @@ type To struct { type From struct { // TargetRef is a reference to the resource that represents a group of // clients. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of clients referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml index 50fbaa62d4dc..c5769438b8c1 100644 --- a/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshaccesslog/api/v1alpha1/schema.yaml @@ -100,6 +100,8 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml b/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml index 92b6ffe45962..a23cdb8046ca 100644 --- a/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml +++ b/pkg/plugins/policies/meshaccesslog/k8s/crd/kuma.io_meshaccesslogs.yaml @@ -133,6 +133,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go index c71d391a0a0a..1625a3c84094 100644 --- a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go +++ b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/meshcircuitbreaker.go @@ -34,7 +34,7 @@ type To struct { type From struct { // TargetRef is a reference to the resource that represents a group of // destinations. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of destinations // referenced in 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml index d357cce95eae..403befab44b9 100644 --- a/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshcircuitbreaker/api/v1alpha1/schema.yaml @@ -150,6 +150,8 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml b/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml index d8ee84b761f3..8cf8d1b4a398 100644 --- a/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml +++ b/pkg/plugins/policies/meshcircuitbreaker/k8s/crd/kuma.io_meshcircuitbreakers.yaml @@ -322,6 +322,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go b/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go index 6a40bbf59b8a..12712705b43f 100644 --- a/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go +++ b/pkg/plugins/policies/meshtimeout/api/v1alpha1/meshtimeout.go @@ -31,7 +31,7 @@ type To struct { type From struct { // TargetRef is a reference to the resource that represents a group of // clients. - TargetRef common_api.TargetRef `json:"targetRef,omitempty"` + TargetRef common_api.TargetRef `json:"targetRef"` // Default is a configuration specific to the group of clients referenced in // 'targetRef' Default Conf `json:"default,omitempty"` diff --git a/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml b/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml index 6f29c6274ad7..cdf3cc7139e0 100644 --- a/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml +++ b/pkg/plugins/policies/meshtimeout/api/v1alpha1/schema.yaml @@ -68,6 +68,8 @@ properties: description: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml b/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml index f697711fc6a5..a4cfefec9182 100644 --- a/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml +++ b/pkg/plugins/policies/meshtimeout/k8s/crd/kuma.io_meshtimeouts.yaml @@ -117,6 +117,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: From f5538d843e50cd62c6bba6e7bffd1df49df20593 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 09:58:32 +0000 Subject: [PATCH 5/5] fix(ci): format files Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../testdata/install-control-plane.defaults.golden.yaml | 6 ++++++ ...stall-control-plane.gateway-api-present-not-enabled.yaml | 6 ++++++ .../testdata/install-control-plane.gateway-api-present.yaml | 6 ++++++ .../testdata/install-control-plane.with-helm-set.yaml | 6 ++++++ .../cmd/install/testdata/install-crds.all.golden.yaml | 6 ++++++ .../install-crds.experimental-gatewayapi.golden.yaml | 6 ++++++ 6 files changed, 36 insertions(+) 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 d58746a151b9..bc00fd1dff39 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 @@ -1407,6 +1407,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2917,6 +2919,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -3379,6 +3383,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml b/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml index d58746a151b9..bc00fd1dff39 100644 --- a/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml +++ b/app/kumactl/cmd/install/testdata/install-control-plane.gateway-api-present-not-enabled.yaml @@ -1407,6 +1407,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2917,6 +2919,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -3379,6 +3383,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: 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 a2b8f22f5671..8df78f78cb19 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 @@ -1539,6 +1539,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -3049,6 +3051,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -3511,6 +3515,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: 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 7ab78a115cd3..213de332d960 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 @@ -1427,6 +1427,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2937,6 +2939,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -3399,6 +3403,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: 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 2e77069be823..5b242ed74841 100644 --- a/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml +++ b/app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml @@ -514,6 +514,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -976,6 +978,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2568,6 +2572,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: diff --git a/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml b/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml index 71939996fd2a..aa071fb1860c 100644 --- a/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml +++ b/app/kumactl/cmd/install/testdata/install-crds.experimental-gatewayapi.golden.yaml @@ -514,6 +514,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -976,6 +978,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: @@ -2700,6 +2704,8 @@ spec: tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset` type: object type: object + required: + - targetRef type: object type: array targetRef: