Merge pull request #77 from rhatdan/conmon

Conmon should not be installed in /usr/bin.
This commit is contained in:
Antonio Murdaca 2016-09-29 15:05:47 +02:00 committed by GitHub
commit c6a52a1b93
6 changed files with 22 additions and 9 deletions

View file

@ -81,12 +81,13 @@ docs: $(MANPAGES_MD:%.md=%)
install: binaries docs install: binaries docs
install -D -m 755 ocid ${INSTALLDIR}/ocid install -D -m 755 ocid ${INSTALLDIR}/ocid
install -D -m 755 ocic ${INSTALLDIR}/ocic install -D -m 755 ocic ${INSTALLDIR}/ocic
install -D -m 755 conmon/conmon ${INSTALLDIR}/conmon install -D -m 755 conmon/conmon $(PREFIX)/libexec/ocid/conmon
install -d $(PREFIX)/share/man/man8 install -d $(PREFIX)/share/man/man8
install -m 644 $(basename $(MANPAGES_MD)) $(PREFIX)/share/man/man8 install -m 644 $(basename $(MANPAGES_MD)) $(PREFIX)/share/man/man8
uninstall: uninstall:
rm -f ${INSTALLDIR}/{ocid,ocic,conmon} rm -f ${INSTALLDIR}/{ocid,ocic}
rm -f $(PREFIX)/libexec/ocid/conmon
for i in $(basename $(MANPAGES_MD)); do \ for i in $(basename $(MANPAGES_MD)); do \
rm -f $(PREFIX)/share/man/man8/$$(basename $${i}); \ rm -f $(PREFIX)/share/man/man8/$$(basename $${i}); \
done done

View file

@ -15,6 +15,7 @@ import (
const ( const (
ocidRoot = "/var/lib/ocid" ocidRoot = "/var/lib/ocid"
conmonPath = "/usr/libexec/ocid/conmon"
) )
func main() { func main() {
@ -24,6 +25,11 @@ func main() {
app.Version = "0.0.1" app.Version = "0.0.1"
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
cli.StringFlag{
Name: "conmon",
Value: conmonPath,
Usage: "path to the conmon executable",
},
cli.StringFlag{ cli.StringFlag{
Name: "root", Name: "root",
Value: ocidRoot, Value: ocidRoot,
@ -104,7 +110,7 @@ func main() {
containerDir := c.String("containerdir") containerDir := c.String("containerdir")
sandboxDir := c.String("sandboxdir") sandboxDir := c.String("sandboxdir")
service, err := server.New(c.String("runtime"), c.String("root"), sandboxDir, containerDir) service, err := server.New(c.String("runtime"), c.String("root"), sandboxDir, containerDir, conmonPath)
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }

View file

@ -7,6 +7,7 @@ ocid - Enable OCI Kubernetes Container Runtime daemon
# SYNOPSIS # SYNOPSIS
**ocid** **ocid**
[**--root**=[*value*]] [**--root**=[*value*]]
[**--conmon**=[*value*]]
[**--sandboxdir**=[*value*]] [**--sandboxdir**=[*value*]]
[**--containerdir**=[*value*]] [**--containerdir**=[*value*]]
[**--socket**=[*value*]] [**--socket**=[*value*]]
@ -39,6 +40,9 @@ ocid is meant to provide an integration path between OCI conformant runtimes and
**--sandboxdir**="" **--sandboxdir**=""
OCID pod sandbox dir (default: "/var/lib/ocid/sandboxes") OCID pod sandbox dir (default: "/var/lib/ocid/sandboxes")
**--conmon**=""
path to the conmon executable (default: "/usr/libexec/ocid/conmon")
**--containerdir**="" **--containerdir**=""
OCID container dir (default: "/var/lib/ocid/containers") OCID container dir (default: "/var/lib/ocid/containers")

View file

@ -21,11 +21,12 @@ import (
) )
// New creates a new Runtime with options provided // New creates a new Runtime with options provided
func New(runtimePath string, containerDir string) (*Runtime, error) { func New(runtimePath string, containerDir string, conmonPath string) (*Runtime, error) {
r := &Runtime{ r := &Runtime{
name: filepath.Base(runtimePath), name: filepath.Base(runtimePath),
path: runtimePath, path: runtimePath,
containerDir: containerDir, containerDir: containerDir,
conmonPath: conmonPath,
} }
return r, nil return r, nil
} }
@ -35,6 +36,7 @@ type Runtime struct {
name string name string
path string path string
containerDir string containerDir string
conmonPath string
} }
// syncInfo is used to return data from monitor process to daemon // syncInfo is used to return data from monitor process to daemon
@ -91,7 +93,7 @@ func (r *Runtime) CreateContainer(c *Container) error {
args = append(args, "-t") args = append(args, "-t")
} }
cmd := exec.Command("conmon", args...) cmd := exec.Command(r.conmonPath, args...)
cmd.Dir = c.bundlePath cmd.Dir = c.bundlePath
cmd.SysProcAttr = &syscall.SysProcAttr{ cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true, Setpgid: true,

View file

@ -107,7 +107,7 @@ func (s *Server) releasePodName(name string) {
} }
// New creates a new Server with options provided // New creates a new Server with options provided
func New(runtimePath, root, sandboxDir, containerDir string) (*Server, error) { func New(runtimePath, root, sandboxDir, containerDir string, conmonPath string) (*Server, error) {
// TODO: This will go away later when we have wrapper process or systemd acting as // TODO: This will go away later when we have wrapper process or systemd acting as
// subreaper. // subreaper.
if err := utils.SetSubreaper(1); err != nil { if err := utils.SetSubreaper(1); err != nil {
@ -124,7 +124,7 @@ func New(runtimePath, root, sandboxDir, containerDir string) (*Server, error) {
return nil, err return nil, err
} }
r, err := oci.New(runtimePath, containerDir) r, err := oci.New(runtimePath, containerDir, conmonPath)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -70,7 +70,7 @@ function wait_until_reachable() {
# Start ocid. # Start ocid.
function start_ocid() { function start_ocid() {
"$OCID_BINARY" --debug --socket "$TESTDIR/ocid.sock" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" --sandboxdir "$TESTDIR/sandboxes" --containerdir "$TESTDIR/ocid/containers" & OCID_PID=$! "$OCID_BINARY" --conmon "$CONMON_BINARY" --debug --socket "$TESTDIR/ocid.sock" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" --sandboxdir "$TESTDIR/sandboxes" --containerdir "$TESTDIR/ocid/containers" & OCID_PID=$!
wait_until_reachable wait_until_reachable
} }