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

Multi-language support for analysis #165

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

eemcmullan
Copy link
Contributor

No description provided.

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.

This is a really good start. Thank you for putting this together.

enhancements/multi-language support/README.md Show resolved Hide resolved
enhancements/multi-language support/README.md Outdated Show resolved Hide resolved
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.

An example of the pod that also runs the analyzer container would be helpful, right now, it looks like the pod is only running the provider

enhancements/multi-language support/README.md Outdated Show resolved Hide resolved
enhancements/multi-language support/README.md Outdated Show resolved Hide resolved
enhancements/multi-language support/README.md Outdated Show resolved Hide resolved
emptyDir: {}
```

If a user wishes to run a community provider, or override a supported provider, they must provide a yaml with the container definition. This can be passed in from a new flag such as `--unsupported-provider`. This configuration will then be added to the podman pod spec during kantra's runtime.
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 way we could just take image, and port and not an entire container spec?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we start with image and port, with the note that we could eventually need to add support for more stuff because you may need to mount something, or Env Var and maybe even a specific start command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can do this and continue to let kantra deal with the volume mounts.

Copy link
Contributor

Choose a reason for hiding this comment

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

If conforming provider images were obligated to accept an environment variable for a port to bind to (something like ENTRYPOINT provider --port ${PORT}), then Kantra could just decide a port and further reduce the amount of stuff that needed to be provided by the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point

### Default Rulesets for Supported Providers

As of now, we have a set of default rules for the Java provider: https://github.com/konveyor/rulesets/
We will want to add more default rulesets for each provider, such as `rulesets/golang` and `rulesets/java`. For delivery of these rulesets, they will be packaged in a known location in each providers' Dockerfile. In kantra, this/these path(s) will be set to `--rules`, unless this default behavior is disabled by the user.
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we shouldn't be seggregating rules by provider, but I think that's a different discussion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can make this section less definitive then, and add the thought to 'open questions'.

to Linux operating system.
```

These multi-use rulesets can be found in `rulesets/common` and can use labels such as `konveyor.io/provider=go` and `konveyor.io/provider=java` to filter the common rules for relevant providers. For each running provider, their individual rulesets can be evaluated, as well as searching in `rulesets/common` for any rules with these provider labels.
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, instead of seggregating by directories, we should just use labels to indicate which providers a certain rule applies to

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the point is, that they are rules, that are specifically developed to be common and should live in a place where java ruleset author can rely on. If that makes sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pranavgaikwad @shawn-hurley is this something we want to decide here? Or leave it generic for now, and resolve later?

emptyDir: {}
```

If a user wishes to run a community provider, or override a supported provider, they must provide a yaml with the container definition. This can be passed in from a new flag such as `--unsupported-provider`. This configuration will then be added to the podman pod spec during kantra's runtime.
Copy link
Contributor

Choose a reason for hiding this comment

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

If conforming provider images were obligated to accept an environment variable for a port to bind to (something like ENTRYPOINT provider --port ${PORT}), then Kantra could just decide a port and further reduce the amount of stuff that needed to be provided by the user.

enhancements/multi-language support/README.md Show resolved Hide resolved
enhancements/multi-language support/README.md Show resolved Hide resolved
### Default Rulesets for Supported Providers

As of now, we have a set of default rules for the Java provider: https://github.com/konveyor/rulesets/
We will want to add more default rulesets for each provider. For delivery of these rulesets, they will be packaged in a known location in each providers' Dockerfile. In kantra, this/these path(s) will be set to `--rules`, unless this default behavior is disabled by the user.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the concept of default rules be part of the provider contract? Provider writers could build the default rules into the image and have the provider load them without Kantra or any other caller needing to know where they are in the image. This would help reduce the distinction between supported and community providers since we wouldn't have to do any special-case setup of built-in rules for providers we know about, and built-in rules would automatically work for ones we don't. (We could still have a flag in the init config to turn off the default rules if we felt that was necessary.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if they should be part of the provider contract, as I think we may want the distinction between providers we support and community providers. It could be possible for someone to write their own provider with a set of custom rules that we wouldn't want as default rules.

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 think we are missing the mapping of the languages to providers as @mansam points out. I think it has to solve a couple of problems

  1. It needs to solve the default mapping ("Java" -> Java-provider, "yaml" -> yaml-provider, xml....).
  2. It needs to be overridable
  3. It needs to be ok, to turn off a provider for a language, (I have Yaml code but I don't want the yaml provider to be used)
  4. It needs to be able to ignore known unknown languages (JavaScript is an example right now).

I think it can be a whole new section

Signed-off-by: Emily McMullan <[email protected]>
}
```

If a provider mapping is not found, kantra will look for `--unsupported-provider`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that for now this will work, in the future we will want to:

  1. Enable this to be some config file for the user to set once and leave it, so they don't have to do this every time
  2. Once they do that, enable a "strict" option, that will fail the command if providers are not found.

I think that we can do this as a follow on, but I do worry about the UX of this without those quality of life enhancements.

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 think that we must come back to how to enable folks on the CLI in the future, but this is a huge step forward and I think it is ready to start implementing

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

@istein1
Copy link

istein1 commented Mar 14, 2024

LGTM

Signed-off-by: Emily McMullan <[email protected]>
@eemcmullan eemcmullan requested a review from mansam March 14, 2024 15:26
@eemcmullan eemcmullan merged commit 5a6b745 into konveyor:master Mar 14, 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.

8 participants