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

podman rmi: refactor logic #5863

Merged
merged 1 commit into from
Apr 21, 2020

Conversation

vrothberg
Copy link
Member

@vrothberg vrothberg commented Apr 17, 2020

While this commit was initially meant to fix #5847, it has turned into a
bigger refactoring which I did not manage to break into smaller pieces:

  • Fix podmanV2 rmi issues #5847 by refactoring the image-removal logic.

  • Make the api handler for image-removal use the ABI code. This way,
    both (i.e., ABI and Tunnel) end up using the same code. Achieving
    this code share required to move some code around to prevent circular
    dependencies.

  • Everything in pkg/api (excluding pkg/api/types) must now only be
    accessed from code using ABISupport.

  • Avoid imports from entities on handlers to prevent circular
    dependencies.

  • Move podman system service logic into cmd to prevent circular
    dependencies - it depends on pkg/api.

Fixes: #5847
Signed-off-by: Valentin Rothberg [email protected]

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 17, 2020
@vrothberg
Copy link
Member Author

I did not test the remote client yet but feel free to review.

@TomSweeneyRedHat
Copy link
Member

@vrothberg gating isn't hip

@vrothberg
Copy link
Member Author

Quick meeting record: we agreed to generalize the consolidation/code-share issue in the PR and make pkg/api/hanlders use the infra/abi code.

@jwhonce
Copy link
Member

jwhonce commented Apr 17, 2020

These are examples of where the CLI instantiates the runtime engines.

PodmanConfig might be too generous of input, we may need to narrow the data being passed in.
https://github.com/containers/libpod/blob/master/cmd/podman/registry/registry.go#L50

@vrothberg vrothberg force-pushed the v2-fix-rmi branch 2 times, most recently from 33118de to e0db52e Compare April 20, 2020 14:37
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #5872) made this pull request unmergeable. Please resolve the merge conflicts.

cmd/podman/system/service.go Outdated Show resolved Hide resolved
func (ic *ContainerEngine) VarlinkService(_ context.Context, opts entities.ServiceOptions) error {
var varlinkInterfaces = []*iopodman.VarlinkInterface{
iopodmanAPI.New(opts.Command, ic.Libpod),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (ic *ContainerEngine) VarlinkService(_ context.Context, opts entities.ServiceOptions) error {
var varlinkInterfaces = []*iopodman.VarlinkInterface{
iopodmanAPI.New(opts.Command, ic.Libpod),
func (ic *ContainerEngine) VarlinkService(_ context.Context, opts entities.ServiceOptions) error {
var varlinkInterfaces = []*iopodman.VarlinkInterface{
iopodmanAPI.New(opts.Command, ic.Libpod),

Should this move into cmd/podman as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this would be another nice candidate. For now, this PR focuses on podman rmi.

@vrothberg vrothberg force-pushed the v2-fix-rmi branch 3 times, most recently from b4a2e3c to ba8be97 Compare April 20, 2020 17:44
@vrothberg
Copy link
Member Author

swagger failures are fixed now. @jwhonce @baude, the issue I faced is that swagger went south because pkg/api now imports infra/abi. infra/abi had the build header set to ABISupport which in turn confused swagger because it couldn't parse it anymore. I just removed the headers as the imports are guarded in infra. There's now way to point swagger to some build tags and go doesn't support setting them via environment variables either.

Should be good now 👍

@baude
Copy link
Member

baude commented Apr 20, 2020

ok LGTM

@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #5899) made this pull request unmergeable. Please resolve the merge conflicts.

While this commit was initially meant to fix containers#5847, it has turned into a
bigger refactoring which I did not manage to break into smaller pieces:

 * Fix containers#5847 by refactoring the image-removal logic.

 * Make the api handler for image-removal use the ABI code. This way,
   both (i.e., ABI and Tunnel) end up using the same code.  Achieving
   this code share required to move some code around to prevent circular
   dependencies.

 * Everything in pkg/api (excluding pkg/api/types) must now only be
   accessed from code using `ABISupport`.

 * Avoid imports from entities on handlers to prevent circular
   dependencies.

 * Move `podman system service` logic into `cmd` to prevent circular
   dependencies - it depends on pkg/api.

 * Also remove the build header from infra/abi files.  It will otherwise
   confuse swagger and other tools; errors we cannot fix as go doesn't
   expose a build-tag env variable.

Fixes: containers#5847
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member Author

@rhatdan @giuseppe PTAL

@vrothberg vrothberg mentioned this pull request Apr 21, 2020
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2020
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 90636fe into containers:master Apr 21, 2020
@vrothberg vrothberg deleted the v2-fix-rmi branch April 21, 2020 09:14
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podmanV2 rmi issues
8 participants