Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solo APIs. @tag-name=sa-k8s-1.28-bump #1084

Merged
merged 10 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 98 additions & 75 deletions api/rate-limiter/v1alpha1/ratelimit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ message SimpleDescriptor {
message RateLimitActions {
repeated Action actions = 1;
repeated Action set_actions = 2;
// An optional limit override to be appended to the descriptor produced by this rate limit configuration. If the override value is invalid or cannot be resolved from metadata, no override is provided.
Override limit = 3;
}

// A `RateLimit` specifies the actual rate limit that will be used when there is a match.
Expand Down Expand Up @@ -451,81 +453,6 @@ message Action {
repeated HeaderMatcher headers = 3; // [(validate.rules).repeated .min_items = 1];
}

// The following descriptor entry is appended when the metadata contains a key value:
// ("<descriptor_key>", "<value_queried_from_metadata>")
message MetaData {
enum Source {
// Query [dynamic metadata](https://www.envoyproxy.io/docs/envoy/latest/configuration/advanced/well_known_dynamic_metadata#well-known-dynamic-metadata).
DYNAMIC = 0;

// Query [route entry metadata](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-field-config-route-v3-route-metadata).
ROUTE_ENTRY = 1;
}

// MetadataKey provides a general interface using `key` and `path` to retrieve value from
// [`Metadata`](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/base.proto#envoy-v3-api-msg-config-core-v3-metadata).
//
// For example, for the following Metadata:
//
// ```yaml
// filter_metadata:
// envoy.xxx:
// prop:
// foo: bar
// xyz:
// hello: envoy
// ```
//
// The following MetadataKey will retrieve a string value "bar" from the Metadata.
//
// ```yaml
// key: envoy.xxx
// path:
// - key: prop
// - key: foo
// ```
//
message MetadataKey {

// Specifies the segment in a path to retrieve value from Metadata.
// Currently it is only supported to specify the key, i.e. field name, as one segment of a path.
message PathSegment {
oneof segment {
// option (validate.required) = true;

// Required. If specified, use the key to retrieve the value in a Struct.
string key = 1; // [(validate.rules).string = {min_len: 1}];
}
}

// Required. The key name of Metadata to retrieve the Struct from the metadata.
// Typically, it represents a builtin subsystem or custom extension.
string key = 1; // [(validate.rules).string = {min_len: 1}];

// Must have at least one element. The path to retrieve the Value from the Struct. It can be a prefix or a full path,
// e.g. ``[prop, xyz]`` for a struct or ``[prop, foo]`` for a string in the example,
// which depends on the particular scenario.
//
// Note: Due to that only the key type segment is supported, the path can not specify a list
// unless the list is the last segment.
repeated PathSegment path = 2; // [(validate.rules).repeated = {min_items: 1}];
}

// Required. The key to use in the descriptor entry.
string descriptor_key = 1; // [(validate.rules).string = {min_len: 1}];

// Required. Metadata struct that defines the key and path to retrieve the string value. A match will
// only happen if the value in the metadata is of type string.
MetadataKey metadata_key = 2; // [(validate.rules).message = {required: true}];

// An optional value to use if *metadata_key* is empty. If not set and
// no value is present under the metadata_key then no descriptor is generated.
string default_value = 3;

// Source of metadata
Source source = 4; // [(validate.rules).enum = {defined_only: true}];
}

oneof action_specifier {

// Rate limit on source cluster.
Expand All @@ -549,4 +476,100 @@ message Action {
// Rate limit on metadata.
MetaData metadata = 8;
}
}

// The following descriptor entry is appended when the metadata contains a key value:
// ("<descriptor_key>", "<value_queried_from_metadata>")
message MetaData {
enum Source {
// Query [dynamic metadata](https://www.envoyproxy.io/docs/envoy/latest/configuration/advanced/well_known_dynamic_metadata#well-known-dynamic-metadata).
DYNAMIC = 0;

// Query [route entry metadata](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-field-config-route-v3-route-metadata).
ROUTE_ENTRY = 1;
}

// MetadataKey provides a general interface using `key` and `path` to retrieve value from
// [`Metadata`](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/base.proto#envoy-v3-api-msg-config-core-v3-metadata).
//
// For example, for the following Metadata:
//
// ```yaml
// filter_metadata:
// envoy.xxx:
// prop:
// foo: bar
// xyz:
// hello: envoy
// ```
//
// The following MetadataKey will retrieve a string value "bar" from the Metadata.
//
// ```yaml
// key: envoy.xxx
// path:
// - key: prop
// - key: foo
// ```
//
message MetadataKey {

// Specifies the segment in a path to retrieve value from Metadata.
// Currently it is only supported to specify the key, i.e. field name, as one segment of a path.
message PathSegment {
oneof segment {
// option (validate.required) = true;

// Required. If specified, use the key to retrieve the value in a Struct.
string key = 1; // [(validate.rules).string = {min_len: 1}];
}
}

// Required. The key name of Metadata to retrieve the Struct from the metadata.
// Typically, it represents a builtin subsystem or custom extension.
string key = 1; // [(validate.rules).string = {min_len: 1}];

// Must have at least one element. The path to retrieve the Value from the Struct. It can be a prefix or a full path,
// e.g. ``[prop, xyz]`` for a struct or ``[prop, foo]`` for a string in the example,
// which depends on the particular scenario.
//
// Note: Due to that only the key type segment is supported, the path can not specify a list
// unless the list is the last segment.
repeated PathSegment path = 2; // [(validate.rules).repeated = {min_items: 1}];
}

// Required. The key to use in the descriptor entry.
string descriptor_key = 1; // [(validate.rules).string = {min_len: 1}];

// Required. Metadata struct that defines the key and path to retrieve the string value. A match will
// only happen if the value in the metadata is of type string.
MetadataKey metadata_key = 2; // [(validate.rules).message = {required: true}];

// An optional value to use if *metadata_key* is empty. If not set and
// no value is present under the metadata_key then no descriptor is generated.
string default_value = 3;

// Source of metadata
Source source = 4; // [(validate.rules).enum = {defined_only: true}];
}

// Copied directly from envoy
// https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-msg-config-route-v3-ratelimit-override
message Override {

// Fetches the override from the dynamic metadata.
message DynamicMetadata {
// Metadata struct that defines the key and path to retrieve the struct value.
// The value must be a struct containing an integer "requests_per_unit" property
// and a "unit" property with a value parseable to :ref:`RateLimitUnit
// enum <envoy_v3_api_enum_type.v3.RateLimitUnit>`
MetaData.MetadataKey metadata_key = 1; // [(validate.rules).message = {required: true}];
}

oneof override_specifier {
// option (validate.required) = true;

// Limit override from dynamic metadata.
DynamicMetadata dynamic_metadata = 1;
}
}
10 changes: 7 additions & 3 deletions codegen/gloo_fed.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ func GlooFedGroups() []model.Group {
Name: "GlooInstanceStatus",
GoPackage: "github.com/solo-io/solo-apis/pkg/api/fed.solo.io/v1/types",
}},
Stored: true,
},
},
RenderTypes: true,
RenderClients: true,
ApiRoot: "pkg/api",
RenderManifests: true,
RenderTypes: true,
RenderClients: true,
ApiRoot: "pkg/api",
SkipConditionalCRDLoading: true, // we want the alpha crds always rendered
SkipTemplatedCRDManifest: true, // do not make a copy of crds in templates dir
},
}
}
21 changes: 12 additions & 9 deletions codegen/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func makeGroup(
GoPackage: resource.goPackage,
},
},
Stored: true,
}
if !resource.noStatus {
res.Status = &model.Field{Type: model.Type{
Expand All @@ -51,14 +52,16 @@ func makeGroup(
Group: groupPrefix + "." + "solo.io",
Version: version,
},
Module: module,
Resources: resources,
RenderManifests: true,
RenderTypes: true,
RenderClients: true,
RenderController: true,
MockgenDirective: true,
CustomTemplates: customGroupTemplates,
ApiRoot: apiRoot,
Module: module,
Resources: resources,
RenderManifests: true,
RenderTypes: true,
RenderClients: true,
RenderController: true,
MockgenDirective: true,
CustomTemplates: customGroupTemplates,
ApiRoot: apiRoot,
SkipConditionalCRDLoading: true, // we want the alpha crds always rendered
SkipTemplatedCRDManifest: true, // do not make a copy of crds in templates dir
}
}
29 changes: 29 additions & 0 deletions crds/fed.solo.io_crds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Code generated by skv2. DO NOT EDIT.

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
crd.solo.io/specHash: 9981b6acea3cd6fd
labels:
app: ""
app.kubernetes.io/name: ""
name: glooinstances.fed.solo.io
spec:
group: fed.solo.io
names:
kind: GlooInstance
listKind: GlooInstanceList
plural: glooinstances
singular: glooinstance
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}
46 changes: 0 additions & 46 deletions crds/fed.solo.io_v1_crds.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
crd.solo.io/specHash: fb5efb3c73a177ce
crd.solo.io/specHash: 9790bc45b0f81891
labels:
app: ""
app.kubernetes.io/name: ""
name: routetables.gateway.solo.io
name: routeoptions.gateway.solo.io
spec:
group: gateway.solo.io
names:
kind: RouteTable
listKind: RouteTableList
plural: routetables
singular: routetable
kind: RouteOption
listKind: RouteOptionList
plural: routeoptions
singular: routeoption
scope: Namespaced
versions:
- name: v1
Expand All @@ -62,18 +62,18 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
crd.solo.io/specHash: d9f3604e9cd76e15
crd.solo.io/specHash: fb5efb3c73a177ce
labels:
app: ""
app.kubernetes.io/name: ""
name: virtualservices.gateway.solo.io
name: routetables.gateway.solo.io
spec:
group: gateway.solo.io
names:
kind: VirtualService
listKind: VirtualServiceList
plural: virtualservices
singular: virtualservice
kind: RouteTable
listKind: RouteTableList
plural: routetables
singular: routetable
scope: Namespaced
versions:
- name: v1
Expand Down Expand Up @@ -120,18 +120,18 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
crd.solo.io/specHash: 9790bc45b0f81891
crd.solo.io/specHash: d9f3604e9cd76e15
labels:
app: ""
app.kubernetes.io/name: ""
name: routeoptions.gateway.solo.io
name: virtualservices.gateway.solo.io
spec:
group: gateway.solo.io
names:
kind: RouteOption
listKind: RouteOptionList
plural: routeoptions
singular: routeoption
kind: VirtualService
listKind: VirtualServiceList
plural: virtualservices
singular: virtualservice
scope: Namespaced
versions:
- name: v1
Expand Down
Loading