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

Handle wiring images #708

Merged
merged 7 commits into from
Oct 10, 2019

Conversation

jeremyrickard
Copy link
Contributor

What does this change

This change introduces additional run time wiring logic for the mustache like bundle.images functionality. When a bundle is executed, the bundle.json and an optional relocation-mapping.json file can be mounted into the invocation image. These can override the values present in the porter.yaml (which is inserted into the invocation image at build). The values provided by the bundle.json and relocation-mapping.json should override what is in the porter.yaml manifest.

What issue does it fix

Closes #692

Notes for the reviewer

👋 🌵

Checklist

  • Unit Tests
    • Documentation Not Impacted

Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

Nice! Couple of Q's:

pkg/manifest/relocation.go Outdated Show resolved Hide resolved
pkg/manifest/runtime-manifest.go Outdated Show resolved Hide resolved
@jeremyrickard
Copy link
Contributor Author

@vdice nixed the Original Image and TODO comments

@jeremyrickard
Copy link
Contributor Author

I have an impending update of the relocation mapping. The format I had seen before isn't what is there for reals, so fixing that up at the moment.

@jeremyrickard
Copy link
Contributor Author

jeremyrickard commented Oct 9, 2019

OK, this is updated now.

The image relocation map looks like:

{
  "gabrtv/microservice@sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687": "my.registry/microservice@sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687",
  "technosophos/helloworld:0.1.0": "my.registry/helloworld:0.1.0"
}

Which means, we need to reverse from the bundle.json's image -> the name in the map in order to connect it back to the porter manifest. PR was updated to handle this and error if mappings are provided that don't exist. I suppose we could be more lenient in those cases, but I went with more strict to start out with.

Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -102,6 +105,31 @@ func (p *Porter) Run(opts RunOptions) error {
return err
}

//Update the runtimeManifest images with the bundle.json and relocation mapping (if it's there)
Copy link
Member

Choose a reason for hiding this comment

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

nit: In a follow up, it would be nice to wrap this all up in a function in this same file so that Run continues to be pretty readable at a high level. Maybe handleRelocationImages or something.

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, i'll do a follow up. I think i want to do a refactor of a bunch of the logic here

Copy link
Member

Choose a reason for hiding this comment

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

Yeah based on the touched file list you showed me, a refactor doesn't seem like a bad idea if you have ideas on how to improve the abstraction.

@jeremyrickard jeremyrickard merged commit 5d8cd2d into getporter:master Oct 10, 2019
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.

Handle updated image(s) with image wiring
3 participants