command

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CephCmd = &cobra.Command{
	Use:                "ceph",
	Short:              "call a 'ceph' CLI command with arbitrary args",
	DisableFlagParsing: true,
	Args:               cobra.MinimumNArgs(1),
	PreRun: func(cmd *cobra.Command, args []string) {
		verifyOperatorPodIsRunning(cmd.Context(), clientSets)
	},
	Run: func(cmd *cobra.Command, args []string) {
		logging.Info("running 'ceph' command with args: %v", args)
		_, err := exec.RunCommandInOperatorPod(cmd.Context(), clientSets, cmd.Use, args, operatorNamespace, cephClusterNamespace, false)
		if err != nil {
			logging.Fatal(err)
		}
	},
}

CephCmd represents the ceph command

View Source
var DebugCmd = &cobra.Command{
	Use:                "debug",
	Short:              "Debug a deployment by scaling it down and creating a debug copy. This is supported for mons and OSDs only",
	DisableFlagParsing: true,
	Args:               cobra.ExactArgs(1),
	PreRun: func(cmd *cobra.Command, args []string) {
		verifyOperatorPodIsRunning(cmd.Context(), clientSets)
	},
}

OperatorCmd represents the operator commands

View Source
var DestroyClusterCmd = &cobra.Command{
	Use:   "destroy-cluster",
	Short: "delete ALL data in the Rook cluster and all Rook CRs",

	Run: func(cmd *cobra.Command, args []string) {
		ctx := cmd.Context()
		var answer string
		logging.Warning(destroyClusterQuestion, cephClusterNamespace)
		fmt.Scanf("%s", &answer)
		err := mons.PromptToContinueOrCancel(destroyClusterAnswer, answer)
		if err != nil {
			logging.Fatal(fmt.Errorf("the response %q to confirm the cluster deletion", destroyClusterAnswer))
		}

		logging.Info("proceeding")
		clientsets := getClientsets(ctx)
		crds.DeleteCustomResources(ctx, clientsets, clientsets.Kube, cephClusterNamespace)
	},
}

DestroyClusterCmd represents the command for destroy cluster

View Source
var DrCmd = &cobra.Command{
	Use:                "dr",
	Short:              "Calls subcommand health",
	DisableFlagParsing: true,
	Args:               cobra.ExactArgs(1),
	PreRun: func(cmd *cobra.Command, args []string) {
		verifyOperatorPodIsRunning(cmd.Context(), clientSets)
	},
}
View Source
var Health = &cobra.Command{
	Use:                "health",
	Short:              "check health of the cluster and common configuration issues",
	DisableFlagParsing: true,
	Args:               cobra.NoArgs,
	PreRun: func(cmd *cobra.Command, args []string) {
		verifyOperatorPodIsRunning(cmd.Context(), clientSets)
	},
	Run: func(cmd *cobra.Command, _ []string) {
		health.Health(cmd.Context(), clientSets, operatorNamespace, cephClusterNamespace)
	},
}
View Source
var MonCmd = &cobra.Command{
	Use:                "mons",
	Short:              "Output mon endpoints",
	DisableFlagParsing: true,
	Args:               cobra.MaximumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			fmt.Println(mons.GetMonEndpoint(cmd.Context(), clientSets.Kube, cephClusterNamespace))
		}
	},
}

MonCmd represents the mons command

View Source
var OperatorCmd = &cobra.Command{
	Use:                "operator",
	Short:              "Calls subcommands like `restart`  and `set <key> <value>` to update  rook-ceph-operator-config configmap",
	DisableFlagParsing: true,
	Args:               cobra.ExactArgs(1),
}

OperatorCmd represents the operator commands

View Source
var RbdCmd = &cobra.Command{
	Use:                "rbd",
	Short:              "call a 'rbd' CLI command with arbitrary args",
	DisableFlagParsing: true,
	Args:               cobra.MinimumNArgs(1),
	PreRun: func(cmd *cobra.Command, args []string) {
		verifyOperatorPodIsRunning(cmd.Context(), clientSets)
	},
	Run: func(cmd *cobra.Command, args []string) {
		_, err := exec.RunCommandInOperatorPod(cmd.Context(), clientSets, cmd.Use, args, operatorNamespace, cephClusterNamespace, false)
		if err != nil {
			logging.Fatal(err)
		}
	},
}

RbdCmd represents the rbd command

View Source
var RestoreCmd = &cobra.Command{
	Use:     "restore-deleted",
	Short:   "Restores a CR that was accidentally deleted and is still in terminating state.",
	Args:    cobra.RangeArgs(1, 2),
	Example: "kubectl rook-ceph restore-deleted <CRD> [CR_Name]",
	PreRun: func(cmd *cobra.Command, args []string) {
		verifyOperatorPodIsRunning(cmd.Context(), clientSets)
	},
	Run: func(cmd *cobra.Command, args []string) {
		restore.RestoreCrd(cmd.Context(), clientSets, operatorNamespace, cephClusterNamespace, args)
	},
}

RestoreCmd represents the restore commands

View Source
var RestoreQuorum = &cobra.Command{
	Use:                "restore-quorum",
	Short:              "When quorum is lost, restore quorum to the remaining healthy mon",
	DisableFlagParsing: true,
	Args:               cobra.ExactArgs(1),
	Example:            "kubectl rook-ceph mons restore-quorum <Mon_ID>",
	Run: func(cmd *cobra.Command, args []string) {
		mons.RestoreQuorum(cmd.Context(), clientSets, operatorNamespace, cephClusterNamespace, args[0])
	},
}

RestoreQuorum represents the mons command

View Source
var RookCmd = &cobra.Command{
	Use:   "rook",
	Short: "Calls subcommands like `version`, `purge-osd, status` and etc.",
	Args:  cobra.ExactArgs(1),
}

RookCmd represents the rook commands

View Source
var RootCmd = &cobra.Command{
	Use:              "rook-ceph",
	Short:            "kubectl rook-ceph provides common management and troubleshooting tools for Ceph.",
	Args:             cobra.MinimumNArgs(1),
	TraverseChildren: true,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		if cephClusterNamespace != "" && operatorNamespace == "" {
			operatorNamespace = cephClusterNamespace
		}
		clientSets = getClientsets(cmd.Context())
		preValidationCheck(cmd.Context(), clientSets)
	},
}

rookCmd represents the rook command

View Source
var SubvolumeCmd = &cobra.Command{
	Use:   "subvolume",
	Short: "manages stale subvolumes",
	PreRun: func(cmd *cobra.Command, args []string) {
		verifyOperatorPodIsRunning(cmd.Context(), clientSets)
	},
	Args: cobra.ExactArgs(1),
}

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL