forked from Mirantis/cri-dockerd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for fd:// for socket activation
- Loading branch information
1 parent
bd23391
commit 84b1ad7
Showing
6 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// +build !dockerless !windows | ||
|
||
package remote | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/coreos/go-systemd/v22/activation" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func listenFD(addr string) (net.Listener, error) { | ||
var ( | ||
err error | ||
listeners []net.Listener | ||
) | ||
// socket activation | ||
listeners, err = activation.Listeners() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if len(listeners) == 0 { | ||
return nil, errors.New("no sockets found via socket activation: make sure the service was started by systemd") | ||
} | ||
|
||
// default to first fd | ||
if addr == "" { | ||
return listeners[0], nil | ||
} | ||
|
||
//TODO: systemd fd selection (default is 3) | ||
return nil, errors.New("not supported yet") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// +build !dockerless windows | ||
|
||
package server | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
func listenFD(addr string) (net.Listener, error) { | ||
return nil, errors.New("listening server on fd not supported on windows") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters