Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
refactor keys extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
cr1cr1 committed Sep 28, 2023
1 parent 3563fed commit 5dfcf25
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/clusterBootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func RunClusterBootstrapCommand(cmd *cobra.Command, args []string) error {
"--cluster-name",
clusterBootstrap.parent.GetClusterContext(),
"--key-path",
"cluster.sshkey.enc.pub",
"cluster.sshkey.pub",
"[email protected]:@22",
},
)
Expand All @@ -86,7 +86,7 @@ func RunClusterBootstrapCommand(cmd *cobra.Command, args []string) error {
log.Warnf("Cluster file already exists: %s", clusterFile)
}

sshKey := clusterBootstrapPath + "/cluster.sshkey.enc"
sshKey := clusterBootstrapPath + "/cluster.sshkey"
if !file.IsAccessible(sshKey) {
config.ViperSet(secretsCmd, secrets.KeySecretsContext(), clusterBootstrap.parent.GetClusterContext())
if err := RunBootstrapSecretsCommand(
Expand Down
6 changes: 3 additions & 3 deletions cmd/secretsBootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func init() {
secretsBootstrapCmd.Flags().String(
secretsBootstrap.KeyPublicKeyPath(),
secretsBootstrap.DefaultPublicKeyPath(),
"Public key path",
"Public key path. Can have multiple keys separated by new lines",
)

secretsBootstrapCmd.Flags().Bool(
Expand Down Expand Up @@ -211,7 +211,7 @@ func (s *SecretsBootstrap) PatchSopsConfig() error {
pubKeys := strings.Split(string(pubKeysData), "\n")
filteredPubKeys := make([]string, 0, len(pubKeys))
for _, pk := range pubKeys {
pk = strings.Trim(pk, " \t")
pk = strings.TrimSpace(pk)
if len(pk) > 0 {
filteredPubKeys = append(filteredPubKeys, "\""+pk+"\"")
}
Expand Down Expand Up @@ -398,7 +398,7 @@ func (s *SecretsBootstrap) KeyPrivateKeyPath() string {
}

func (s *SecretsBootstrap) DefaultPrivateKeyPath() string {
return "secrets/" + defaults.Undefined + ".age.enc"
return "secrets/" + defaults.Undefined + ".age"
}

func (s *SecretsBootstrap) GetPrivateKeyPath() string {
Expand Down
2 changes: 1 addition & 1 deletion cmd/secretsEncryptDecrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (s *SecretsEncryptDecrypt) KeyPrivateKeyPath() string {
}

func (s *SecretsEncryptDecrypt) DefaultPrivateKeyPath() string {
return "secrets/" + defaults.Undefined + ".age.enc"
return "secrets/" + defaults.Undefined + ".age"
}

func (s *SecretsEncryptDecrypt) GetPrivateKeyPath() string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ const (
Linux = "linux"
Darwin = "darwin"
DefaultConfigName = "kubestrap-defaults"
DefaultClusterSshKeyFileName = "cluster.sshkey.enc"
DefaultClusterSshKeyFileName = "cluster.sshkey"
)

0 comments on commit 5dfcf25

Please sign in to comment.