Install conmon in /usr/libexec/ocid/conmon

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Dan Walsh 2016-09-28 15:49:46 -04:00
parent 47c993f2e1
commit f51c98b057
6 changed files with 22 additions and 9 deletions

View file

@ -81,12 +81,13 @@ docs: $(MANPAGES_MD:%.md=%)
install: binaries docs
install -D -m 755 ocid ${INSTALLDIR}/ocid
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 -m 644 $(basename $(MANPAGES_MD)) $(PREFIX)/share/man/man8
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 \
rm -f $(PREFIX)/share/man/man8/$$(basename $${i}); \
done

View file

@ -14,7 +14,8 @@ import (
)
const (
ocidRoot = "/var/lib/ocid"
ocidRoot = "/var/lib/ocid"
conmonPath = "/usr/libexec/ocid/conmon"
)
func main() {
@ -24,6 +25,11 @@ func main() {
app.Version = "0.0.1"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "conmon",
Value: conmonPath,
Usage: "path to the conmon executable",
},
cli.StringFlag{
Name: "root",
Value: ocidRoot,
@ -104,7 +110,7 @@ func main() {
containerDir := c.String("containerdir")
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 {
logrus.Fatal(err)
}

View file

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

View file

@ -21,11 +21,12 @@ import (
)
// 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{
name: filepath.Base(runtimePath),
path: runtimePath,
containerDir: containerDir,
conmonPath: conmonPath,
}
return r, nil
}
@ -35,6 +36,7 @@ type Runtime struct {
name string
path string
containerDir string
conmonPath string
}
// 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")
}
cmd := exec.Command("conmon", args...)
cmd := exec.Command(r.conmonPath, args...)
cmd.Dir = c.bundlePath
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,

View file

@ -107,7 +107,7 @@ func (s *Server) releasePodName(name string) {
}
// 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
// subreaper.
if err := utils.SetSubreaper(1); err != nil {
@ -124,7 +124,7 @@ func New(runtimePath, root, sandboxDir, containerDir string) (*Server, error) {
return nil, err
}
r, err := oci.New(runtimePath, containerDir)
r, err := oci.New(runtimePath, containerDir, conmonPath)
if err != nil {
return nil, err
}

View file

@ -70,7 +70,7 @@ function wait_until_reachable() {
# 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
}