Skip to content

Add --services flag to start API without using --listen flag#429

Merged
openshift-merge-bot[bot] merged 2 commits intocontainers:mainfrom
lstocchi:i425
Jan 30, 2025
Merged

Add --services flag to start API without using --listen flag#429
openshift-merge-bot[bot] merged 2 commits intocontainers:mainfrom
lstocchi:i425

Conversation

@lstocchi
Copy link
Copy Markdown
Collaborator

In the current implementation when gvproxy is started with the --listen option, it exposes a HTTP API with several endpoints like /connect, /stats, /services ...
The /connect endpoint, however, is only used when the gvforwarder tool is running on the guest, and, when using different connectivities like --listen-vfkit or --listen-qemu, it is not really necessary.

This commit adds a new flag --services that allows to start the HTTP API without the /connect endpoint.

I was not sure how to implement it as I saw 3 possible use cases:

  1. add it as a boolean flag (e.g. --enable-services) and when true creating an endpoint using a defaultURL having a defined http API (the same as --listen, except for the /connect endpoint)
  2. using an array flag (e.g. --api-endpoints) so that the user could specify the endpoint he/she wanted to enable, like --api-endpoints stats, services,connect
  3. the current implementation. A string flag (--services) which works how the other options. The user specify the endpoint and the http api gets started (the same as --listen, except for the /connect endpoint)

I went with the third to stick with the same behavior but open to discuss.

I'll add some test in a follow-up PR as I'd like to leverage the code from #427

cfergeau added a commit to cfergeau/podman that referenced this pull request Dec 13, 2024
This makes use of the new gvproxy parameter added in
containers/gvisor-tap-vsock#429
cfergeau added a commit to cfergeau/crc that referenced this pull request Dec 18, 2024
At this point, a gvproxy binary built from containers/gvisor-tap-vsock#429
is required. Let's check for it as this requirement is easy to miss.
cfergeau added a commit to cfergeau/crc that referenced this pull request Dec 19, 2024
At this point, a gvproxy binary built from containers/gvisor-tap-vsock#429
is required. Let's check for it as this requirement is easy to miss.
@lstocchi lstocchi linked an issue Jan 13, 2025 that may be closed by this pull request
In the current implementation when gvproxy is started with the --listen option, it exposes a HTTP API with several endpoints like /connect, /stats, /services ...
The /connect endpoint, however, is only used when the gvforwarder tool is running on the guest, and, when using different connectivities like --listen-vfkit or --listen-qemu, it is not really necessary.

This commit adds a new flag --services that allows to start the HTTP API without the /connect endpoint. It could be used when using different network connectivity and still wanting a lighter HTTP API. It accepts the endpoint where it will be reachable E.g. gvproxy --listen-vfkit .... --services unix:///tmp/svc_gvproxy.sock

Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
@cfergeau
Copy link
Copy Markdown
Collaborator

/lgtm

@cfergeau
Copy link
Copy Markdown
Collaborator

/approve

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 30, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfergeau, evidolob, lstocchi

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [cfergeau,evidolob,lstocchi]

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

@openshift-merge-bot openshift-merge-bot bot merged commit 45ea6bb into containers:main Jan 30, 2025
cfergeau added a commit to cfergeau/podman that referenced this pull request Jan 31, 2025
This makes use of the new gvproxy parameter added in
containers/gvisor-tap-vsock#429
@lstocchi lstocchi deleted the i425 branch March 10, 2025 14:11
lstocchi pushed a commit to lstocchi/podman that referenced this pull request May 9, 2025
This makes use of the new gvproxy parameter added in
containers/gvisor-tap-vsock#429
cfergeau added a commit to cfergeau/podman that referenced this pull request May 15, 2025
This makes use of the new gvproxy parameter added in
containers/gvisor-tap-vsock#429
cfergeau added a commit to cfergeau/podman that referenced this pull request May 15, 2025
This makes use of the new gvproxy parameter added in
containers/gvisor-tap-vsock#429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gvproxy: Split --listen features in 2 separate args

3 participants