Merge pull request #230 from rhatdan/docs

Add missing man pages and bash completions for kpod
This commit is contained in:
Mrunal Patel 2016-12-02 11:43:48 -08:00 committed by GitHub
commit 6983ae628b
5 changed files with 193 additions and 7 deletions

6
.gitignore vendored
View file

@ -5,7 +5,9 @@ conmon/conmon
conmon/conmon.o
pause/pause
pause/pause.o
/docs/*.[58]
/docs/*.[58].gz
/docs/*.[158]
/docs/*.[158].gz
vendor/src/github.com/kubernetes-incubator/cri-o
ocid.conf
*.orig
*.rej

View file

@ -17,6 +17,7 @@ ETCDIR_OCID ?= ${ETCDIR}/ocid
GO_MD2MAN ?= $(shell which go-md2man)
export GOPATH := ${CURDIR}/vendor
BUILDTAGS := selinux seccomp
BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions
all: binaries ocid.conf docs
@ -63,7 +64,7 @@ clean:
rm -f ocic ocid
rm -f kpod
rm -f ${OCID_LINK}
rm -f docs/*.5 docs/*.8
rm -f docs/*.1 docs/*.5 docs/*.8
find . -name \*~ -delete
find . -name \#\* -delete
make -C conmon clean
@ -86,7 +87,7 @@ binaries: ocid ocic kpod conmon pause
MANPAGES_MD := $(wildcard docs/*.md)
MANPAGES := $(MANPAGES_MD:%.md=%)
docs/%.8: docs/%.8.md
docs/%.1: docs/%.1.md
@which go-md2man > /dev/null 2>/dev/null || (echo "ERROR: go-md2man not found. Consider 'make install.tools' target" && false)
$(GO_MD2MAN) -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
@ -94,31 +95,44 @@ docs/%.5: docs/%.5.md
@which go-md2man > /dev/null 2>/dev/null || (echo "ERROR: go-md2man not found. Consider 'make install.tools' target" && false)
$(GO_MD2MAN) -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
docs/%.8: docs/%.8.md
@which go-md2man > /dev/null 2>/dev/null || (echo "ERROR: go-md2man not found. Consider 'make install.tools' target" && false)
$(GO_MD2MAN) -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
docs: $(MANPAGES)
install:
install -D -m 755 kpod $(BINDIR)/kpod
install -D -m 755 ocid $(BINDIR)/ocid
install -D -m 755 ocic $(BINDIR)/ocic
install -D -m 755 conmon/conmon $(LIBEXECDIR)/ocid/conmon
install -D -m 755 pause/pause $(LIBEXECDIR)/ocid/pause
install -d -m 755 $(MANDIR)/man{8,5}
install -m 644 $(filter %.8,$(MANPAGES)) -t $(MANDIR)/man8
install -d -m 755 $(MANDIR)/man{1,4,8}
install -m 644 $(filter %.1,$(MANPAGES)) -t $(MANDIR)/man1
install -m 644 $(filter %.5,$(MANPAGES)) -t $(MANDIR)/man5
install -m 644 $(filter %.8,$(MANPAGES)) -t $(MANDIR)/man8
install -D -m 644 ocid.conf $(ETCDIR_OCID)/ocid.conf
install -D -m 644 seccomp.json $(ETCDIR_OCID)/seccomp.json
install.completions:
install -d -m 755 ${BASHINSTALLDIR}
install -m 644 -D completions/bash/kpod ${BASHINSTALLDIR}
install.systemd:
install -D -m 644 contrib/systemd/ocid.service $(PREFIX)/lib/systemd/system/ocid.service
uninstall:
rm -f $(BINDIR)/{ocid,ocic}
rm -f $(LIBEXECDIR)/ocid/{conmon,pause}
for i in $(filter %.8,$(MANPAGES)); do \
for i in $(filter %.1,$(MANPAGES)); do \
rm -f $(MANDIR)/man8/$$(basename $${i}); \
done
for i in $(filter %.5,$(MANPAGES)); do \
rm -f $(MANDIR)/man5/$$(basename $${i}); \
done
for i in $(filter %.8,$(MANPAGES)); do \
rm -f $(MANDIR)/man8/$$(basename $${i}); \
done
.PHONY: .gitvalidation
# When this is running in travis, it will only check the travis commit range

89
completions/bash/kpod Normal file
View file

@ -0,0 +1,89 @@
#! /bin/bash
: ${PROG:=$(basename ${BASH_SOURCE})}
_complete_() {
local options_with_args=$1
local boolean_options="$2 -h --help"
case "$prev" in
$options_with_args)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
;;
esac
}
_kpod_launch() {
local options_with_args="
"
local boolean_options="
"
_complete_ "$options_with_args" "$boolean_options"
}
_kpod_kpod() {
local options_with_args="
"
local boolean_options="
--version -v
--help -h
"
commands="
launch
"
case "$prev" in
$main_options_with_args_glob )
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
;;
esac
}
_cli_bash_autocomplete() {
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=()
local cur prev words cword
_get_comp_words_by_ref -n : cur prev words cword
local command=${PROG} cpos=0
local counter=1
counter=1
while [ $counter -lt $cword ]; do
case "!${words[$counter]}" in
*)
command=$(echo "${words[$counter]}" | sed 's/-/_/g')
cpos=$counter
(( cpos++ ))
break
;;
esac
(( counter++ ))
done
local completions_func=_kpod_${command}
declare -F $completions_func >/dev/null && $completions_func
eval "$previous_extglob_setting"
return 0
}
complete -F _cli_bash_autocomplete $PROG

42
docs/kpod-launch.1.md Normal file
View file

@ -0,0 +1,42 @@
% kpod(8) # kpod-launch - Simple management tool for pods and images
% Dan Walsh
% SEPTEMBER 2016
# NAME
kpod-launch - Launch a new pod
# SYNOPSIS
**kpod launch**
[**--help**|**-h**]
# DESCRIPTION
Launch a container process in a new pod. **kpod launch** starts a process with
its own file system, its own networking, and its own isolated process tree.
The IMAGE which starts the process may define defaults related to the process
that will be launch in the pod, the networking to expose, and more, but
**kpod launch** gives final control to the operator or administrator who
starts the pod from the image. For that reason **kpod launch** has more
options than any other kpod commands.
If the IMAGE is not already loaded then **kpod launch** will pull the IMAGE, and
all image dependencies, from the repository in the same way launching **kpod
pull** IMAGE, before it starts the container from that image.
**kpod [GLOBAL OPTIONS]**
**kpod [GLOBAL OPTIONS] launch [OPTIONS]**
# GLOBAL OPTIONS
**--help, -h**
Print usage statement
# COMMANDS
## launch
Launch a pod
# SEE ALSO
kpod(1), ocid(8), ocid.conf(5)
# HISTORY
Dec 2016, Originally compiled by Dan Walsh <dwalsh@redhat.com>

39
docs/kpod.1.md Normal file
View file

@ -0,0 +1,39 @@
% kpod(8) # kpod - Simple management tool for pods and images
% Dan Walsh
% SEPTEMBER 2016
# NAME
kpod
# SYNOPSIS
**kpod**
[**--help**|**-h**]
# DESCRIPTION
kpod is a simple client only tool to help with debugging issues when daemons
such as CRI runtime and the kubelet are not responding or failing. A shared API
layer could be created to share code between the daemon and kpod. kpod does not
require any daemon running. kpod utilizes the same underlying components that
ocid uses i.e. containers/image, container/storage, oci-runtime-tool/generate,
runc or any other OCI compatible runtime. kpod shares state with ocid and so
has the capability to debug pods/images created by ocid.
**kpod [GLOBAL OPTIONS]**
# GLOBAL OPTIONS
**--help, -h**
Print usage statement
**--version, -v**
Print the version
# COMMANDS
## launch
Launch a pod
# SEE ALSO
ocid(8), ocid.conf(5)
# HISTORY
Dec 2016, Originally compiled by Dan Walsh <dwalsh@redhat.com>