Skip to content

Commit

Permalink
fix(policies): make options for policies simpler (#4722)
Browse files Browse the repository at this point in the history
- We were exposing all the parameters that were introduced
for transparent back compat with old policies and resources.
As everything is meant to be standard with these new policies
it's not required to expose all this and we should have a small
API with little tweakable parameters
- make Validate a separate runtime checked method

Signed-off-by: Charly Molter <charly.molter@konghq.com>
  • Loading branch information
lahabana authored Aug 1, 2022
1 parent 741f201 commit 9f5eab4
Show file tree
Hide file tree
Showing 58 changed files with 678 additions and 792 deletions.
217 changes: 150 additions & 67 deletions api/mesh/options.pb.go

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions api/mesh/options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ message KumaResourceOptions {
// Name of the resource's Go package.
string package = 4;

// Whether to generate a no-op validation function.
bool skip_validation = 5;

// Whether to skip type registration for this resource.
bool skip_registration = 6;

Expand Down Expand Up @@ -66,6 +63,15 @@ message KumaKdsOptions {
bool send_to_zone = 2;
}

message KumaPolicyOptions {
// Whether to skip type registration for this resource.
bool skip_registration = 1;
// An optional alternative plural form if this is unset default to a standard
// derivation of the name
string plural = 2;
}

extend google.protobuf.MessageOptions {
KumaResourceOptions resource = 43534533; // 'kuma'
KumaPolicyOptions policy = 43534534; // 'kuma'
}
214 changes: 107 additions & 107 deletions api/mesh/v1alpha1/dataplane_insight.pb.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion api/mesh/v1alpha1/dataplane_insight.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ message DataplaneInsight {
option (kuma.mesh.resource).name = "DataplaneInsightResource";
option (kuma.mesh.resource).type = "DataplaneInsight";
option (kuma.mesh.resource).package = "mesh";
option (kuma.mesh.resource).skip_validation = true;
option (kuma.mesh.resource).kds.send_to_global = true;
option (kuma.mesh.resource).ws.name = "dataplane-insight";
option (kuma.mesh.resource).ws.read_only = true;
Expand Down
13 changes: 6 additions & 7 deletions api/mesh/v1alpha1/dataplane_overview.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/mesh/v1alpha1/dataplane_overview.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ message DataplaneOverview {
option (kuma.mesh.resource).type = "DataplaneOverview";
option (kuma.mesh.resource).package = "mesh";
option (kuma.mesh.resource).skip_registration = true;
option (kuma.mesh.resource).skip_validation = true;
option (kuma.mesh.resource).skip_kubernetes_wrappers = true;

Dataplane dataplane = 1 [ (validate.rules).message.required = true ];
Expand Down
16 changes: 8 additions & 8 deletions api/mesh/v1alpha1/mesh_insight.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/mesh/v1alpha1/mesh_insight.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ message MeshInsight {
option (kuma.mesh.resource).type = "MeshInsight";
option (kuma.mesh.resource).global = true;
option (kuma.mesh.resource).package = "mesh";
option (kuma.mesh.resource).skip_validation = true;
option (kuma.mesh.resource).ws.name = "mesh-insight";
option (kuma.mesh.resource).ws.read_only = true;

Expand Down
31 changes: 15 additions & 16 deletions api/mesh/v1alpha1/service_insight.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/mesh/v1alpha1/service_insight.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ message ServiceInsight {
option (kuma.mesh.resource).name = "ServiceInsightResource";
option (kuma.mesh.resource).type = "ServiceInsight";
option (kuma.mesh.resource).package = "mesh";
option (kuma.mesh.resource).skip_validation = true;
option (kuma.mesh.resource).kds.send_to_zone = true;
option (kuma.mesh.resource).ws.name = "service-insight";
option (kuma.mesh.resource).ws.read_only = true;
Expand All @@ -23,7 +22,6 @@ message ServiceInsight {
option (kuma.mesh.resource).type = "ServiceOverview";
option (kuma.mesh.resource).package = "mesh";
option (kuma.mesh.resource).skip_registration = true;
option (kuma.mesh.resource).skip_validation = true;
option (kuma.mesh.resource).skip_kubernetes_wrappers = true;

enum Status {
Expand Down
20 changes: 10 additions & 10 deletions api/mesh/v1alpha1/zone_ingress_insight.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/mesh/v1alpha1/zone_ingress_insight.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ message ZoneIngressInsight {
option (kuma.mesh.resource).type = "ZoneIngressInsight";
option (kuma.mesh.resource).package = "mesh";
option (kuma.mesh.resource).global = true;
option (kuma.mesh.resource).skip_validation = true;
option (kuma.mesh.resource).kds.send_to_global = true;
option (kuma.mesh.resource).ws.name = "zone-ingress-insight";
option (kuma.mesh.resource).ws.read_only = true;
Expand Down
19 changes: 9 additions & 10 deletions api/mesh/v1alpha1/zoneegressinsight.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f5eab4

Please sign in to comment.