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

Kubernetes provider module for the Konveyor analyzer #163

Merged
merged 4 commits into from
Mar 20, 2024

Conversation

mansam
Copy link
Contributor

@mansam mansam commented Feb 7, 2024

Fixes #162

Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

I have some questions and some things to think about.

I think this is on the right track, though!

enhancements/analyzer-k8s-provider/README.md Outdated Show resolved Hide resolved
enhancements/analyzer-k8s-provider/README.md Show resolved Hide resolved
enhancements/analyzer-k8s-provider/README.md Show resolved Hide resolved
enhancements/analyzer-k8s-provider/README.md Show resolved Hide resolved
enhancements/analyzer-k8s-provider/README.md Show resolved Hide resolved
enhancements/analyzer-k8s-provider/README.md Show resolved Hide resolved

### Test Plan

Functionality of the provider itself can be tested with a single-node cluster (seeded with known resources)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any limitation on the current e2e system that would prevent us from creating a new test for this provider?

@djzager

enhancements/analyzer-k8s-provider/README.md Show resolved Hide resolved
enhancements/analyzer-k8s-provider/README.md Outdated Show resolved Hide resolved
enhancements/analyzer-k8s-provider/README.md Outdated Show resolved Hide resolved

### Implementation Details

The Kubernetes provider will use Rego as its rules language, and will use the Open Policy Agent SDK
Copy link
Contributor

Choose a reason for hiding this comment

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

Could possibly mention the use of analyzer-lsp providerConfig and capability to evaluate rules/resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to mention that it will conform to the analyzer-lsp's gRPC provider interface (which would require that).


The provider will initially surface two rule capabilities: One that is oriented towards ease-of-authorship in exchange for limited expressiveness (`rego.expr`), and one that permits freeform authoring of complex Rego modules (`rego.module`).
Ideally, the simpler rule format will strike a balance that enables most rules to be written in it. To facilitate the use of the simpler rule capability,
we will provide a built-in inventory of Rego rules that can be referred to by user-provided rules.
Copy link
Contributor

Choose a reason for hiding this comment

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

@shawn-hurley could this call for a "shim" for rego rules -> our rules? Maybe this isn't worth the trouble if there will only be a limited number of these.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought that @mansam had by hand moved over the ones that were written. I don't know if there are other larger rego projects that we would want to convert.

I wonder if we have examples of those projects, I think it would make sense, I don't know them and don't know if it needed. Do you have any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's a small set of rules then I agree, no need. I'm not aware of any others.

Signed-off-by: Sam Lucidi <[email protected]>
Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

For the most part, I think we are good to go, I would personally still like a complex example


The provider will initially surface two rule capabilities: One that is oriented towards ease-of-authorship in exchange for limited expressiveness (`rego.expr`), and one that permits freeform authoring of complex Rego modules (`rego.module`).
Ideally, the simpler rule format will strike a balance that enables most rules to be written in it. To facilitate the use of the simpler rule capability,
we will provide a built-in inventory of Rego rules that can be referred to by user-provided rules.
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought that @mansam had by hand moved over the ones that were written. I don't know if there are other larger rego projects that we would want to convert.

I wonder if we have examples of those projects, I think it would make sense, I don't know them and don't know if it needed. Do you have any thoughts?


### Test Plan

Functionality of the provider itself can be tested with a single-node cluster (seeded with known resources)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a world, where we could have a "fake k8s client" that would allow us to run against a set of resources in a directory?

I think that this could be a follow-on especially when we start integrating the rules into the new yaml rule test that @pranavgaikwad is making.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think we absolutely should look into doing that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@jortel jortel left a comment

Choose a reason for hiding this comment

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

Question:
Is there a use case for analyzing resources not deployed in a cluster. For example, manifests either user defined or generated in a git repository?
If so perhaps the provider could honor the Location instead of (or in addition) to the kubeconfig and namespaces.
This can be a follow up PR.

Copy link
Member

@djzager djzager left a comment

Choose a reason for hiding this comment

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

ACK

Signed-off-by: Sam Lucidi <[email protected]>
Copy link

@ibragins ibragins left a comment

Choose a reason for hiding this comment

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

LGTM

@mansam mansam merged commit 24ac98d into konveyor:master Mar 20, 2024
1 check passed
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.

[RFE] Identifying misbehaving applications in a running cluster
8 participants