Skip to content

Commit

Permalink
feat: cluster name for root-credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
CristhianF7 committed Aug 4, 2024
1 parent e7ab4cc commit c399806
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
1 change: 1 addition & 0 deletions cmd/civo/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func RootCredentials() *cobra.Command {
}

authCmd.Flags().BoolVar(&ciFlag, "ci", false, "if running kubefirst in ci, set this flag to disable interactive features")
authCmd.Flags().StringVar(&clusterNameFlag, "cluster-name", "", "cluster name (optional)")
authCmd.Flags().BoolVar(&copyArgoCDPasswordToClipboardFlag, "argocd", false, "copy the argocd password to the clipboard (optional)")
authCmd.Flags().BoolVar(&copyKbotPasswordToClipboardFlag, "kbot", false, "copy the kbot password to the clipboard (optional)")
authCmd.Flags().BoolVar(&copyVaultPasswordToClipboardFlag, "vault", false, "copy the vault password to the clipboard (optional)")
Expand Down
17 changes: 0 additions & 17 deletions cmd/civo/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,6 @@ func ValidateProvidedFlags(gitProvider string) error {
}
}

// switch gitProvider {
// case "github":
// key, err := internalssh.GetHostKey("github.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "github.com", key.Type())
// }
// case "gitlab":
// key, err := internalssh.GetHostKey("gitlab.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
// }
// }

progress.CompleteStep("Validate provided flags")

return nil
Expand Down
12 changes: 11 additions & 1 deletion internal/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,17 @@ func versionCheck() (res *CheckResponse, skip bool) {
}

func GetRootCredentials(cmd *cobra.Command, args []string) error {
clusterName := viper.GetString("flags.cluster-name")
clusterNameFromViper := viper.GetString("flags.cluster-name")

clusteNameFromFlag, err := cmd.Flags().GetString("cluster-name")
if err != nil {
return err
}

clusterName := clusterNameFromViper
if clusteNameFromFlag != "" {
clusterName = clusteNameFromFlag
}

cluster, err := cluster.GetCluster(clusterName)
if err != nil {
Expand Down

0 comments on commit c399806

Please sign in to comment.