Skip to content

Commit

Permalink
Add debug flag (#330)
Browse files Browse the repository at this point in the history
* Add debug flag

* Update go.mod
  • Loading branch information
jabbrwcky authored Feb 5, 2025
1 parent cbea009 commit dbcf78d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var (
)

var (
debug bool
force bool
skipWaitPVCBind bool
tolerateAllNodes bool
Expand All @@ -51,6 +52,10 @@ var rootCmd = &cobra.Command{
}

func rootCmdRun(cmd *cobra.Command, args []string) {
if debug {
log.SetLevel(log.DebugLevel)
}

var t *time.Duration
if timeout != "" {
_t, err := time.ParseDuration(timeout)
Expand Down Expand Up @@ -116,13 +121,14 @@ func Execute() {
}

func init() {
log.SetLevel(log.DebugLevel)
log.SetLevel(log.InfoLevel)

if home := homedir.HomeDir(); home != "" {
rootCmd.Flags().StringVar(&kubeConfig, "kube-config", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
} else {
rootCmd.Flags().StringVar(&kubeConfig, "kube-config", "", "absolute path to the kubeconfig file")
}
rootCmd.Flags().BoolVar(&debug, "debug", false, "enable debug logging")
rootCmd.Flags().StringVar(&sourceNamespace, "source-namespace", "", "Namespace where the old PVCs reside. If empty, the namespace from your kubeconfig file will be used.")

rootCmd.Flags().StringVar(&pvcNewStorageClass, "new-pvc-storage-class", "", "Storage class to use for the new PVC. If empty, the storage class of the source will be used.")
Expand All @@ -139,4 +145,5 @@ func init() {
rootCmd.Flags().StringVar(&strategy, "strategy", "", "Strategy to use, by default will try to auto-select")
rootCmd.Flags().StringVar(&timeout, "timeout", "", "Overwrite auto-generated timeout (by default 60s for Pod to start, copy timeout is based on PVC size)")
rootCmd.Flags().StringVar(&copyTimeout, "copyTimeout", "", "Overwrite auto-generated copy timeout (by default 60s/GB of volume data)")

}
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module beryju.org/korb/v2

go 1.23
go 1.23.0

toolchain go1.23.5

require (
github.com/goware/prefixer v0.0.0-20160118172347-395022866408
github.com/schollz/progressbar/v3 v3.18.0
Expand Down

0 comments on commit dbcf78d

Please sign in to comment.