Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage0: add --expose flag on app level #3691

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

trusch
Copy link
Contributor

@trusch trusch commented May 31, 2017

This allows us to specify exposed ports at runtime in favor of patching the image manifests.
A typical call will look like this:

rkt run \
  --port shell:11111 \
  trusch.io/alpine \
    --expose shell,port=12345,protocol=tcp \
    --exec nc -- -lk -p 12345 -e /bin/sh

This fixes issue #2113 and is conflicting with PR #3407

This allows us to specify exposed ports at runtime in favor of patching the image manifests.
A typical call will look like this:

rkt run \
  --port shell:11111 \
  trusch.io/alpine \
    --expose shell,port=12345,protocol=tcp \
    --exec nc -- -lk -p 12345 -e /bin/sh

This fixes issue rkt#2113 and is conflicting with PR rkt#3407
@ghost
Copy link

ghost commented May 31, 2017

Can one of the admins verify this patch?

@trusch
Copy link
Contributor Author

trusch commented Jun 1, 2017

@squeed what do you think about this approach compared to the approach in the last comments of your PR?

@trusch
Copy link
Contributor Author

trusch commented Jun 12, 2017

@ALL is there no interest in this flag? I can close this, but a solution to expose ports at runtime would be great.

@lucab lucab self-requested a review June 12, 2017 16:06
@lucab
Copy link
Member

lucab commented Jun 12, 2017

@trusch please leave this open. I was offline a bunch of days and I'm catching up with backlog, but I'll try to get to reviewing this soon.

@trusch
Copy link
Contributor Author

trusch commented Jun 15, 2017

@lucab I hope your backlog is shrinking ;) I can rebase this if it makes your life easier.

@@ -895,3 +896,35 @@ func (au *appStderr) String() string {
func (au *appStderr) Type() string {
return "appStderr"
}

// appExpose is for --expose flags in the form of: --expose=query,protocol=tcp,port=8080,count=1,socketActivated=true
Copy link
Member

Choose a reason for hiding this comment

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

I guess query here would be clearer as portname.

@@ -103,6 +103,7 @@ func addAppFlags(cmd *cobra.Command) {
cmd.Flags().Var((*appWorkingDir)(&rktApps), "working-dir", "override the working directory of the preceding image")
cmd.Flags().Var((*appReadOnlyRootFS)(&rktApps), "readonly-rootfs", "if set, the app's rootfs will be mounted read-only")
cmd.Flags().Var((*appMount)(&rktApps), "mount", "mount point binding a volume to a path within an app")
cmd.Flags().Var((*appExpose)(&rktApps), "expose", "expose ports of the application (example: '--expose=http,protocol=tcp,port=8080')")
Copy link
Member

Choose a reason for hiding this comment

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

This new flag should be documented in run.md, and possibly also also to prepare / run-prepared (I didn't check, I think this also adds it to the command so maybe only the doc part is missing).

@@ -188,6 +188,24 @@ func MergeMounts(mounts []schema.Mount, appMounts []schema.Mount) []schema.Mount
return deduplicateMPs(ml)
}

// MergePorts merges two port lists
func MergePorts(a, b []types.Port) []types.Port {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how relevant this maybe in this context, but this is not a stable merge (i.e. it doesn't guarantee too keep the relative order). It may poses some issues when trying to answer questions like what is the precedence order between manifest ports and exposed ports.

@lucab
Copy link
Member

lucab commented Jun 15, 2017

Uops, I'm really sorry for the delay. I did a pass on this and left some inline comments. However I've higher level concerns with it, which I am detailing below.

First, I like the split between expose / port as it follows the same logic of volume / mount; however I see this more as part of a larger re-design of the port syntax (getting rid of : as separator, adding support for binding to specific IPs, adding support for IPv6) and I don't think we should be doing it while fixing the original issue.

Then, I think this is a better proposal over the current --raw-port PR but there are still a few odd ends (I would perhaps encapsulate internally the count detail).

In general, I'm still holding the line of reasoning of #3407 (comment). I would address the specific #2113 problem by documenting the current $port-$proto magic synatx and adding a default for un-exposed ports. Once that concern is gone, we can more throughfully discuss something like #3407 (comment) and come up with a proposed design (possibly based on expose / port) and implement it, taking care of all the re-design points above at once.

@trusch
Copy link
Contributor Author

trusch commented Jun 29, 2017

@lucab regarding ipv6: look what's landed in cni: containernetworking/plugins#10

So bridge is ready and the PR for ptp is also there :)

Sent from my HTC One_M8 using FastHub

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants