Skip to content

Commit

Permalink
Generate reference docs (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed Jul 12, 2017
1 parent 57dfc70 commit b89c2cb
Show file tree
Hide file tree
Showing 112 changed files with 11,509 additions and 14,531 deletions.
27 changes: 27 additions & 0 deletions docs/reference/kubed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## kubed

Kubed by AppsCode - Kubernetes Daemon

### Synopsis


Kubed is a Kubernetes companion daemon to perform various supporting operations. For more information, visit here: https://github.com/appscode/kubed/tree/master/docs

### Options

```
--alsologtostderr log to standard error as well as files
-h, --help help for kubed
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--logtostderr log to standard error instead of files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level log level for V logs
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO
* [kubed run](kubed_run.md) - Run daemon
* [kubed version](kubed_version.md) - Prints binary version number.


48 changes: 48 additions & 0 deletions docs/reference/kubed_run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## kubed run

Run daemon

### Synopsis


Run daemon

```
kubed run [flags]
```

### Options

```
--address string The address of the Kubed API Server (default ":32600")
--cluster-name string Name of Kubernetes cluster
--enable-reverse-index Reverse indexing of pods to service and others (default true)
--es-endpoint string Endpoint of elasticsearch
-h, --help help for run
--indexer string Reverse indexing of pods to service and others (default "indexers.bleve")
--influx-secret string Influxdb secret name (default "appscode-influx")
--influx-secret-namespace string Influxdb secret namespace (default "kube-system")
--kubeconfig string Path to kubeconfig file with authorization information (the master location is set by the master flag).
--kubed-config-secret-name string Kubed configuration secret name (default "cluster-kubed-config")
--kubed-config-secret-namespace string Kubed configuration secret namespace (default "kube-system")
--master string The address of the Kubernetes API server (overrides any value in kubeconfig)
--notify-on-cert-expired If enabled notify cluster admin wheen cert expired soon. (default true)
--notify-via string Default notification method (eg: hipchat, mailgun, smtp, twilio, slack, plivo) (default "plivo")
```

### Options inherited from parent commands

```
--alsologtostderr log to standard error as well as files
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--logtostderr log to standard error instead of files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level log level for V logs
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO
* [kubed](kubed.md) - Kubed by AppsCode - Kubernetes Daemon


35 changes: 35 additions & 0 deletions docs/reference/kubed_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## kubed version

Prints binary version number.

### Synopsis


Prints binary version number.

```
kubed version [flags]
```

### Options

```
-h, --help help for version
```

### Options inherited from parent commands

```
--alsologtostderr log to standard error as well as files
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--logtostderr log to standard error instead of files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level log level for V logs
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO
* [kubed](kubed.md) - Kubed by AppsCode - Kubernetes Daemon


19 changes: 14 additions & 5 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions hack/gendocs/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"fmt"
"log"
"os"

"github.com/appscode/go/runtime"
"github.com/appscode/kubed/pkg/cmds"
"github.com/spf13/cobra/doc"
)

// ref: https://github.com/spf13/cobra/blob/master/doc/md_docs.md
func main() {
rootCmd := cmds.NewCmdKubed()
dir := runtime.GOPath() + "/src/github.com/appscode/kubed/docs/reference"
fmt.Printf("Generating cli markdown tree in: %v\n", dir)
err := os.MkdirAll(dir, 0755)
if err != nil {
log.Fatal(err)
}
doc.GenMarkdownTree(rootCmd, dir)
}
8 changes: 8 additions & 0 deletions hack/gendocs/make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

pushd $GOPATH/src/github.com/appscode/kubed/hack/gendocs
go run main.go

cd $GOPATH/src/github.com/appscode/kubed/docs/reference
sed -i 's/######\ Auto\ generated\ by.*//g' *
popd
26 changes: 3 additions & 23 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
package main

import (
"flag"
"log"
"os"

v "github.com/appscode/go/version"
"github.com/appscode/kubed/pkg/cmds"
logs "github.com/appscode/log/golog"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
_ "k8s.io/client-go/kubernetes/fake"
)

func main() {
defer logs.FlushLogs()

rootCmd := &cobra.Command{
Use: "kubed",
Short: `Run Kubernetes Daemon for AppsCode`,
PersistentPreRun: func(c *cobra.Command, args []string) {
c.Flags().VisitAll(func(flag *pflag.Flag) {
log.Printf("FLAG: --%s=%q", flag.Name, flag.Value)
})
},
}
rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)
// ref: https://github.com/kubernetes/kubernetes/issues/17162#issuecomment-225596212
flag.CommandLine.Parse([]string{})
logs.InitLogs()
defer logs.FlushLogs()

rootCmd.AddCommand(NewCmdRun())
rootCmd.AddCommand(v.NewCmdVersion())

if err := rootCmd.Execute(); err != nil {
if err := cmds.NewCmdKubed().Execute(); err != nil {
os.Exit(1)
}
os.Exit(0)
Expand Down
32 changes: 32 additions & 0 deletions pkg/cmds/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package cmds

import (
"flag"
"log"

v "github.com/appscode/go/version"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
_ "k8s.io/client-go/kubernetes/fake"
)

func NewCmdKubed() *cobra.Command {
cmd := &cobra.Command{
Use: "kubed",
Short: `Kubed by AppsCode - Kubernetes Daemon`,
Long: `Kubed is a Kubernetes companion daemon to perform various supporting operations. For more information, visit here: https://github.com/appscode/kubed/tree/master/docs`,
PersistentPreRun: func(c *cobra.Command, args []string) {
c.Flags().VisitAll(func(flag *pflag.Flag) {
log.Printf("FLAG: --%s=%q", flag.Name, flag.Value)
})
},
}
cmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)
// ref: https://github.com/kubernetes/kubernetes/issues/17162#issuecomment-225596212
flag.CommandLine.Parse([]string{})

cmd.AddCommand(NewCmdRun())
cmd.AddCommand(v.NewCmdVersion())

return cmd
}
2 changes: 1 addition & 1 deletion run.go → pkg/cmds/run.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package cmds

import (
"fmt"
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/cpuguy83/go-md2man/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b89c2cb

Please sign in to comment.