-
Notifications
You must be signed in to change notification settings - Fork 337
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
feat(inspect-api): support for inbound rules #12713
base: master
Are you sure you want to change the base?
feat(inspect-api): support for inbound rules #12713
Conversation
Signed-off-by: Ilya Lobkov <[email protected]>
@@ -87,9 +90,20 @@ components: | |||
$ref: '#/components/schemas/ResourceRule' | |||
fromRules: | |||
type: array | |||
description: a set of rules for each inbound of this proxy | |||
description: a set of rules for each inbound of this proxy. The field is not set when 'interpretFromEntriesAsRules' on PolicyDescriptor is set to true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Just wondering why we have a specific interpretFromEntriesAsRules
property for the client to check, when (according to whats said in this description) they could also check for existence of fromRules
or inboundRules
?
(might have totally missed reasons for this in other issues etc so lmk!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some policies like MeshTimeout, MeshAccessLog and others we implicitly treat legacy spec.from
as spec.rules
because the conversion is straightforward. That's why if this flag interpretFromEntriesAsRules
is set for the policy you don't need to display both fromRules
and inboundRules
, the latter is sufficient.
For MeshTrafficPermission and MeshFaultInjection the conversion of spec.from
to spec.rules
is not straightforward. Legacy spec.from
and new spec.rules
policies will co-exist and that's why GUI needs to show both fromRules
and inboundRules
.
@@ -27,7 +27,7 @@ components: | |||
$ref: "#/components/schemas/PolicyDescription" | |||
PolicyDescription: | |||
type: object | |||
required: [hasToTargetRef, hasFromTargetRef, isTargetRef] | |||
required: [hasToTargetRef, hasFromTargetRef, isTargetRef, interpretFromEntriesAsRules] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not right. fromAliasForRules
maybe?
Have you tried to use a LLM to find a name? It's usually helpful for these things.
@@ -87,9 +90,20 @@ components: | |||
$ref: '#/components/schemas/ResourceRule' | |||
fromRules: | |||
type: array | |||
description: a set of rules for each inbound of this proxy | |||
description: a set of rules for each inbound of this proxy. The field is not set when 'interpretFromEntriesAsRules' on PolicyDescriptor is set to true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just keep it? And just mention that inboundRules are to be preferred.
Also can we rename toResourceRules
to outboundRules
?
So we'd have:
proxyRule: {},
outboundRules: {},
inboundRules: {}
?
Also getting side tracked here. But I feel like maybe our APIs are just not working out here and we should rethink them.
Should we:
GET /meshes/<mesh>/dataplanes/<dataplane>/_layout
labels:
key: value
name: foo
inbounds:
- port: "..."
name: "..."
labels: "..."
envoy_entity_names: [...]
outbounds:
- name: "..." # This would be the envoy name potentially
envoy_entity_names: [...]
entity: "<meta>" # This would be the meta the find the MeshService/MeshMZService...
proxyRules:
- type: "<policyType>"
warnings: []
conf: "interface{}"
origin: # respects the order in which they are applied
- meta1
- meta2
Once we have this we can have:
GET /meshes/<mesh>/dataplanes/<dataplane>/_rules/_outbound/<identifier>
rules:
- type: <the conf type>
and something similar for inbounds.
I think this would:
a) make it easier for frontend to extract meaningful data for the DP view
b) make APIs way less verbose for users.
Obviously this would ONLY work with MeshService.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw this gets rid of your weird "interpretFlag"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also getting side tracked here. But I feel like maybe our APIs are just not working out here and we should rethink them.
I agree with this sentiment. It feels like we need something that begins with the inbounds/outbounds (the "connections") and once I have those I can discover the rules for those (the GUI begins with the inbounds/outbounds also). Whereas the _rules
endpoint feels more like the reverse, I begin with the rules and discover the inbounds/outbounds for those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we have this we can have:
GET /meshes/<mesh>/dataplanes/<dataplane>/_rules/_outbound/<identifier>
If we use ResourceIdentifier as <identifier>
then we probably don't need /_outbound
part. Kinds MeshService
, MeshMultiZoneService
and MeshExternalService
are always outbounds. Kind Dataplane
is always inbound.
We'd have to come up with <identifier>
format for public API. Internally we're using meshservice:mesh/mesh-1:namespace/ns-k8s:name/backend:section/http-port
and it's not ideal for the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have a universal resource identifier no?
a set of rules for each inbound of the proxy. When policy descriptor | ||
has 'interpretFromEntriesAsRules' set to true, this field replaces | ||
'fromRules'. | ||
items: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where will the actual sub rules be?
Reviewer Checklist🔍 Each of these sections need to be checked by the reviewer of the PR 🔍:
|
Motivation
#12560 added a new field
InboundRules
toFromRules
structure:this structure needs to be visible in the Inspect API
/_rules
endpoint.Implementation information
It's a draft PR, at this moment only OpenAPI is changed.
Supporting documentation
Fix #12381