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

Context handling improvement #76

Merged
merged 3 commits into from
Sep 15, 2018

Conversation

lburgazzoli
Copy link
Contributor

Fixes #75
Fixes #74

@lburgazzoli lburgazzoli force-pushed the context-discovery branch 3 times, most recently from 2c1fd71 to 2150bce Compare September 15, 2018 13:14
Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

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

Sounds really good. It was a bit difficult to follow, due to the many return points in the "Handle" method, but the logic is correct.

Computation of the most similar context is useful only in case we start to chain builds, but now we create them from scratch. Using a context that has more dependencies than needed is error prone (think to maven version resolution: adding a new dependency changes the resolution mechanism and versions of unrelated libraries may change).
I'd stick with exact match for now. Wdyt?

func NewCmdInstall(rootCmdOptions *RootCmdOptions) *cobra.Command {
options := InstallCmdOptions{
options := installCmdOptions{
Copy link
Member

Choose a reason for hiding this comment

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

Ok, I'll setup golint and add it to the developer guide :)

if err != nil {
return err
}

err = install.PlatformContexts(namespace)
Copy link
Member

Choose a reason for hiding this comment

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

It's ok for now. Later with #73 it will be the operator to install those resources. Installation should be limited to the minimum set of dependencies (operator, crd and rbac).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1

// The integration has no dependencies, try to find the one that
// has minimum dependencies requirement.

ndeps := math.MaxUint16
Copy link
Member

Choose a reason for hiding this comment

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

The final rule should be:

  • Take "X" if has the same set of dependencies
  • If no context has the same set, then create a context from the most similar one (advanced) or just create a new one
  • Don't use context "Y" if there is even just 1 library in "Y" that is not required by the integration (a.k.a. don't put unrelated garbage in the JVM)

Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good and simpler

}

if c == nil {
// TODO: generate a new platform context
Copy link
Member

Choose a reason for hiding this comment

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

Don't you do it in the caller function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, leftover

buildIdentifier := api.BuildIdentifier{
Name: integration.Name,
Qualifier: integration.Status.Digest,
platformCtxName := fmt.Sprintf("ctx-%s-%s", integration.Name, integration.ResourceVersion)
Copy link
Member

Choose a reason for hiding this comment

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

I think platform contexts don't need to be named after integrations. They can be shared among integrations and "must" be immutable, i.e. when a integration change dependencies, a new context should be created, leaving the old one to a "garbage collector". Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this was for "tracking purpose" while building, we'll define an independent name.

@lburgazzoli
Copy link
Contributor Author

Yeah, I did try to implement something smart but was unsure as it leave some unknowns.

I've fixed your findings, please have a look

Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

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

Perfect!

@nicolaferraro nicolaferraro merged commit 864ffae into apache:master Sep 15, 2018
@lburgazzoli lburgazzoli deleted the context-discovery branch September 15, 2018 15:29
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.

None yet

3 participants