Skip to content

Commit

Permalink
added generate docs for ksctl cli commands
Browse files Browse the repository at this point in the history
Signed-off-by: Dipankar Das <[email protected]>
  • Loading branch information
dipankardas011 committed Jun 1, 2024
1 parent 6ec5565 commit a2f8a81
Show file tree
Hide file tree
Showing 67 changed files with 2,215 additions and 514 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ CURR_TIME = $(shell date +%s)
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\n\033[36m _ _ _ \n | | | | | |\n | | _____ ___| |_| |\n | |/ / __|/ __| __| |\n | <\\__ \\ (__| |_| |\n |_|\\_\\___/\\___|\\__|_| \033[0m\n\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Generate
.PHONY: gen-docs
gen-docs: ## Generates docs
go run gen_docs.go

##@ Install (Dev)

.PHONY: install_linux
Expand Down
3 changes: 1 addition & 2 deletions cli/cmd/addNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"os"

"github.com/fatih/color"
"github.com/ksctl/cli/logger"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/types"
Expand All @@ -14,7 +13,7 @@ import (
)

var addMoreWorkerNodesHAAws = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Example: `
ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --nodeSizeWP t2.medium --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Expand Down
4 changes: 1 addition & 3 deletions cli/cmd/addNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package cmd
import (
"os"

"github.com/fatih/color"

"github.com/ksctl/cli/logger"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/types"
Expand All @@ -15,7 +13,7 @@ import (
)

var addMoreWorkerNodesHAAzure = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Example: `
ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --nodeSizeWP Standard_F2s --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Expand Down
4 changes: 1 addition & 3 deletions cli/cmd/addNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package cmd
import (
"os"

"github.com/fatih/color"

"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"
Expand All @@ -14,7 +12,7 @@ import (
)

var addMoreWorkerNodesHACivo = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Example: `
ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSizeWP g3.medium --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/createCluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ksctl create-cluster ha-azure --name demo --region eastus --bootstrap kubeadm --
}

func init() {
rootCmd.AddCommand(createClusterCmd)
RootCmd.AddCommand(createClusterCmd)

createClusterCmd.AddCommand(createClusterAzure)
createClusterCmd.AddCommand(createClusterCivo)
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var credCmd = &cobra.Command{
}

func init() {
rootCmd.AddCommand(credCmd)
RootCmd.AddCommand(credCmd)
storageFlag(credCmd)

credCmd.Flags().BoolP("verbose", "v", true, "for verbose output")
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/deleteCluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ ksctl delete ha-civo --name demo --region LON1 --storage store-local
}

func init() {
rootCmd.AddCommand(deleteClusterCmd)
RootCmd.AddCommand(deleteClusterCmd)

deleteClusterCmd.AddCommand(deleteClusterHACivo)
deleteClusterCmd.AddCommand(deleteClusterCivo)
Expand Down
5 changes: 2 additions & 3 deletions cli/cmd/deleteNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"os"

"github.com/fatih/color"
"github.com/ksctl/cli/logger"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/types"
Expand All @@ -13,8 +12,8 @@ import (
)

var deleteNodesHAAws = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
Example: `
ksctl delete ha-aws del-nodes -n demo -r us-east-1 -s store-local --noWP 1 --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Expand Down
5 changes: 2 additions & 3 deletions cli/cmd/deleteNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"os"

"github.com/fatih/color"
"github.com/ksctl/cli/logger"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/types"
Expand All @@ -13,8 +12,8 @@ import (
)

var deleteNodesHAAzure = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
Example: `
ksctl delete ha-azure del-nodes -n demo -r eastus -s store-local --noWP 1 --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Expand Down
5 changes: 2 additions & 3 deletions cli/cmd/deleteNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"os"

"github.com/fatih/color"
"github.com/ksctl/cli/logger"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/types"
Expand All @@ -13,8 +12,8 @@ import (
)

var deleteNodesHACivo = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
Example: `
ksctl delete ha-civo del-nodes -n demo -r LON1 -s store-local --noWP 1 --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/getCluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ksctl get-clusters `,
}

func init() {
rootCmd.AddCommand(getClusterCmd)
RootCmd.AddCommand(getClusterCmd)
storageFlag(getClusterCmd)

getClusterCmd.Flags().StringVarP(&provider, "provider", "p", "", "Provider")
Expand Down
8 changes: 4 additions & 4 deletions cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var (
ctx context.Context
)

var rootCmd = &cobra.Command{
var RootCmd = &cobra.Command{
Use: "ksctl",
Short: "CLI tool for managing multiple K8s clusters",
Long: `
Expand Down Expand Up @@ -93,7 +93,7 @@ func Execute() {
}

timer := time.Now()
err := rootCmd.Execute()
err := RootCmd.Execute()
defer logCli.Print(ctx, "Time Took", "time", time.Since(timer).String())

if err != nil {
Expand All @@ -107,11 +107,11 @@ func init() {
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.Kubesimpctl.yaml)")
// RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.Kubesimpctl.yaml)")

// Cobra also supports local flags, which will only run
// when this action is called directly.
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
verboseFlags()

argsFlags()
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/switchCluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ksctl switch-context -s external-store-mongodb -p civo -n <clustername> -r <regi
}

func init() {
rootCmd.AddCommand(switchCluster)
RootCmd.AddCommand(switchCluster)
clusterNameFlag(switchCluster)
regionFlag(switchCluster)
storageFlag(switchCluster)
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ var versionCmd = &cobra.Command{
}

func init() {
rootCmd.AddCommand(versionCmd)
RootCmd.AddCommand(versionCmd)
}
34 changes: 34 additions & 0 deletions gen/docs.md/ksctl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## ksctl

CLI tool for managing multiple K8s clusters

### Synopsis


_ _ _
| | | | | |
| | _____ ___| |_| |
| |/ / __|/ __| __| |
| <\__ \ (__| |_| |
|_|\_\___/\___|\__|_|

CLI tool which can manage multiple K8s clusters
from local clusters to cloud provider specific clusters.

### Options

```
-h, --help help for ksctl
-t, --toggle Help message for toggle
```

### SEE ALSO

* [ksctl create-cluster](ksctl_create-cluster.md) - Use to create a cluster
* [ksctl cred](ksctl_cred.md) - Login to your Cloud-provider Credentials
* [ksctl delete-cluster](ksctl_delete-cluster.md) - Use to delete a cluster
* [ksctl get-clusters](ksctl_get-clusters.md) - Use to get clusters
* [ksctl switch-cluster](ksctl_switch-cluster.md) - Use to switch between clusters
* [ksctl version](ksctl_version.md) - Print the version number of ksctl

###### Auto generated by spf13/cobra on 1-Jun-2024
33 changes: 33 additions & 0 deletions gen/docs.md/ksctl_create-cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## ksctl create-cluster

Use to create a cluster

### Synopsis

It is used to create cluster with the given name from user

### Examples

```
ksctl create --help
```

### Options

```
-h, --help help for create-cluster
```

### SEE ALSO

* [ksctl](ksctl.md) - CLI tool for managing multiple K8s clusters
* [ksctl create-cluster azure](ksctl_create-cluster_azure.md) - Use to create a AKS cluster in Azure
* [ksctl create-cluster civo](ksctl_create-cluster_civo.md) - Use to create a Civo managed k3s cluster
* [ksctl create-cluster ha-aws](ksctl_create-cluster_ha-aws.md) - Use to create a self-managed Highly Available cluster on AWS
* [ksctl create-cluster ha-azure](ksctl_create-cluster_ha-azure.md) - Use to create a self-managed Highly-Available cluster on Azure
* [ksctl create-cluster ha-civo](ksctl_create-cluster_ha-civo.md) - Use to create a self-managed Highly Available cluster on Civo
* [ksctl create-cluster local](ksctl_create-cluster_local.md) - Use to create a kind cluster

###### Auto generated by spf13/cobra on 1-Jun-2024
43 changes: 43 additions & 0 deletions gen/docs.md/ksctl_create-cluster_azure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## ksctl create-cluster azure

Use to create a AKS cluster in Azure

### Synopsis

It is used to create cluster with the given name from user

```
ksctl create-cluster azure [flags]
```

### Examples

```
ksctl create-cluster azure -n demo -r eastus -s store-local --nodeSizeMP Standard_DS2_v2 --noMP 3
```

### Options

```
--apps string Pre-Installed Applications
--bootstrap string Kubernetes Bootstrap
--cni string CNI
--feature-flags string Experimental Features: Supported values with comma seperated: [autoscale]
-h, --help help for azure
-n, --name string Cluster Name (default "demo")
--noMP int Number of Managed Nodes (default -1)
--nodeSizeMP string Node size of managed cluster nodes
-r, --region string Region
-s, --storage string storage provider
-v, --verbose int for verbose output
--version string Kubernetes Version
-y, --yes approval to avoid showMsg (default true)
```

### SEE ALSO

* [ksctl create-cluster](ksctl_create-cluster.md) - Use to create a cluster

###### Auto generated by spf13/cobra on 1-Jun-2024
43 changes: 43 additions & 0 deletions gen/docs.md/ksctl_create-cluster_civo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## ksctl create-cluster civo

Use to create a Civo managed k3s cluster

### Synopsis

It is used to create cluster with the given name from user

```
ksctl create-cluster civo [flags]
```

### Examples

```
ksctl create-cluster civo --name demo --region LON1 --storage store-local --nodeSizeMP g4s.kube.small --noMP 3
```

### Options

```
--apps string Pre-Installed Applications
--bootstrap string Kubernetes Bootstrap
--cni string CNI
--feature-flags string Experimental Features: Supported values with comma seperated: [autoscale]
-h, --help help for civo
-n, --name string Cluster Name (default "demo")
--noMP int Number of Managed Nodes (default -1)
--nodeSizeMP string Node size of managed cluster nodes
-r, --region string Region
-s, --storage string storage provider
-v, --verbose int for verbose output
--version string Kubernetes Version
-y, --yes approval to avoid showMsg (default true)
```

### SEE ALSO

* [ksctl create-cluster](ksctl_create-cluster.md) - Use to create a cluster

###### Auto generated by spf13/cobra on 1-Jun-2024
Loading

0 comments on commit a2f8a81

Please sign in to comment.