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

feat(*): build rule-based view #5000

Merged
merged 21 commits into from
Sep 20, 2022

Conversation

lobkovilya
Copy link
Contributor

@lobkovilya lobkovilya commented Sep 13, 2022

Method MatchedPolicies is called for each plugin policy for each DPP. It returns the following result:

type TypedMatchingPolicies struct {
	Type              core_model.ResourceType
	DataplanePolicies []core_model.Resource
	FromRules         FromRules
	ToRules           ToRules
}

DataplanePolicies are set in the previous PR #4977. Current PR sets FromRules and ToRules. The algorithm is explained here.

Signed-off-by: Ilya Lobkov ilya.lobkov@konghq.com

Checklist prior to review

Changelog: feat(inspect): implement rule-based view for new policies

Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
@lobkovilya lobkovilya marked this pull request as ready for review September 13, 2022 15:44
@lobkovilya lobkovilya requested a review from a team as a code owner September 13, 2022 15:44
tools/policy-gen/bootstrap/root.go Outdated Show resolved Hide resolved
pkg/plugins/policies/matchers/match.go Outdated Show resolved Hide resolved
pkg/plugins/policies/matchers/match.go Outdated Show resolved Hide resolved
pkg/core/xds/rules.go Show resolved Hide resolved
tools/policy-gen/bootstrap/root.go Outdated Show resolved Hide resolved
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Copy link
Contributor

@slonka slonka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need a second round of review here but so far I did not find anything major that needed to be changed.

pkg/core/xds/rules_test.go Show resolved Hide resolved
pkg/core/xds/testdata/rules/01.golden.yaml Show resolved Hide resolved
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Copy link
Contributor

@slonka slonka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is quite complex but the problem is also not trivial. One question about panic and one nitpick but otherwise I don't see anything obviously wrong here. If we can't handle that panic gracefully then I'll 👍

pkg/core/xds/rules.go Show resolved Hide resolved
pkg/plugins/policies/matchers/match.go Show resolved Hide resolved
pkg/core/xds/matched_policies.go Outdated Show resolved Hide resolved
pkg/core/xds/matched_policies.go Outdated Show resolved Hide resolved
pkg/core/xds/rules.go Outdated Show resolved Hide resolved
pkg/core/xds/rules.go Outdated Show resolved Hide resolved
pkg/core/xds/rules.go Outdated Show resolved Hide resolved
pkg/core/xds/rules_test.go Show resolved Hide resolved
pkg/core/xds/rules_test.go Outdated Show resolved Hide resolved
pkg/plugins/policies/matchers/match.go Outdated Show resolved Hide resolved
pkg/core/xds/rules.go Show resolved Hide resolved
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
lahabana and others added 6 commits September 20, 2022 11:24
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the helper not generated for meshaccesslog?

Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
@lobkovilya lobkovilya enabled auto-merge (squash) September 20, 2022 11:30
@lobkovilya lobkovilya merged commit 953ca80 into kumahq:master Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants