-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generate automatically the k3k cli doc, update readme and advanced-us…
…age doc
- Loading branch information
Showing
6 changed files
with
176 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.PHONY: gendoc | ||
|
||
gendoc: | ||
@go run ./genclidoc.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# NAME | ||
|
||
k3kcli - CLI for K3K | ||
|
||
# SYNOPSIS | ||
|
||
k3kcli | ||
|
||
``` | ||
[--debug] | ||
``` | ||
|
||
**Usage**: | ||
|
||
``` | ||
k3kcli [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] | ||
``` | ||
|
||
# GLOBAL OPTIONS | ||
|
||
**--debug**: Turn on debug logs | ||
|
||
|
||
# COMMANDS | ||
|
||
## cluster | ||
|
||
cluster command | ||
|
||
### create | ||
|
||
Create new cluster | ||
|
||
>k3kcli cluster create [command options] NAME | ||
**--agent-args**="": agents extra arguments | ||
|
||
**--agents**="": number of agents (default: 0) | ||
|
||
**--cluster-cidr**="": cluster CIDR | ||
|
||
**--kubeconfig**="": kubeconfig path (default: "/home/jpgouin/.kube/config") | ||
|
||
**--kubeconfig-server**="": override the kubeconfig server host | ||
|
||
**--mode**="": k3k mode type (shared, virtual) (default: "shared") | ||
|
||
**--namespace**="": namespace to create the k3k cluster in | ||
|
||
**--persistence-type**="": persistence mode for the nodes (ephemeral, static, dynamic) (default: "dynamic") | ||
|
||
**--server-args**="": servers extra arguments | ||
|
||
**--servers**="": number of servers (default: 1) | ||
|
||
**--service-cidr**="": service CIDR | ||
|
||
**--storage-class-name**="": storage class name for dynamic persistence type | ||
|
||
**--token**="": token of the cluster | ||
|
||
**--version**="": k3s version | ||
|
||
### delete | ||
|
||
Delete an existing cluster | ||
|
||
>k3kcli cluster delete [command options] NAME | ||
**--kubeconfig**="": kubeconfig path (default: "/home/jpgouin/.kube/config") | ||
|
||
**--namespace**="": namespace to create the k3k cluster in | ||
|
||
## kubeconfig | ||
|
||
Manage kubeconfig for clusters | ||
|
||
### generate | ||
|
||
Generate kubeconfig for clusters | ||
|
||
**--altNames**="": altNames of the generated certificates for the kubeconfig | ||
|
||
**--cn**="": Common name (CN) of the generated certificates for the kubeconfig (default: "system:admin") | ||
|
||
**--config-name**="": the name of the generated kubeconfig file | ||
|
||
**--expiration-days**="": Expiration date of the certificates used for the kubeconfig (default: 356) | ||
|
||
**--kubeconfig**="": kubeconfig path (default: "/home/jpgouin/.kube/config") | ||
|
||
**--kubeconfig-server**="": override the kubeconfig server host | ||
|
||
**--name**="": cluster name | ||
|
||
**--namespace**="": namespace to create the k3k cluster in | ||
|
||
**--org**="": Organization name (ORG) of the generated certificates for the kubeconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/rancher/k3k/cli/cmds" | ||
"github.com/rancher/k3k/cli/cmds/cluster" | ||
"github.com/rancher/k3k/cli/cmds/kubeconfig" | ||
"github.com/rancher/k3k/pkg/buildinfo" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func main() { | ||
// Instantiate the CLI application | ||
app := cmds.NewApp() | ||
app.Version = buildinfo.Version | ||
cli.VersionPrinter = func(cCtx *cli.Context) { | ||
fmt.Println("k3kcli Version: " + buildinfo.Version) | ||
} | ||
|
||
app.Commands = []*cli.Command{ | ||
cluster.NewCommand(), | ||
kubeconfig.NewCommand(), | ||
} | ||
|
||
// Generate the Markdown documentation | ||
md, err := app.ToMarkdown() | ||
if err != nil { | ||
fmt.Println("Error generating documentation:", err) | ||
os.Exit(1) | ||
} | ||
err = os.WriteFile("./cli-docs.md", []byte(md), 0644) | ||
if err != nil { | ||
fmt.Println("Error generating documentation:", err) | ||
os.Exit(1) | ||
} | ||
|
||
fmt.Println("Documentation generated at docs/cli/cli-docs.md") | ||
} |