-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add cleanup script for local path provisioner (#28)
- Loading branch information
1 parent
5ce5518
commit 281e18b
Showing
19 changed files
with
505 additions
and
273 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
package cleanup | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/weka/gohomecli/internal/cli/app/hooks" | ||
) | ||
|
||
var ( | ||
Cli hooks.Cli | ||
) | ||
|
||
var cleanupCmd = &cobra.Command{ | ||
Use: "cleanup", | ||
Short: "Cleanup local setup", | ||
} | ||
|
||
func init() { | ||
Cli.AddHook(func(appCmd *cobra.Command) { | ||
appCmd.AddCommand(cleanupCmd) | ||
}) | ||
} |
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,31 @@ | ||
package cleanup | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/weka/gohomecli/internal/local/cleanup" | ||
) | ||
|
||
var config struct { | ||
LocalPath string | ||
} | ||
|
||
var localStorageCmd = &cobra.Command{ | ||
Use: "local-storage", | ||
Short: "cleans up unused volumes from local path provisioner", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if config.LocalPath != "" { | ||
cleanup.SetLocalStoragePath(config.LocalPath) | ||
} | ||
|
||
return cleanup.LocalStorage(cmd.Context()) | ||
}, | ||
} | ||
|
||
func init() { | ||
Cli = append(Cli, func(c *cobra.Command) { | ||
cleanupCmd.AddCommand(localStorageCmd) | ||
|
||
cleanupCmd.Flags().StringVar(&config.LocalPath, "path", "", "directory to local-path-provisioner") | ||
cleanupCmd.Flags().MarkHidden("bundle") | ||
}) | ||
} |
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
Oops, something went wrong.