-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snapshots - handle minimal RBAC (#1465)
* Snapshots - handle minimal RBAC
- Loading branch information
Showing
25 changed files
with
514 additions
and
164 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package cli | ||
|
||
import ( | ||
"github.com/replicatedhq/kots/pkg/snapshot" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func VeleroCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "velero", | ||
Short: "KOTS Velero interface", | ||
} | ||
|
||
cmd.AddCommand(EnsurePermissionsCmd()) | ||
|
||
return cmd | ||
} | ||
|
||
func EnsurePermissionsCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "ensure-permissions", | ||
Short: "Ensures the necessary permissions that enables the Admin Console to access Velero.", | ||
Long: ``, | ||
SilenceUsage: true, | ||
SilenceErrors: false, | ||
PreRun: func(cmd *cobra.Command, args []string) { | ||
viper.BindPFlags(cmd.Flags()) | ||
}, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
v := viper.GetViper() | ||
|
||
namespace := v.GetString("namespace") | ||
if err := validateNamespace(namespace); err != nil { | ||
return err | ||
} | ||
|
||
if err := snapshot.EnsureVeleroPermissions(namespace); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
cmd.Flags().StringP("namespace", "n", "", "namespace in which kots/kotsadm is installed") | ||
|
||
return cmd | ||
} |
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.