From 2a66f40fc92ef3d66e3124d09c6e909327b58593 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 16 Jun 2023 21:24:31 +0200 Subject: [PATCH 01/18] first draft of pack direct podman call rfc Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 86 ++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 text/0000-pack-direct-podman-call.md diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md new file mode 100644 index 000000000..a56e715f1 --- /dev/null +++ b/text/0000-pack-direct-podman-call.md @@ -0,0 +1,86 @@ +# Meta +[meta]: #meta +- Name: Pack direct podman call +- Start Date: 2023-06-16 +- Author(s): dvaumoron +- Status: Draft +- RFC Pull Request: (leave blank) +- CNB Pull Request: (leave blank) +- CNB Issue: (leave blank) +- Supersedes: "N/A" + +# Summary +[summary]: #summary + +A flag `--container-engine` will be added to the `pack` CLI, the allowed flag value will be `docker` (the current functioning) and `podman` to call podman directly (without socket call) + +# Definitions +[definitions]: #definitions + +N/A + +# Motivation +[motivation]: #motivation + +This will allow to use pack as a standalone on the OS supported by podman (currently Linux, as Windows and macOS need podman machine) + +# What it is +[what-it-is]: #what-it-is + +Adding `--container-engine podman` to the `pack` command which currently need docker call would allow them to work without docker installed. + +# How it Works +[how-it-works]: #how-it-works + +The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter to call podman as a library. + +# Migration +[migration]: #migration + +N/A + +# Drawbacks +[drawbacks]: #drawbacks + +pack contributor could need to update the podman dependencies in go.mod for bugfixes + +# Alternatives +[alternatives]: #alternatives + +pack user could have dificulties to set up docker or podman to work with the pack CLI + +# Prior Art +[prior-art]: #prior-art + +N/A + +# Unresolved Questions +[unresolved-questions]: #unresolved-questions + +N/A + +# Spec. Changes (OPTIONAL) +[spec-changes]: #spec-changes + +N/A + +# History +[history]: #history + + \ No newline at end of file From 00c4cb6ea0c22cf01f8932cfc2f4084206566a6e Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Wed, 28 Jun 2023 16:32:14 +0200 Subject: [PATCH 02/18] pack direct podman call rfc, motivation part Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index a56e715f1..05f21b917 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -22,7 +22,7 @@ N/A # Motivation [motivation]: #motivation -This will allow to use pack as a standalone on the OS supported by podman (currently Linux, as Windows and macOS need podman machine) +This will allow to use pack as a standalone on the OS supported by podman (currently Linux, as Windows and macOS need podman machine), making possible to use pack without installing docker or podman (a tool like skopeo will still be necessary to send image in registries) # What it is [what-it-is]: #what-it-is From c7ecea3b9928bf5940f3788e12241e590028018e Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Wed, 28 Jun 2023 16:38:54 +0200 Subject: [PATCH 03/18] pack direct podman call rfc, how it works part Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 05f21b917..8fc3a020e 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -32,7 +32,7 @@ Adding `--container-engine podman` to the `pack` command which currently need do # How it Works [how-it-works]: #how-it-works -The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter to call podman as a library. +The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter conforming to the used subset [DockerClient](https://github.com/buildpacks/pack/blob/v0.29.0/pkg/client/docker.go#L14) to call podman as a library (forwarding calls to an initialized instance of [Runtime](https://github.com/containers/podman/blob/v4.5.1/libpod/runtime.go#L63)). # Migration [migration]: #migration From fa4142ee251dc44be01a2f69579dc4aadc199bf2 Mon Sep 17 00:00:00 2001 From: Denis VAUMORON Date: Fri, 30 Jun 2023 09:40:53 +0200 Subject: [PATCH 04/18] Update text/0000-pack-direct-podman-call.md Accept Aidan Delaney suggestion Co-authored-by: Aidan Delaney Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 8fc3a020e..eec7add1c 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -37,7 +37,7 @@ The flag will change the initialization of the CommonAPIClient passed to call do # Migration [migration]: #migration -N/A +The current mode of `pack` operation is the default mode of operation. The proposed `--daemonless` mode of operation is an optional mode of execution. We will need to document how to switch between operation modes and the motivations for choosing an appropriate mode of operation. # Drawbacks [drawbacks]: #drawbacks From 5d573ef7e7091efe6e770e23397d484e5bf0634c Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 30 Jun 2023 09:50:51 +0200 Subject: [PATCH 05/18] pack direct podman call rfc, flag name change Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index eec7add1c..111197a8e 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -12,7 +12,7 @@ # Summary [summary]: #summary -A flag `--container-engine` will be added to the `pack` CLI, the allowed flag value will be `docker` (the current functioning) and `podman` to call podman directly (without socket call) +A flag `--daemonless` will be added to the `pack` CLI, the flag presence will switch from the current functioning to one where podman is called directly (without needing a daemon backed socket) # Definitions [definitions]: #definitions @@ -27,7 +27,7 @@ This will allow to use pack as a standalone on the OS supported by podman (curre # What it is [what-it-is]: #what-it-is -Adding `--container-engine podman` to the `pack` command which currently need docker call would allow them to work without docker installed. +Adding `--daemonless` to the `pack` command which currently need docker call would allow them to work without docker installed. # How it Works [how-it-works]: #how-it-works From f2b0d73acf28ab4db5604d19db6e898462e69ba2 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 30 Jun 2023 12:50:00 +0200 Subject: [PATCH 06/18] pack direct podman call rfc, how it works part Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 111197a8e..a73f37c0a 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -32,7 +32,7 @@ Adding `--daemonless` to the `pack` command which currently need docker call wou # How it Works [how-it-works]: #how-it-works -The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter conforming to the used subset [DockerClient](https://github.com/buildpacks/pack/blob/v0.29.0/pkg/client/docker.go#L14) to call podman as a library (forwarding calls to an initialized instance of [Runtime](https://github.com/containers/podman/blob/v4.5.1/libpod/runtime.go#L63)). +The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter conforming to the used subset [DockerClient](https://github.com/buildpacks/pack/blob/main/pkg/client/docker.go#L14) to call podman as a library (forwarding calls to an initialized instance of [ContainerEngine](https://github.com/containers/podman/blob/main/pkg/domain/entities/engine_container.go#L16)). # Migration [migration]: #migration From e0236410f9fc3ee7437d19f3e9b561a7c16c3df8 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 30 Jun 2023 13:38:09 +0200 Subject: [PATCH 07/18] pack direct podman call rfc, how it works part Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index a73f37c0a..dbae3877c 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -34,6 +34,26 @@ Adding `--daemonless` to the `pack` command which currently need docker call wou The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter conforming to the used subset [DockerClient](https://github.com/buildpacks/pack/blob/main/pkg/client/docker.go#L14) to call podman as a library (forwarding calls to an initialized instance of [ContainerEngine](https://github.com/containers/podman/blob/main/pkg/domain/entities/engine_container.go#L16)). +The adapter will look like : +`type podmanAdapter struct { + inner entities.ContainerEngine +} + +func MakePodmanAdapter() DockerClient { + // initialization of engine + return podmanAdapter{inner: engine} +} + +func (a podmanAdapter) ContainerCreate(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, platform *specs.Platform, containerName string) (containertypes.CreateResponse, error) { + // initialization of specGenerator from the different configs + report, err := a.inner.ContainerCreate(ctx, specGenerator) + if err != nil { + return containertypes.CreateResponse{}, err + } + // initialization of adaptedReport from the report + return adaptedReport, nil +}` + # Migration [migration]: #migration From ef69023640f69b118daac87e3aa3fd1f1b2784e1 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 30 Jun 2023 13:49:01 +0200 Subject: [PATCH 08/18] pack direct podman call rfc, how it works part Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index dbae3877c..3740decf9 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -35,7 +35,8 @@ Adding `--daemonless` to the `pack` command which currently need docker call wou The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter conforming to the used subset [DockerClient](https://github.com/buildpacks/pack/blob/main/pkg/client/docker.go#L14) to call podman as a library (forwarding calls to an initialized instance of [ContainerEngine](https://github.com/containers/podman/blob/main/pkg/domain/entities/engine_container.go#L16)). The adapter will look like : -`type podmanAdapter struct { +``` +type podmanAdapter struct { inner entities.ContainerEngine } @@ -52,7 +53,8 @@ func (a podmanAdapter) ContainerCreate(ctx context.Context, config *containertyp } // initialization of adaptedReport from the report return adaptedReport, nil -}` +} +``` # Migration [migration]: #migration From 955cf392b71c65d49136c089b5b6651bc5e967a0 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 30 Jun 2023 13:55:01 +0200 Subject: [PATCH 09/18] pack direct podman call rfc, how it works part Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 3740decf9..48b5aaaa7 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -35,7 +35,7 @@ Adding `--daemonless` to the `pack` command which currently need docker call wou The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter conforming to the used subset [DockerClient](https://github.com/buildpacks/pack/blob/main/pkg/client/docker.go#L14) to call podman as a library (forwarding calls to an initialized instance of [ContainerEngine](https://github.com/containers/podman/blob/main/pkg/domain/entities/engine_container.go#L16)). The adapter will look like : -``` +```Go type podmanAdapter struct { inner entities.ContainerEngine } From fcd87874754cf9d1c7724d51a6855ed54bfc7ebd Mon Sep 17 00:00:00 2001 From: Denis VAUMORON Date: Fri, 30 Jun 2023 15:02:25 +0200 Subject: [PATCH 10/18] Update text/0000-pack-direct-podman-call.md accept Aidan Delaney suggestion before adjustement Co-authored-by: Aidan Delaney Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 48b5aaaa7..c8971691b 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -17,7 +17,7 @@ A flag `--daemonless` will be added to the `pack` CLI, the flag presence will sw # Definitions [definitions]: #definitions -N/A +Orchestration Client API: an API such as Docker's `DockerClient` or Podman's `Runtime` that # Motivation [motivation]: #motivation From b3214ee55ed7713a7b9a94ff5f787015fb2aa2a0 Mon Sep 17 00:00:00 2001 From: Denis VAUMORON Date: Fri, 30 Jun 2023 15:03:04 +0200 Subject: [PATCH 11/18] Update text/0000-pack-direct-podman-call.md accept Aidan Delaney suggestion before adjustement Co-authored-by: Aidan Delaney Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index c8971691b..0ce8bb2f3 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -22,7 +22,7 @@ Orchestration Client API: an API such as Docker's `DockerClient` or Podman's `Ru # Motivation [motivation]: #motivation -This will allow to use pack as a standalone on the OS supported by podman (currently Linux, as Windows and macOS need podman machine), making possible to use pack without installing docker or podman (a tool like skopeo will still be necessary to send image in registries) +`pack` currently requires an orchestration client API available via a socket. Both `docker` and `podman` are compatible with the [socket API](https://docs.docker.com/engine/api/v1.24/). This RFC proposes that `pack` is extended to support a "daemonless" mode. In a "daemonless" mode `pack` will directly use an orchestration client API. This avoids running a `docker` or `podman` daemon and avoids opening up a local socket. This will allow to use pack as a full-userspace, standalone application on the OS supported by podman (currently Linux, as Windows and macOS need podman machine). # What it is [what-it-is]: #what-it-is From d3956843c0c50b35011183acf0e64d1152776ae5 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 30 Jun 2023 15:11:39 +0200 Subject: [PATCH 12/18] pack direct podman call rfc, definitions part Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 0ce8bb2f3..5813543b1 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -17,12 +17,12 @@ A flag `--daemonless` will be added to the `pack` CLI, the flag presence will sw # Definitions [definitions]: #definitions -Orchestration Client API: an API such as Docker's `DockerClient` or Podman's `Runtime` that +Container Manager Client API: an API such as Docker's `CommonAPIClient` or Podman's `ContainerEngine` allowing interaction with container and OCI image # Motivation [motivation]: #motivation -`pack` currently requires an orchestration client API available via a socket. Both `docker` and `podman` are compatible with the [socket API](https://docs.docker.com/engine/api/v1.24/). This RFC proposes that `pack` is extended to support a "daemonless" mode. In a "daemonless" mode `pack` will directly use an orchestration client API. This avoids running a `docker` or `podman` daemon and avoids opening up a local socket. This will allow to use pack as a full-userspace, standalone application on the OS supported by podman (currently Linux, as Windows and macOS need podman machine). +`pack` currently requires an container manager client API available via a socket. Both `docker` and `podman` are compatible with the [socket API](https://docs.docker.com/engine/api/v1.24/). This RFC proposes that `pack` is extended to support a "daemonless" mode. In a "daemonless" mode `pack` will directly use a container manager client API. This avoids running a `docker` or `podman` daemon and avoids opening up a local socket. This will allow to use pack as a full-userspace, standalone application on the OS supported by podman (currently Linux, as Windows and macOS need podman machine). # What it is [what-it-is]: #what-it-is From add5b4470776eea12a16eb62e83e921d8a680e23 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 30 Jun 2023 18:10:31 +0200 Subject: [PATCH 13/18] pack direct podman call rfc, motivation part (fix) Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 5813543b1..3ebc38d72 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -22,7 +22,7 @@ Container Manager Client API: an API such as Docker's `CommonAPIClient` or Podma # Motivation [motivation]: #motivation -`pack` currently requires an container manager client API available via a socket. Both `docker` and `podman` are compatible with the [socket API](https://docs.docker.com/engine/api/v1.24/). This RFC proposes that `pack` is extended to support a "daemonless" mode. In a "daemonless" mode `pack` will directly use a container manager client API. This avoids running a `docker` or `podman` daemon and avoids opening up a local socket. This will allow to use pack as a full-userspace, standalone application on the OS supported by podman (currently Linux, as Windows and macOS need podman machine). +`pack` currently requires a container manager client API available via a socket. Both `docker` and `podman` are compatible with the [socket API](https://docs.docker.com/engine/api/v1.24/). This RFC proposes that `pack` is extended to support a "daemonless" mode. In a "daemonless" mode `pack` will directly use a container manager client API. This avoids running a `docker` or `podman` daemon and avoids opening up a local socket. This will allow to use pack as a full-userspace, standalone application on the OS supported by podman (currently Linux, as Windows and macOS need podman machine). # What it is [what-it-is]: #what-it-is From 6d15cf74ab2bd15cabe32739c3a737f8b9192456 Mon Sep 17 00:00:00 2001 From: dvaumoron Date: Fri, 27 Oct 2023 13:23:13 +0200 Subject: [PATCH 14/18] first draft of pack direct podman call rfc (spelling) Signed-off-by: dvaumoron --- text/0000-pack-direct-podman-call.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text/0000-pack-direct-podman-call.md b/text/0000-pack-direct-podman-call.md index 3ebc38d72..5c306749f 100644 --- a/text/0000-pack-direct-podman-call.md +++ b/text/0000-pack-direct-podman-call.md @@ -35,6 +35,7 @@ Adding `--daemonless` to the `pack` command which currently need docker call wou The flag will change the initialization of the CommonAPIClient passed to call docker (interface defined in "github.com/docker/docker/client") by an adapter conforming to the used subset [DockerClient](https://github.com/buildpacks/pack/blob/main/pkg/client/docker.go#L14) to call podman as a library (forwarding calls to an initialized instance of [ContainerEngine](https://github.com/containers/podman/blob/main/pkg/domain/entities/engine_container.go#L16)). The adapter will look like : + ```Go type podmanAdapter struct { inner entities.ContainerEngine @@ -69,7 +70,7 @@ pack contributor could need to update the podman dependencies in go.mod for bugf # Alternatives [alternatives]: #alternatives -pack user could have dificulties to set up docker or podman to work with the pack CLI +pack user could have difficulties to set up docker or podman to work with the pack CLI # Prior Art [prior-art]: #prior-art @@ -87,7 +88,6 @@ N/A N/A # History -[history]: #history