|
|
6c20ab |
MDSFORMANPAGES="kube-apiserver.md kube-controller-manager.md kube-proxy.md kube-scheduler.md kubelet.md"
|
|
|
6c20ab |
|
|
|
39ea8e |
# remove comments from man pages
|
|
|
39ea8e |
for manpage in ${MDSFORMANPAGES}; do
|
|
|
39ea8e |
pos=$(grep -n "<\!-- END MUNGE: UNVERSIONED_WARNING -->" ${manpage} | cut -d':' -f1)
|
|
|
39ea8e |
if [ -n ${pos} ]; then
|
|
|
39ea8e |
sed -i "1,${pos}{/.*/d}" ${manpage}
|
|
|
39ea8e |
fi
|
|
|
39ea8e |
done
|
|
|
39ea8e |
|
|
|
6c20ab |
# for each man page add NAME and SYNOPSIS section
|
|
|
6c20ab |
# kube-apiserver
|
|
|
6c20ab |
sed -i -s "s/## kube-apiserver/# NAME\nkube-apiserver \- Provides the API for kubernetes orchestration.\n\n# SYNOPSIS\n**kube-apiserver** [OPTIONS]\n/" kube-apiserver.md
|
|
|
6c20ab |
|
|
|
6c20ab |
cat << 'EOF' >> kube-apiserver.md
|
|
|
6c20ab |
# EXAMPLES
|
|
|
6c20ab |
```
|
|
|
6c20ab |
/usr/bin/kube-apiserver --logtostderr=true --v=0 --etcd_servers=http://127.0.0.1:4001 --insecure_bind_address=127.0.0.1 --insecure_port=8080 --kubelet_port=10250 --service-cluster-ip-range=10.1.1.0/24 --allow_privileged=false
|
|
|
6c20ab |
```
|
|
|
6c20ab |
EOF
|
|
|
6c20ab |
# kube-controller-manager
|
|
|
6c20ab |
sed -i -s "s/## kube-controller-manager/# NAME\nkube-controller-manager \- Enforces kubernetes services.\n\n# SYNOPSIS\n**kube-controller-manager** [OPTIONS]\n/" kube-controller-manager.md
|
|
|
6c20ab |
|
|
|
6c20ab |
cat << 'EOF' >> kube-controller-manager.md
|
|
|
6c20ab |
# EXAMPLES
|
|
|
6c20ab |
```
|
|
|
6c20ab |
/usr/bin/kube-controller-manager --logtostderr=true --v=0 --master=127.0.0.1:8080
|
|
|
6c20ab |
```
|
|
|
6c20ab |
EOF
|
|
|
6c20ab |
# kube-proxy
|
|
|
6c20ab |
sed -i -s "s/## kube-proxy/# NAME\nkube-proxy \- Provides network proxy services.\n\n# SYNOPSIS\n**kube-proxy** [OPTIONS]\n/" kube-proxy.md
|
|
|
6c20ab |
|
|
|
6c20ab |
cat << 'EOF' >> kube-proxy.md
|
|
|
6c20ab |
# EXAMPLES
|
|
|
6c20ab |
```
|
|
|
6c20ab |
/usr/bin/kube-proxy --logtostderr=true --v=0 --master=http://127.0.0.1:8080
|
|
|
6c20ab |
```
|
|
|
6c20ab |
EOF
|
|
|
6c20ab |
# kube-scheduler
|
|
|
6c20ab |
sed -i -s "s/## kube-scheduler/# NAME\nkube-scheduler \- Schedules containers on hosts.\n\n# SYNOPSIS\n**kube-scheduler** [OPTIONS]\n/" kube-scheduler.md
|
|
|
6c20ab |
|
|
|
6c20ab |
cat << 'EOF' >> kube-scheduler.md
|
|
|
6c20ab |
# EXAMPLES
|
|
|
6c20ab |
```
|
|
|
6c20ab |
/usr/bin/kube-scheduler --logtostderr=true --v=0 --master=127.0.0.1:8080
|
|
|
6c20ab |
```
|
|
|
6c20ab |
EOF
|
|
|
6c20ab |
# kubelet
|
|
|
6c20ab |
sed -i -s "s/## kubelet/# NAME\nkubelet \- Processes a container manifest so the containers are launched according to how they are described.\n\n# SYNOPSIS\n**kubelet** [OPTIONS]\n/" kubelet.md
|
|
|
6c20ab |
|
|
|
6c20ab |
cat << 'EOF' >> kubelet.md
|
|
|
6c20ab |
# EXAMPLES
|
|
|
6c20ab |
```
|
|
|
6c20ab |
/usr/bin/kubelet --logtostderr=true --v=0 --api_servers=http://127.0.0.1:8080 --address=127.0.0.1 --port=10250 --hostname_override=127.0.0.1 --allow-privileged=false
|
|
|
6c20ab |
```
|
|
|
6c20ab |
EOF
|
|
|
6c20ab |
|
|
|
6c20ab |
# for all man-pages
|
|
|
6c20ab |
for md in $MDSFORMANPAGES; do
|
|
|
6c20ab |
# correct section names
|
|
|
6c20ab |
sed -i -s "s/### Synopsis/# DESCRIPTION/" $md
|
|
|
6c20ab |
sed -i -s "s/### Options/# OPTIONS/" $md
|
|
|
6c20ab |
# add header
|
|
|
6c20ab |
sed -i "s/# NAME/% KUBERNETES(1) kubernetes User Manuals\n# NAME/" $md
|
|
|
6c20ab |
# modify list of options
|
|
|
6c20ab |
# options with no value in ""
|
|
|
6c20ab |
sed -i -r 's/(^ )(-[^":][^":]*)(:)(.*)/\*\*\2\*\*\n\t\4\n/' $md
|
|
|
6c20ab |
# option with value in ""
|
|
|
6c20ab |
sed -i -r 's/(^ )(-[^":][^":]*)("[^"]*")(:)(.*)/\*\*\2\3\*\*\n\t\5\n/' $md
|
|
|
6c20ab |
# options in -s, --long
|
|
|
6c20ab |
sed -i -r 's/(^ )(-[a-z], -[^":][^":]*)(:)(.*)/\*\*\2\*\*\n\t\4\n/' $md
|
|
|
6c20ab |
sed -i -r 's/(^ )(-[a-z], -[^":][^":]*)("[^"]*")(:)(.*)/\*\*\2\3\*\*\n\t\5\n/' $md
|
|
|
6c20ab |
# remove ```
|
|
|
6c20ab |
sed -i 's/```//' $md
|
|
|
6c20ab |
# remove all lines starting with ######
|
|
|
6c20ab |
sed -i 's/^######.*//' $md
|
|
|
6c20ab |
# modify footer
|
|
|
6c20ab |
sed -i -r "s/^\[!\[Analytics\].*//" $md
|
|
|
6c20ab |
# md does not contain section => taking 1
|
|
|
6c20ab |
name="${md%.md}"
|
|
|
6c20ab |
go-md2man -in $md -out man/man1/$name.1
|
|
|
6c20ab |
done
|
|
|
6c20ab |
|
|
|
6c20ab |
|